@azure/communication-call-automation 1.3.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (562) hide show
  1. package/README.md +66 -57
  2. package/dist/browser/callAutomationClient.d.ts +98 -0
  3. package/dist/browser/callAutomationClient.d.ts.map +1 -0
  4. package/{dist-esm/src → dist/browser}/callAutomationClient.js +5 -5
  5. package/dist/browser/callAutomationClient.js.map +1 -0
  6. package/dist/browser/callAutomationEventParser.d.ts +6 -0
  7. package/dist/browser/callAutomationEventParser.d.ts.map +1 -0
  8. package/{dist-esm/src → dist/browser}/callAutomationEventParser.js +2 -2
  9. package/dist/browser/callAutomationEventParser.js.map +1 -0
  10. package/dist/browser/callConnection.d.ts +76 -0
  11. package/dist/browser/callConnection.d.ts.map +1 -0
  12. package/{dist-esm/src → dist/browser}/callConnection.js +4 -4
  13. package/dist/browser/callConnection.js.map +1 -0
  14. package/dist/browser/callMedia.d.ts +84 -0
  15. package/dist/browser/callMedia.d.ts.map +1 -0
  16. package/{dist-esm/src → dist/browser}/callMedia.js +2 -2
  17. package/dist/browser/callMedia.js.map +1 -0
  18. package/dist/browser/callRecording.d.ts +70 -0
  19. package/dist/browser/callRecording.d.ts.map +1 -0
  20. package/{dist-esm/src → dist/browser}/callRecording.js +5 -5
  21. package/dist/browser/callRecording.js.map +1 -0
  22. package/dist/browser/contentDownloader.d.ts +25 -0
  23. package/dist/browser/contentDownloader.d.ts.map +1 -0
  24. package/dist/browser/contentDownloader.js.map +1 -0
  25. package/dist/browser/credential/callAutomationAccessKeyCredentialPolicy.d.ts +10 -0
  26. package/dist/browser/credential/callAutomationAccessKeyCredentialPolicy.d.ts.map +1 -0
  27. package/{dist-esm/src → dist/browser}/credential/callAutomationAccessKeyCredentialPolicy.js +1 -1
  28. package/dist/browser/credential/callAutomationAccessKeyCredentialPolicy.js.map +1 -0
  29. package/dist/browser/credential/callAutomationAuthPolicy.d.ts +22 -0
  30. package/dist/browser/credential/callAutomationAuthPolicy.d.ts.map +1 -0
  31. package/{dist-esm/src → dist/browser}/credential/callAutomationAuthPolicy.js +2 -2
  32. package/dist/browser/credential/callAutomationAuthPolicy.js.map +1 -0
  33. package/dist/browser/credential/cryptoUtils-browser.d.mts.map +1 -0
  34. package/dist/browser/credential/cryptoUtils-browser.mjs.map +1 -0
  35. package/dist/browser/credential/cryptoUtils.d.ts +3 -0
  36. package/{dist-esm/src/credential/cryptoUtils.browser.js → dist/browser/credential/cryptoUtils.js} +2 -2
  37. package/dist/browser/credential/encodeUtils.browser.d.ts +4 -0
  38. package/dist/browser/credential/encodeUtils.browser.d.ts.map +1 -0
  39. package/dist/browser/generated/src/callAutomationApiClient.d.ts +49 -0
  40. package/dist/browser/generated/src/callAutomationApiClient.d.ts.map +1 -0
  41. package/{dist-esm/src → dist/browser}/generated/src/callAutomationApiClient.js +3 -3
  42. package/dist/browser/generated/src/callAutomationApiClient.js.map +1 -0
  43. package/dist/browser/generated/src/index.d.ts +5 -0
  44. package/dist/browser/generated/src/index.d.ts.map +1 -0
  45. package/{dist-esm/src → dist/browser}/generated/src/index.js +4 -4
  46. package/dist/browser/generated/src/index.js.map +1 -0
  47. package/dist/browser/generated/src/models/index.d.ts +1494 -0
  48. package/dist/browser/generated/src/models/index.d.ts.map +1 -0
  49. package/dist/browser/generated/src/models/mappers.d.ts +82 -0
  50. package/dist/browser/generated/src/models/mappers.d.ts.map +1 -0
  51. package/dist/browser/generated/src/models/parameters.d.ts +29 -0
  52. package/dist/browser/generated/src/models/parameters.d.ts.map +1 -0
  53. package/{dist-esm/src → dist/browser}/generated/src/models/parameters.js +1 -1
  54. package/{dist-esm/src → dist/browser}/generated/src/models/parameters.js.map +1 -1
  55. package/dist/browser/generated/src/operations/callConnection.d.ts +96 -0
  56. package/dist/browser/generated/src/operations/callConnection.d.ts.map +1 -0
  57. package/{dist-esm/src → dist/browser}/generated/src/operations/callConnection.js +3 -3
  58. package/dist/browser/generated/src/operations/callConnection.js.map +1 -0
  59. package/dist/browser/generated/src/operations/callMedia.d.ts +68 -0
  60. package/dist/browser/generated/src/operations/callMedia.d.ts.map +1 -0
  61. package/{dist-esm/src → dist/browser}/generated/src/operations/callMedia.js +2 -2
  62. package/dist/browser/generated/src/operations/callMedia.js.map +1 -0
  63. package/dist/browser/generated/src/operations/callRecording.d.ts +43 -0
  64. package/dist/browser/generated/src/operations/callRecording.d.ts.map +1 -0
  65. package/{dist-esm/src → dist/browser}/generated/src/operations/callRecording.js +2 -2
  66. package/dist/browser/generated/src/operations/callRecording.js.map +1 -0
  67. package/dist/browser/generated/src/operations/index.d.ts +4 -0
  68. package/dist/browser/generated/src/operations/index.d.ts.map +1 -0
  69. package/{dist-esm/src/generated/src/operationsInterfaces → dist/browser/generated/src/operations}/index.js +3 -3
  70. package/dist/browser/generated/src/operations/index.js.map +1 -0
  71. package/dist/browser/generated/src/operationsInterfaces/callConnection.d.ts +73 -0
  72. package/dist/browser/generated/src/operationsInterfaces/callConnection.d.ts.map +1 -0
  73. package/dist/browser/generated/src/operationsInterfaces/callConnection.js.map +1 -0
  74. package/dist/browser/generated/src/operationsInterfaces/callMedia.d.ts +60 -0
  75. package/dist/browser/generated/src/operationsInterfaces/callMedia.d.ts.map +1 -0
  76. package/dist/browser/generated/src/operationsInterfaces/callMedia.js.map +1 -0
  77. package/dist/browser/generated/src/operationsInterfaces/callRecording.d.ts +35 -0
  78. package/dist/browser/generated/src/operationsInterfaces/callRecording.d.ts.map +1 -0
  79. package/dist/browser/generated/src/operationsInterfaces/callRecording.js.map +1 -0
  80. package/dist/browser/generated/src/operationsInterfaces/index.d.ts +4 -0
  81. package/dist/browser/generated/src/operationsInterfaces/index.d.ts.map +1 -0
  82. package/dist/browser/generated/src/operationsInterfaces/index.js +11 -0
  83. package/dist/browser/generated/src/operationsInterfaces/index.js.map +1 -0
  84. package/dist/browser/generated/src/pagingHelper.d.ts +13 -0
  85. package/dist/browser/generated/src/pagingHelper.d.ts.map +1 -0
  86. package/dist/browser/index.d.ts +10 -0
  87. package/dist/browser/index.d.ts.map +1 -0
  88. package/dist/browser/index.js +12 -0
  89. package/dist/browser/index.js.map +1 -0
  90. package/dist/browser/models/constants.d.ts +2 -0
  91. package/dist/browser/models/constants.d.ts.map +1 -0
  92. package/dist/browser/models/events.d.ts +395 -0
  93. package/dist/browser/models/events.d.ts.map +1 -0
  94. package/dist/browser/models/events.js.map +1 -0
  95. package/dist/browser/models/logger.d.ts +5 -0
  96. package/dist/browser/models/logger.d.ts.map +1 -0
  97. package/dist/browser/models/mapper.d.ts +3 -0
  98. package/dist/browser/models/mapper.d.ts.map +1 -0
  99. package/dist/browser/models/models.d.ts +188 -0
  100. package/dist/browser/models/models.d.ts.map +1 -0
  101. package/{dist-esm/src → dist/browser}/models/models.js +1 -1
  102. package/dist/browser/models/models.js.map +1 -0
  103. package/dist/browser/models/options.d.ts +315 -0
  104. package/dist/browser/models/options.d.ts.map +1 -0
  105. package/dist/browser/models/options.js.map +1 -0
  106. package/dist/browser/models/responses.d.ts +73 -0
  107. package/dist/browser/models/responses.d.ts.map +1 -0
  108. package/dist/browser/models/responses.js.map +1 -0
  109. package/dist/browser/package.json +3 -0
  110. package/dist/browser/utli/converters.d.ts +22 -0
  111. package/dist/browser/utli/converters.d.ts.map +1 -0
  112. package/{dist-esm/src → dist/browser}/utli/converters.js +15 -1
  113. package/dist/browser/utli/converters.js.map +1 -0
  114. package/dist/commonjs/callAutomationClient.d.ts +98 -0
  115. package/dist/commonjs/callAutomationClient.d.ts.map +1 -0
  116. package/dist/commonjs/callAutomationClient.js +218 -0
  117. package/{dist-esm/src → dist/commonjs}/callAutomationClient.js.map +1 -1
  118. package/dist/commonjs/callAutomationEventParser.d.ts +6 -0
  119. package/dist/commonjs/callAutomationEventParser.d.ts.map +1 -0
  120. package/dist/commonjs/callAutomationEventParser.js +151 -0
  121. package/dist/commonjs/callAutomationEventParser.js.map +1 -0
  122. package/dist/commonjs/callConnection.d.ts +76 -0
  123. package/dist/commonjs/callConnection.d.ts.map +1 -0
  124. package/dist/commonjs/callConnection.js +215 -0
  125. package/dist/commonjs/callConnection.js.map +1 -0
  126. package/dist/commonjs/callMedia.d.ts +84 -0
  127. package/dist/commonjs/callMedia.d.ts.map +1 -0
  128. package/dist/commonjs/callMedia.js +326 -0
  129. package/{dist-esm/src → dist/commonjs}/callMedia.js.map +1 -1
  130. package/dist/commonjs/callRecording.d.ts +70 -0
  131. package/dist/commonjs/callRecording.d.ts.map +1 -0
  132. package/dist/commonjs/callRecording.js +184 -0
  133. package/dist/commonjs/callRecording.js.map +1 -0
  134. package/dist/commonjs/contentDownloader.d.ts +25 -0
  135. package/dist/commonjs/contentDownloader.d.ts.map +1 -0
  136. package/dist/commonjs/contentDownloader.js +108 -0
  137. package/dist/commonjs/contentDownloader.js.map +1 -0
  138. package/dist/commonjs/credential/callAutomationAccessKeyCredentialPolicy.d.ts +10 -0
  139. package/dist/commonjs/credential/callAutomationAccessKeyCredentialPolicy.d.ts.map +1 -0
  140. package/dist/commonjs/credential/callAutomationAccessKeyCredentialPolicy.js +42 -0
  141. package/dist/commonjs/credential/callAutomationAccessKeyCredentialPolicy.js.map +1 -0
  142. package/dist/commonjs/credential/callAutomationAuthPolicy.d.ts +22 -0
  143. package/dist/commonjs/credential/callAutomationAuthPolicy.d.ts.map +1 -0
  144. package/dist/commonjs/credential/callAutomationAuthPolicy.js +57 -0
  145. package/dist/commonjs/credential/callAutomationAuthPolicy.js.map +1 -0
  146. package/dist/commonjs/credential/cryptoUtils.d.ts +3 -0
  147. package/dist/commonjs/credential/cryptoUtils.d.ts.map +1 -0
  148. package/dist/commonjs/credential/cryptoUtils.js +14 -0
  149. package/dist/commonjs/credential/cryptoUtils.js.map +1 -0
  150. package/dist/commonjs/credential/encodeUtils.browser.d.ts +4 -0
  151. package/dist/commonjs/credential/encodeUtils.browser.d.ts.map +1 -0
  152. package/dist/commonjs/credential/encodeUtils.browser.js +32 -0
  153. package/dist/commonjs/credential/encodeUtils.browser.js.map +1 -0
  154. package/dist/commonjs/generated/src/callAutomationApiClient.d.ts +49 -0
  155. package/dist/commonjs/generated/src/callAutomationApiClient.d.ts.map +1 -0
  156. package/dist/commonjs/generated/src/callAutomationApiClient.js +231 -0
  157. package/dist/commonjs/generated/src/callAutomationApiClient.js.map +1 -0
  158. package/dist/commonjs/generated/src/index.d.ts +5 -0
  159. package/dist/commonjs/generated/src/index.d.ts.map +1 -0
  160. package/dist/commonjs/generated/src/index.js +19 -0
  161. package/dist/commonjs/generated/src/index.js.map +1 -0
  162. package/dist/commonjs/generated/src/models/index.d.ts +1494 -0
  163. package/dist/commonjs/generated/src/models/index.d.ts.map +1 -0
  164. package/dist/commonjs/generated/src/models/index.js +203 -0
  165. package/dist/commonjs/generated/src/models/index.js.map +1 -0
  166. package/dist/commonjs/generated/src/models/mappers.d.ts +82 -0
  167. package/dist/commonjs/generated/src/models/mappers.d.ts.map +1 -0
  168. package/dist/commonjs/generated/src/models/mappers.js +2857 -0
  169. package/dist/commonjs/generated/src/models/mappers.js.map +1 -0
  170. package/dist/commonjs/generated/src/models/parameters.d.ts +29 -0
  171. package/dist/commonjs/generated/src/models/parameters.d.ts.map +1 -0
  172. package/dist/commonjs/generated/src/models/parameters.js +183 -0
  173. package/dist/commonjs/generated/src/models/parameters.js.map +1 -0
  174. package/dist/commonjs/generated/src/operations/callConnection.d.ts +96 -0
  175. package/dist/commonjs/generated/src/operations/callConnection.d.ts.map +1 -0
  176. package/dist/commonjs/generated/src/operations/callConnection.js +406 -0
  177. package/dist/commonjs/generated/src/operations/callConnection.js.map +1 -0
  178. package/dist/commonjs/generated/src/operations/callMedia.d.ts +68 -0
  179. package/dist/commonjs/generated/src/operations/callMedia.d.ts.map +1 -0
  180. package/dist/commonjs/generated/src/operations/callMedia.js +232 -0
  181. package/dist/commonjs/generated/src/operations/callMedia.js.map +1 -0
  182. package/dist/commonjs/generated/src/operations/callRecording.d.ts +43 -0
  183. package/dist/commonjs/generated/src/operations/callRecording.d.ts.map +1 -0
  184. package/dist/commonjs/generated/src/operations/callRecording.js +149 -0
  185. package/dist/commonjs/generated/src/operations/callRecording.js.map +1 -0
  186. package/dist/commonjs/generated/src/operations/index.d.ts +4 -0
  187. package/dist/commonjs/generated/src/operations/index.d.ts.map +1 -0
  188. package/dist/commonjs/generated/src/operations/index.js +14 -0
  189. package/dist/commonjs/generated/src/operations/index.js.map +1 -0
  190. package/dist/commonjs/generated/src/operationsInterfaces/callConnection.d.ts +73 -0
  191. package/dist/commonjs/generated/src/operationsInterfaces/callConnection.d.ts.map +1 -0
  192. package/{dist-esm/src/generated/src/operations/index.js → dist/commonjs/generated/src/operationsInterfaces/callConnection.js} +3 -4
  193. package/dist/commonjs/generated/src/operationsInterfaces/callConnection.js.map +1 -0
  194. package/dist/commonjs/generated/src/operationsInterfaces/callMedia.d.ts +60 -0
  195. package/dist/commonjs/generated/src/operationsInterfaces/callMedia.d.ts.map +1 -0
  196. package/dist/commonjs/generated/src/operationsInterfaces/callMedia.js +10 -0
  197. package/dist/commonjs/generated/src/operationsInterfaces/callMedia.js.map +1 -0
  198. package/dist/commonjs/generated/src/operationsInterfaces/callRecording.d.ts +35 -0
  199. package/dist/commonjs/generated/src/operationsInterfaces/callRecording.d.ts.map +1 -0
  200. package/dist/commonjs/generated/src/operationsInterfaces/callRecording.js +10 -0
  201. package/dist/commonjs/generated/src/operationsInterfaces/callRecording.js.map +1 -0
  202. package/dist/commonjs/generated/src/operationsInterfaces/index.d.ts +4 -0
  203. package/dist/commonjs/generated/src/operationsInterfaces/index.d.ts.map +1 -0
  204. package/dist/commonjs/generated/src/operationsInterfaces/index.js +14 -0
  205. package/dist/commonjs/generated/src/operationsInterfaces/index.js.map +1 -0
  206. package/dist/commonjs/generated/src/pagingHelper.d.ts +13 -0
  207. package/dist/commonjs/generated/src/pagingHelper.d.ts.map +1 -0
  208. package/dist/commonjs/generated/src/pagingHelper.js +36 -0
  209. package/dist/commonjs/generated/src/pagingHelper.js.map +1 -0
  210. package/dist/commonjs/index.d.ts +10 -0
  211. package/dist/commonjs/index.d.ts.map +1 -0
  212. package/dist/commonjs/index.js +15 -0
  213. package/dist/commonjs/index.js.map +1 -0
  214. package/dist/commonjs/models/constants.d.ts +2 -0
  215. package/dist/commonjs/models/constants.d.ts.map +1 -0
  216. package/dist/commonjs/models/constants.js +7 -0
  217. package/dist/commonjs/models/constants.js.map +1 -0
  218. package/dist/commonjs/models/events.d.ts +395 -0
  219. package/dist/commonjs/models/events.d.ts.map +1 -0
  220. package/dist/commonjs/models/events.js +5 -0
  221. package/dist/commonjs/models/events.js.map +1 -0
  222. package/dist/commonjs/models/logger.d.ts +5 -0
  223. package/dist/commonjs/models/logger.d.ts.map +1 -0
  224. package/dist/commonjs/models/logger.js +11 -0
  225. package/dist/commonjs/models/logger.js.map +1 -0
  226. package/dist/commonjs/models/mapper.d.ts +3 -0
  227. package/dist/commonjs/models/mapper.d.ts.map +1 -0
  228. package/dist/commonjs/models/mapper.js +79 -0
  229. package/dist/commonjs/models/mapper.js.map +1 -0
  230. package/dist/commonjs/models/models.d.ts +188 -0
  231. package/dist/commonjs/models/models.d.ts.map +1 -0
  232. package/dist/commonjs/models/models.js +58 -0
  233. package/dist/commonjs/models/models.js.map +1 -0
  234. package/dist/commonjs/models/options.d.ts +315 -0
  235. package/dist/commonjs/models/options.d.ts.map +1 -0
  236. package/dist/commonjs/models/options.js +5 -0
  237. package/dist/commonjs/models/options.js.map +1 -0
  238. package/dist/commonjs/models/responses.d.ts +73 -0
  239. package/dist/commonjs/models/responses.d.ts.map +1 -0
  240. package/dist/commonjs/models/responses.js +5 -0
  241. package/dist/commonjs/models/responses.js.map +1 -0
  242. package/dist/commonjs/package.json +3 -0
  243. package/dist/commonjs/tsdoc-metadata.json +11 -0
  244. package/dist/commonjs/utli/converters.d.ts +22 -0
  245. package/dist/commonjs/utli/converters.d.ts.map +1 -0
  246. package/dist/commonjs/utli/converters.js +153 -0
  247. package/dist/commonjs/utli/converters.js.map +1 -0
  248. package/dist/esm/callAutomationClient.d.ts +98 -0
  249. package/dist/esm/callAutomationClient.d.ts.map +1 -0
  250. package/dist/esm/callAutomationClient.js +214 -0
  251. package/dist/esm/callAutomationClient.js.map +1 -0
  252. package/dist/esm/callAutomationEventParser.d.ts +6 -0
  253. package/dist/esm/callAutomationEventParser.d.ts.map +1 -0
  254. package/dist/esm/callAutomationEventParser.js +148 -0
  255. package/dist/esm/callAutomationEventParser.js.map +1 -0
  256. package/dist/esm/callConnection.d.ts +76 -0
  257. package/dist/esm/callConnection.d.ts.map +1 -0
  258. package/dist/esm/callConnection.js +211 -0
  259. package/dist/esm/callConnection.js.map +1 -0
  260. package/dist/esm/callMedia.d.ts +84 -0
  261. package/dist/esm/callMedia.d.ts.map +1 -0
  262. package/dist/esm/callMedia.js +322 -0
  263. package/dist/esm/callMedia.js.map +1 -0
  264. package/dist/esm/callRecording.d.ts +70 -0
  265. package/dist/esm/callRecording.d.ts.map +1 -0
  266. package/dist/esm/callRecording.js +179 -0
  267. package/dist/esm/callRecording.js.map +1 -0
  268. package/dist/esm/contentDownloader.d.ts +25 -0
  269. package/dist/esm/contentDownloader.d.ts.map +1 -0
  270. package/dist/esm/contentDownloader.js +104 -0
  271. package/dist/esm/contentDownloader.js.map +1 -0
  272. package/dist/esm/credential/callAutomationAccessKeyCredentialPolicy.d.ts +10 -0
  273. package/dist/esm/credential/callAutomationAccessKeyCredentialPolicy.d.ts.map +1 -0
  274. package/dist/esm/credential/callAutomationAccessKeyCredentialPolicy.js +39 -0
  275. package/dist/esm/credential/callAutomationAccessKeyCredentialPolicy.js.map +1 -0
  276. package/dist/esm/credential/callAutomationAuthPolicy.d.ts +22 -0
  277. package/dist/esm/credential/callAutomationAuthPolicy.d.ts.map +1 -0
  278. package/dist/esm/credential/callAutomationAuthPolicy.js +53 -0
  279. package/dist/esm/credential/callAutomationAuthPolicy.js.map +1 -0
  280. package/dist/esm/credential/cryptoUtils.d.ts +3 -0
  281. package/dist/esm/credential/cryptoUtils.d.ts.map +1 -0
  282. package/{dist-esm/src → dist/esm}/credential/cryptoUtils.js +1 -1
  283. package/{dist-esm/src → dist/esm}/credential/cryptoUtils.js.map +1 -1
  284. package/dist/esm/credential/encodeUtils.browser.d.ts +4 -0
  285. package/dist/esm/credential/encodeUtils.browser.d.ts.map +1 -0
  286. package/dist/esm/credential/encodeUtils.browser.js +26 -0
  287. package/dist/esm/credential/encodeUtils.browser.js.map +1 -0
  288. package/dist/esm/generated/src/callAutomationApiClient.d.ts +49 -0
  289. package/dist/esm/generated/src/callAutomationApiClient.d.ts.map +1 -0
  290. package/dist/esm/generated/src/callAutomationApiClient.js +226 -0
  291. package/dist/esm/generated/src/callAutomationApiClient.js.map +1 -0
  292. package/dist/esm/generated/src/index.d.ts +5 -0
  293. package/dist/esm/generated/src/index.d.ts.map +1 -0
  294. package/dist/esm/generated/src/index.js +13 -0
  295. package/dist/esm/generated/src/index.js.map +1 -0
  296. package/dist/esm/generated/src/models/index.d.ts +1494 -0
  297. package/dist/esm/generated/src/models/index.d.ts.map +1 -0
  298. package/dist/esm/generated/src/models/index.js +200 -0
  299. package/dist/esm/generated/src/models/index.js.map +1 -0
  300. package/dist/esm/generated/src/models/mappers.d.ts +82 -0
  301. package/dist/esm/generated/src/models/mappers.d.ts.map +1 -0
  302. package/dist/esm/generated/src/models/mappers.js +2853 -0
  303. package/dist/esm/generated/src/models/mappers.js.map +1 -0
  304. package/dist/esm/generated/src/models/parameters.d.ts +29 -0
  305. package/dist/esm/generated/src/models/parameters.d.ts.map +1 -0
  306. package/dist/esm/generated/src/models/parameters.js +180 -0
  307. package/dist/esm/generated/src/models/parameters.js.map +1 -0
  308. package/dist/esm/generated/src/operations/callConnection.d.ts +96 -0
  309. package/dist/esm/generated/src/operations/callConnection.d.ts.map +1 -0
  310. package/dist/esm/generated/src/operations/callConnection.js +402 -0
  311. package/dist/esm/generated/src/operations/callConnection.js.map +1 -0
  312. package/dist/esm/generated/src/operations/callMedia.d.ts +68 -0
  313. package/dist/esm/generated/src/operations/callMedia.d.ts.map +1 -0
  314. package/dist/esm/generated/src/operations/callMedia.js +227 -0
  315. package/dist/esm/generated/src/operations/callMedia.js.map +1 -0
  316. package/dist/esm/generated/src/operations/callRecording.d.ts +43 -0
  317. package/dist/esm/generated/src/operations/callRecording.d.ts.map +1 -0
  318. package/dist/esm/generated/src/operations/callRecording.js +144 -0
  319. package/dist/esm/generated/src/operations/callRecording.js.map +1 -0
  320. package/dist/esm/generated/src/operations/index.d.ts +4 -0
  321. package/dist/esm/generated/src/operations/index.d.ts.map +1 -0
  322. package/dist/esm/generated/src/operations/index.js +11 -0
  323. package/dist/esm/generated/src/operations/index.js.map +1 -0
  324. package/dist/esm/generated/src/operationsInterfaces/callConnection.d.ts +73 -0
  325. package/dist/esm/generated/src/operationsInterfaces/callConnection.d.ts.map +1 -0
  326. package/dist/esm/generated/src/operationsInterfaces/callConnection.js +9 -0
  327. package/dist/esm/generated/src/operationsInterfaces/callConnection.js.map +1 -0
  328. package/dist/esm/generated/src/operationsInterfaces/callMedia.d.ts +60 -0
  329. package/dist/esm/generated/src/operationsInterfaces/callMedia.d.ts.map +1 -0
  330. package/dist/esm/generated/src/operationsInterfaces/callMedia.js +9 -0
  331. package/dist/esm/generated/src/operationsInterfaces/callMedia.js.map +1 -0
  332. package/dist/esm/generated/src/operationsInterfaces/callRecording.d.ts +35 -0
  333. package/dist/esm/generated/src/operationsInterfaces/callRecording.d.ts.map +1 -0
  334. package/dist/esm/generated/src/operationsInterfaces/callRecording.js +9 -0
  335. package/dist/esm/generated/src/operationsInterfaces/callRecording.js.map +1 -0
  336. package/dist/esm/generated/src/operationsInterfaces/index.d.ts +4 -0
  337. package/dist/esm/generated/src/operationsInterfaces/index.d.ts.map +1 -0
  338. package/dist/esm/generated/src/operationsInterfaces/index.js +11 -0
  339. package/dist/esm/generated/src/operationsInterfaces/index.js.map +1 -0
  340. package/dist/esm/generated/src/pagingHelper.d.ts +13 -0
  341. package/dist/esm/generated/src/pagingHelper.d.ts.map +1 -0
  342. package/dist/esm/generated/src/pagingHelper.js +32 -0
  343. package/dist/esm/generated/src/pagingHelper.js.map +1 -0
  344. package/dist/esm/index.d.ts +10 -0
  345. package/dist/esm/index.d.ts.map +1 -0
  346. package/dist/esm/index.js +12 -0
  347. package/dist/esm/index.js.map +1 -0
  348. package/dist/esm/models/constants.d.ts +2 -0
  349. package/dist/esm/models/constants.d.ts.map +1 -0
  350. package/dist/esm/models/constants.js +4 -0
  351. package/dist/esm/models/constants.js.map +1 -0
  352. package/dist/esm/models/events.d.ts +395 -0
  353. package/dist/esm/models/events.d.ts.map +1 -0
  354. package/dist/esm/models/events.js +4 -0
  355. package/dist/esm/models/events.js.map +1 -0
  356. package/dist/esm/models/logger.d.ts +5 -0
  357. package/dist/esm/models/logger.d.ts.map +1 -0
  358. package/dist/esm/models/logger.js +8 -0
  359. package/dist/esm/models/logger.js.map +1 -0
  360. package/dist/esm/models/mapper.d.ts +3 -0
  361. package/dist/esm/models/mapper.d.ts.map +1 -0
  362. package/dist/esm/models/mapper.js +76 -0
  363. package/dist/esm/models/mapper.js.map +1 -0
  364. package/dist/esm/models/models.d.ts +188 -0
  365. package/dist/esm/models/models.d.ts.map +1 -0
  366. package/dist/esm/models/models.js +54 -0
  367. package/dist/esm/models/models.js.map +1 -0
  368. package/dist/esm/models/options.d.ts +315 -0
  369. package/dist/esm/models/options.d.ts.map +1 -0
  370. package/dist/esm/models/options.js +4 -0
  371. package/dist/esm/models/options.js.map +1 -0
  372. package/dist/esm/models/responses.d.ts +73 -0
  373. package/dist/esm/models/responses.d.ts.map +1 -0
  374. package/dist/esm/models/responses.js +4 -0
  375. package/dist/esm/models/responses.js.map +1 -0
  376. package/dist/esm/package.json +3 -0
  377. package/dist/esm/utli/converters.d.ts +22 -0
  378. package/dist/esm/utli/converters.d.ts.map +1 -0
  379. package/dist/esm/utli/converters.js +142 -0
  380. package/dist/esm/utli/converters.js.map +1 -0
  381. package/dist/react-native/callAutomationClient.d.ts +98 -0
  382. package/dist/react-native/callAutomationClient.d.ts.map +1 -0
  383. package/dist/react-native/callAutomationClient.js +214 -0
  384. package/dist/react-native/callAutomationClient.js.map +1 -0
  385. package/dist/react-native/callAutomationEventParser.d.ts +6 -0
  386. package/dist/react-native/callAutomationEventParser.d.ts.map +1 -0
  387. package/dist/react-native/callAutomationEventParser.js +148 -0
  388. package/dist/react-native/callAutomationEventParser.js.map +1 -0
  389. package/dist/react-native/callConnection.d.ts +76 -0
  390. package/dist/react-native/callConnection.d.ts.map +1 -0
  391. package/dist/react-native/callConnection.js +211 -0
  392. package/dist/react-native/callConnection.js.map +1 -0
  393. package/dist/react-native/callMedia.d.ts +84 -0
  394. package/dist/react-native/callMedia.d.ts.map +1 -0
  395. package/dist/react-native/callMedia.js +322 -0
  396. package/dist/react-native/callMedia.js.map +1 -0
  397. package/dist/react-native/callRecording.d.ts +70 -0
  398. package/dist/react-native/callRecording.d.ts.map +1 -0
  399. package/dist/react-native/callRecording.js +179 -0
  400. package/dist/react-native/callRecording.js.map +1 -0
  401. package/dist/react-native/contentDownloader.d.ts +25 -0
  402. package/dist/react-native/contentDownloader.d.ts.map +1 -0
  403. package/dist/react-native/contentDownloader.js +104 -0
  404. package/dist/react-native/contentDownloader.js.map +1 -0
  405. package/dist/react-native/credential/callAutomationAccessKeyCredentialPolicy.d.ts +10 -0
  406. package/dist/react-native/credential/callAutomationAccessKeyCredentialPolicy.d.ts.map +1 -0
  407. package/dist/react-native/credential/callAutomationAccessKeyCredentialPolicy.js +39 -0
  408. package/dist/react-native/credential/callAutomationAccessKeyCredentialPolicy.js.map +1 -0
  409. package/dist/react-native/credential/callAutomationAuthPolicy.d.ts +22 -0
  410. package/dist/react-native/credential/callAutomationAuthPolicy.d.ts.map +1 -0
  411. package/dist/react-native/credential/callAutomationAuthPolicy.js +53 -0
  412. package/dist/react-native/credential/callAutomationAuthPolicy.js.map +1 -0
  413. package/dist/react-native/credential/cryptoUtils.d.ts +3 -0
  414. package/dist/react-native/credential/cryptoUtils.d.ts.map +1 -0
  415. package/dist/react-native/credential/cryptoUtils.js +9 -0
  416. package/dist/react-native/credential/cryptoUtils.js.map +1 -0
  417. package/dist/react-native/credential/encodeUtils.browser.d.ts +4 -0
  418. package/dist/react-native/credential/encodeUtils.browser.d.ts.map +1 -0
  419. package/dist/react-native/credential/encodeUtils.browser.js +26 -0
  420. package/dist/react-native/credential/encodeUtils.browser.js.map +1 -0
  421. package/dist/react-native/generated/src/callAutomationApiClient.d.ts +49 -0
  422. package/dist/react-native/generated/src/callAutomationApiClient.d.ts.map +1 -0
  423. package/dist/react-native/generated/src/callAutomationApiClient.js +226 -0
  424. package/dist/react-native/generated/src/callAutomationApiClient.js.map +1 -0
  425. package/dist/react-native/generated/src/index.d.ts +5 -0
  426. package/dist/react-native/generated/src/index.d.ts.map +1 -0
  427. package/dist/react-native/generated/src/index.js +13 -0
  428. package/dist/react-native/generated/src/index.js.map +1 -0
  429. package/dist/react-native/generated/src/models/index.d.ts +1494 -0
  430. package/dist/react-native/generated/src/models/index.d.ts.map +1 -0
  431. package/dist/react-native/generated/src/models/index.js +200 -0
  432. package/dist/react-native/generated/src/models/index.js.map +1 -0
  433. package/dist/react-native/generated/src/models/mappers.d.ts +82 -0
  434. package/dist/react-native/generated/src/models/mappers.d.ts.map +1 -0
  435. package/dist/react-native/generated/src/models/mappers.js +2853 -0
  436. package/dist/react-native/generated/src/models/mappers.js.map +1 -0
  437. package/dist/react-native/generated/src/models/parameters.d.ts +29 -0
  438. package/dist/react-native/generated/src/models/parameters.d.ts.map +1 -0
  439. package/dist/react-native/generated/src/models/parameters.js +180 -0
  440. package/dist/react-native/generated/src/models/parameters.js.map +1 -0
  441. package/dist/react-native/generated/src/operations/callConnection.d.ts +96 -0
  442. package/dist/react-native/generated/src/operations/callConnection.d.ts.map +1 -0
  443. package/dist/react-native/generated/src/operations/callConnection.js +402 -0
  444. package/dist/react-native/generated/src/operations/callConnection.js.map +1 -0
  445. package/dist/react-native/generated/src/operations/callMedia.d.ts +68 -0
  446. package/dist/react-native/generated/src/operations/callMedia.d.ts.map +1 -0
  447. package/dist/react-native/generated/src/operations/callMedia.js +227 -0
  448. package/dist/react-native/generated/src/operations/callMedia.js.map +1 -0
  449. package/dist/react-native/generated/src/operations/callRecording.d.ts +43 -0
  450. package/dist/react-native/generated/src/operations/callRecording.d.ts.map +1 -0
  451. package/dist/react-native/generated/src/operations/callRecording.js +144 -0
  452. package/dist/react-native/generated/src/operations/callRecording.js.map +1 -0
  453. package/dist/react-native/generated/src/operations/index.d.ts +4 -0
  454. package/dist/react-native/generated/src/operations/index.d.ts.map +1 -0
  455. package/dist/react-native/generated/src/operations/index.js +11 -0
  456. package/dist/react-native/generated/src/operations/index.js.map +1 -0
  457. package/dist/react-native/generated/src/operationsInterfaces/callConnection.d.ts +73 -0
  458. package/dist/react-native/generated/src/operationsInterfaces/callConnection.d.ts.map +1 -0
  459. package/dist/react-native/generated/src/operationsInterfaces/callConnection.js +9 -0
  460. package/dist/react-native/generated/src/operationsInterfaces/callConnection.js.map +1 -0
  461. package/dist/react-native/generated/src/operationsInterfaces/callMedia.d.ts +60 -0
  462. package/dist/react-native/generated/src/operationsInterfaces/callMedia.d.ts.map +1 -0
  463. package/dist/react-native/generated/src/operationsInterfaces/callMedia.js +9 -0
  464. package/dist/react-native/generated/src/operationsInterfaces/callMedia.js.map +1 -0
  465. package/dist/react-native/generated/src/operationsInterfaces/callRecording.d.ts +35 -0
  466. package/dist/react-native/generated/src/operationsInterfaces/callRecording.d.ts.map +1 -0
  467. package/dist/react-native/generated/src/operationsInterfaces/callRecording.js +9 -0
  468. package/dist/react-native/generated/src/operationsInterfaces/callRecording.js.map +1 -0
  469. package/dist/react-native/generated/src/operationsInterfaces/index.d.ts +4 -0
  470. package/dist/react-native/generated/src/operationsInterfaces/index.d.ts.map +1 -0
  471. package/dist/react-native/generated/src/operationsInterfaces/index.js +11 -0
  472. package/dist/react-native/generated/src/operationsInterfaces/index.js.map +1 -0
  473. package/dist/react-native/generated/src/pagingHelper.d.ts +13 -0
  474. package/dist/react-native/generated/src/pagingHelper.d.ts.map +1 -0
  475. package/dist/react-native/generated/src/pagingHelper.js +32 -0
  476. package/dist/react-native/generated/src/pagingHelper.js.map +1 -0
  477. package/dist/react-native/index.d.ts +10 -0
  478. package/dist/react-native/index.d.ts.map +1 -0
  479. package/dist/react-native/index.js +12 -0
  480. package/dist/react-native/index.js.map +1 -0
  481. package/dist/react-native/models/constants.d.ts +2 -0
  482. package/dist/react-native/models/constants.d.ts.map +1 -0
  483. package/dist/react-native/models/constants.js +4 -0
  484. package/dist/react-native/models/constants.js.map +1 -0
  485. package/dist/react-native/models/events.d.ts +395 -0
  486. package/dist/react-native/models/events.d.ts.map +1 -0
  487. package/dist/react-native/models/events.js +4 -0
  488. package/dist/react-native/models/events.js.map +1 -0
  489. package/dist/react-native/models/logger.d.ts +5 -0
  490. package/dist/react-native/models/logger.d.ts.map +1 -0
  491. package/dist/react-native/models/logger.js +8 -0
  492. package/dist/react-native/models/logger.js.map +1 -0
  493. package/dist/react-native/models/mapper.d.ts +3 -0
  494. package/dist/react-native/models/mapper.d.ts.map +1 -0
  495. package/dist/react-native/models/mapper.js +76 -0
  496. package/dist/react-native/models/mapper.js.map +1 -0
  497. package/dist/react-native/models/models.d.ts +188 -0
  498. package/dist/react-native/models/models.d.ts.map +1 -0
  499. package/dist/react-native/models/models.js +54 -0
  500. package/dist/react-native/models/models.js.map +1 -0
  501. package/dist/react-native/models/options.d.ts +315 -0
  502. package/dist/react-native/models/options.d.ts.map +1 -0
  503. package/dist/react-native/models/options.js +4 -0
  504. package/dist/react-native/models/options.js.map +1 -0
  505. package/dist/react-native/models/responses.d.ts +73 -0
  506. package/dist/react-native/models/responses.d.ts.map +1 -0
  507. package/dist/react-native/models/responses.js +4 -0
  508. package/dist/react-native/models/responses.js.map +1 -0
  509. package/dist/react-native/package.json +3 -0
  510. package/dist/react-native/utli/converters.d.ts +22 -0
  511. package/dist/react-native/utli/converters.d.ts.map +1 -0
  512. package/dist/react-native/utli/converters.js +142 -0
  513. package/dist/react-native/utli/converters.js.map +1 -0
  514. package/package.json +91 -53
  515. package/dist/index.js +0 -5763
  516. package/dist/index.js.map +0 -1
  517. package/dist-esm/src/callAutomationEventParser.js.map +0 -1
  518. package/dist-esm/src/callConnection.js.map +0 -1
  519. package/dist-esm/src/callRecording.js.map +0 -1
  520. package/dist-esm/src/contentDownloader.js.map +0 -1
  521. package/dist-esm/src/credential/callAutomationAccessKeyCredentialPolicy.js.map +0 -1
  522. package/dist-esm/src/credential/callAutomationAuthPolicy.js.map +0 -1
  523. package/dist-esm/src/credential/cryptoUtils.browser.js.map +0 -1
  524. package/dist-esm/src/generated/src/callAutomationApiClient.js.map +0 -1
  525. package/dist-esm/src/generated/src/index.js.map +0 -1
  526. package/dist-esm/src/generated/src/operations/callConnection.js.map +0 -1
  527. package/dist-esm/src/generated/src/operations/callMedia.js.map +0 -1
  528. package/dist-esm/src/generated/src/operations/callRecording.js.map +0 -1
  529. package/dist-esm/src/generated/src/operations/index.js.map +0 -1
  530. package/dist-esm/src/generated/src/operationsInterfaces/callConnection.js.map +0 -1
  531. package/dist-esm/src/generated/src/operationsInterfaces/callMedia.js.map +0 -1
  532. package/dist-esm/src/generated/src/operationsInterfaces/callRecording.js.map +0 -1
  533. package/dist-esm/src/generated/src/operationsInterfaces/index.js.map +0 -1
  534. package/dist-esm/src/index.js +0 -12
  535. package/dist-esm/src/index.js.map +0 -1
  536. package/dist-esm/src/models/events.js.map +0 -1
  537. package/dist-esm/src/models/models.js.map +0 -1
  538. package/dist-esm/src/models/options.js.map +0 -1
  539. package/dist-esm/src/models/responses.js.map +0 -1
  540. package/dist-esm/src/utli/converters.js.map +0 -1
  541. package/types/communication-call-automation.d.ts +0 -2014
  542. /package/{dist-esm/src → dist/browser}/contentDownloader.js +0 -0
  543. /package/{dist-esm/src → dist/browser}/credential/encodeUtils.browser.js +0 -0
  544. /package/{dist-esm/src → dist/browser}/credential/encodeUtils.browser.js.map +0 -0
  545. /package/{dist-esm/src → dist/browser}/generated/src/models/index.js +0 -0
  546. /package/{dist-esm/src → dist/browser}/generated/src/models/index.js.map +0 -0
  547. /package/{dist-esm/src → dist/browser}/generated/src/models/mappers.js +0 -0
  548. /package/{dist-esm/src → dist/browser}/generated/src/models/mappers.js.map +0 -0
  549. /package/{dist-esm/src → dist/browser}/generated/src/operationsInterfaces/callConnection.js +0 -0
  550. /package/{dist-esm/src → dist/browser}/generated/src/operationsInterfaces/callMedia.js +0 -0
  551. /package/{dist-esm/src → dist/browser}/generated/src/operationsInterfaces/callRecording.js +0 -0
  552. /package/{dist-esm/src → dist/browser}/generated/src/pagingHelper.js +0 -0
  553. /package/{dist-esm/src → dist/browser}/generated/src/pagingHelper.js.map +0 -0
  554. /package/{dist-esm/src → dist/browser}/models/constants.js +0 -0
  555. /package/{dist-esm/src → dist/browser}/models/constants.js.map +0 -0
  556. /package/{dist-esm/src → dist/browser}/models/events.js +0 -0
  557. /package/{dist-esm/src → dist/browser}/models/logger.js +0 -0
  558. /package/{dist-esm/src → dist/browser}/models/logger.js.map +0 -0
  559. /package/{dist-esm/src → dist/browser}/models/mapper.js +0 -0
  560. /package/{dist-esm/src → dist/browser}/models/mapper.js.map +0 -0
  561. /package/{dist-esm/src → dist/browser}/models/options.js +0 -0
  562. /package/{dist-esm/src → dist/browser}/models/responses.js +0 -0
@@ -0,0 +1,179 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { CallRecordingImpl } from "./generated/src/operations/index.js";
4
+ import { communicationIdentifierModelConverter } from "./utli/converters.js";
5
+ import { ContentDownloaderImpl } from "./contentDownloader.js";
6
+ import * as fs from "node:fs";
7
+ import { randomUUID } from "@azure/core-util";
8
+ import { CallAutomationApiClient } from "./generated/src/index.js";
9
+ import { createCommunicationAuthPolicy } from "@azure/communication-common";
10
+ /**
11
+ * CallRecording class represents call recording related APIs.
12
+ */
13
+ export class CallRecording {
14
+ constructor(endpoint, credential, options) {
15
+ this.callAutomationApiClient = new CallAutomationApiClient(endpoint, options);
16
+ const authPolicy = createCommunicationAuthPolicy(credential);
17
+ this.callAutomationApiClient.pipeline.addPolicy(authPolicy);
18
+ this.callRecordingImpl = new CallRecordingImpl(this.callAutomationApiClient);
19
+ this.contentDownloader = new ContentDownloaderImpl(this.callAutomationApiClient);
20
+ }
21
+ /**
22
+ * Starts a call recording with the specified options.
23
+ * @param startCallRecordingRequest - options to start the call recording
24
+ * @param options - Operation options.
25
+ */
26
+ async start(options) {
27
+ const startCallRecordingRequest = {
28
+ callLocator: options.callLocator,
29
+ };
30
+ startCallRecordingRequest.recordingChannelType = options.recordingChannel;
31
+ startCallRecordingRequest.recordingContentType = options.recordingContent;
32
+ startCallRecordingRequest.recordingFormatType = options.recordingFormat;
33
+ startCallRecordingRequest.recordingStateCallbackUri = options.recordingStateCallbackEndpointUrl;
34
+ startCallRecordingRequest.pauseOnStart = options.pauseOnStart;
35
+ startCallRecordingRequest.recordingStorage = options.recordingStorage;
36
+ if (options.channelAffinity) {
37
+ startCallRecordingRequest.channelAffinity = [];
38
+ options.channelAffinity.forEach((identifier) => {
39
+ var _a;
40
+ (_a = startCallRecordingRequest.channelAffinity) === null || _a === void 0 ? void 0 : _a.push({
41
+ participant: communicationIdentifierModelConverter(identifier.targetParticipant),
42
+ channel: identifier.channel,
43
+ });
44
+ });
45
+ }
46
+ if (options.audioChannelParticipantOrdering) {
47
+ startCallRecordingRequest.audioChannelParticipantOrdering = [];
48
+ options.audioChannelParticipantOrdering.forEach((identifier) => {
49
+ var _a;
50
+ (_a = startCallRecordingRequest.audioChannelParticipantOrdering) === null || _a === void 0 ? void 0 : _a.push(communicationIdentifierModelConverter(identifier));
51
+ });
52
+ }
53
+ if (options.callLocator.kind === "groupCallLocator") {
54
+ startCallRecordingRequest.callLocator.kind = "groupCallLocator";
55
+ startCallRecordingRequest.callLocator.groupCallId = options.callLocator.id;
56
+ }
57
+ else if (options.callLocator.kind === "roomCallLocator") {
58
+ startCallRecordingRequest.callLocator.kind = "roomCallLocator";
59
+ startCallRecordingRequest.callLocator.roomId = options.callLocator.id;
60
+ }
61
+ else {
62
+ startCallRecordingRequest.callLocator.kind = "serverCallLocator";
63
+ startCallRecordingRequest.callLocator.serverCallId = options.callLocator.id;
64
+ }
65
+ const optionsInternal = Object.assign(Object.assign({}, options), { repeatabilityFirstSent: new Date(), repeatabilityRequestID: randomUUID() });
66
+ const response = await this.callRecordingImpl.startRecording(startCallRecordingRequest, optionsInternal);
67
+ const result = {
68
+ recordingId: response.recordingId,
69
+ recordingKind: response.recordingKind,
70
+ recordingState: response.recordingState,
71
+ };
72
+ return result;
73
+ }
74
+ /**
75
+ * Returns call recording properties.
76
+ * @param recordingId - The recordingId associated with the recording.
77
+ * @param options - Additional request options contains getRecordingProperties api options.
78
+ */
79
+ async getState(recordingId, options = {}) {
80
+ const response = await this.callRecordingImpl.getRecordingProperties(recordingId, options);
81
+ const result = {
82
+ recordingId: response.recordingId,
83
+ recordingKind: response.recordingKind,
84
+ recordingState: response.recordingState,
85
+ };
86
+ return result;
87
+ }
88
+ /**
89
+ * Stops a call recording.
90
+ * @param recordingId - The recordingId associated with the recording.
91
+ * @param options - Additional request options contains stopRecording api options.
92
+ */
93
+ async stop(recordingId, options = {}) {
94
+ return this.callRecordingImpl.stopRecording(recordingId, options);
95
+ }
96
+ /**
97
+ * Pauses a call recording.
98
+ * @param recordingId - The recordingId associated with the recording.
99
+ * @param options - Additional request options contains pauseRecording api options.
100
+ */
101
+ async pause(recordingId, options = {}) {
102
+ return this.callRecordingImpl.pauseRecording(recordingId, options);
103
+ }
104
+ /**
105
+ * Resumes a call recording.
106
+ * @param recordingId - The recordingId associated with the recording.
107
+ * @param options - Additional request options contains resumeRecording api options.
108
+ */
109
+ async resume(recordingId, options = {}) {
110
+ return this.callRecordingImpl.resumeRecording(recordingId, options);
111
+ }
112
+ /**
113
+ * Deletes a recording.
114
+ * @param recordingLocationUrl - The recording location url. Required.
115
+ * @param options - Additional request options contains deleteRecording api options.
116
+ */
117
+ async delete(recordingLocationUrl, options = {}) {
118
+ await this.contentDownloader.deleteRecording(recordingLocationUrl, options);
119
+ }
120
+ /**
121
+ * Returns a stream with a call recording.
122
+ * @param sourceLocationUrl - The source location url. Required.
123
+ * @param options - Additional request options contains downloadRecording api options.
124
+ */
125
+ async downloadStreaming(sourceLocationUrl, options = {}) {
126
+ const result = this.contentDownloader.download(sourceLocationUrl, options);
127
+ const recordingStream = (await result).readableStreamBody;
128
+ if (recordingStream) {
129
+ return recordingStream;
130
+ }
131
+ else {
132
+ throw Error("failed to get stream");
133
+ }
134
+ }
135
+ /**
136
+ * Downloads a call recording file to the specified stream.
137
+ * @param sourceLocationUrl - The source location url. Required.
138
+ * @param destinationStream - The destination stream. Required.
139
+ * @param options - Additional request options contains downloadRecording api options.
140
+ */
141
+ async downloadToStream(sourceLocationUrl, destinationStream, options = {}) {
142
+ const result = this.contentDownloader.download(sourceLocationUrl, options);
143
+ const recordingStream = (await result).readableStreamBody;
144
+ if (recordingStream) {
145
+ recordingStream.pipe(destinationStream);
146
+ const finish = new Promise((resolve, reject) => {
147
+ destinationStream.on("finish", resolve);
148
+ destinationStream.on("error", reject);
149
+ });
150
+ await finish;
151
+ }
152
+ else {
153
+ throw Error("failed to get stream");
154
+ }
155
+ }
156
+ /**
157
+ * Downloads a call recording file to the specified path.
158
+ * @param sourceLocationUrl - The source location url. Required.
159
+ * @param destinationPath - The destination path. Required.
160
+ * @param options - Additional request options contains downloadRecording api options.
161
+ */
162
+ async downloadToPath(sourceLocationUrl, destinationPath, options = {}) {
163
+ const result = this.contentDownloader.download(sourceLocationUrl, options);
164
+ const recordingStream = (await result).readableStreamBody;
165
+ if (recordingStream) {
166
+ const writeFileStream = fs.createWriteStream(destinationPath);
167
+ recordingStream.pipe(writeFileStream);
168
+ const finish = new Promise((resolve, reject) => {
169
+ writeFileStream.on("finish", resolve);
170
+ writeFileStream.on("error", reject);
171
+ });
172
+ await finish;
173
+ }
174
+ else {
175
+ throw Error("failed to get stream");
176
+ }
177
+ }
178
+ }
179
+ //# sourceMappingURL=callRecording.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callRecording.js","sourceRoot":"","sources":["../../src/callRecording.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAexE,OAAO,EAAE,qCAAqC,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAE5E;;GAEG;AACH,MAAM,OAAO,aAAa;IAKxB,YACE,QAAgB,EAChB,UAA2C,EAC3C,OAA+C;QAE/C,IAAI,CAAC,uBAAuB,GAAG,IAAI,uBAAuB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC9E,MAAM,UAAU,GAAG,6BAA6B,CAAC,UAAU,CAAC,CAAC;QAC7D,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAC5D,IAAI,CAAC,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAC7E,IAAI,CAAC,iBAAiB,GAAG,IAAI,qBAAqB,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;IACnF,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,KAAK,CAAC,OAA8B;QAC/C,MAAM,yBAAyB,GAA8B;YAC3D,WAAW,EAAE,OAAO,CAAC,WAAW;SACjC,CAAC;QAEF,yBAAyB,CAAC,oBAAoB,GAAG,OAAO,CAAC,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AAI,CAAC,iBAAiB,CAAC,CAAC;YACxC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACnD,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;gBACxC,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;YACH,MAAM,MAAM,CAAC;QACf,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,cAAc,CACzB,iBAAyB,EACzB,eAAuB,EACvB,UAAoC,EAAE;QAEtC,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;QAC3E,MAAM,eAAe,GAAG,CAAC,MAAM,MAAM,CAAC,CAAC,kBAAkB,CAAC;QAC1D,IAAI,eAAe,EAAE,CAAC;YACpB,MAAM,eAAe,GAAG,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;YAC9D,eAAe,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;YACtC,MAAM,MAAM,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACnD,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;gBACtC,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;YACH,MAAM,MAAM,CAAC;QACf,CAAC;aAAM,CAAC;YACN,MAAM,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { CallRecordingImpl } from \"./generated/src/operations/index.js\";\nimport {\n CallAutomationApiClientOptionalParams,\n StartCallRecordingRequest,\n} from \"./generated/src/models/index.js\";\nimport { RecordingStateResult } from \"./models/responses.js\";\nimport {\n StartRecordingOptions,\n StopRecordingOptions,\n PauseRecordingOptions,\n GetRecordingPropertiesOptions,\n ResumeRecordingOptions,\n DeleteRecordingOptions,\n DownloadRecordingOptions,\n} from \"./models/options.js\";\nimport { communicationIdentifierModelConverter } from \"./utli/converters.js\";\nimport { ContentDownloaderImpl } from \"./contentDownloader.js\";\nimport * as fs from \"node:fs\";\nimport { randomUUID } from \"@azure/core-util\";\nimport { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { CallAutomationApiClient } from \"./generated/src/index.js\";\nimport { createCommunicationAuthPolicy } from \"@azure/communication-common\";\n\n/**\n * CallRecording class represents call recording related APIs.\n */\nexport class CallRecording {\n private readonly callRecordingImpl: CallRecordingImpl;\n private readonly contentDownloader: ContentDownloaderImpl;\n private readonly callAutomationApiClient: CallAutomationApiClient;\n\n constructor(\n endpoint: string,\n credential: KeyCredential | TokenCredential,\n options?: CallAutomationApiClientOptionalParams,\n ) {\n this.callAutomationApiClient = new CallAutomationApiClient(endpoint, options);\n const authPolicy = createCommunicationAuthPolicy(credential);\n this.callAutomationApiClient.pipeline.addPolicy(authPolicy);\n this.callRecordingImpl = new CallRecordingImpl(this.callAutomationApiClient);\n this.contentDownloader = new ContentDownloaderImpl(this.callAutomationApiClient);\n }\n\n /**\n * Starts a call recording with the specified options.\n * @param startCallRecordingRequest - options to start the call recording\n * @param options - Operation options.\n */\n public async start(options: StartRecordingOptions): Promise<RecordingStateResult> {\n const startCallRecordingRequest: StartCallRecordingRequest = {\n callLocator: options.callLocator,\n };\n\n startCallRecordingRequest.recordingChannelType = options.recordingChannel;\n startCallRecordingRequest.recordingContentType = options.recordingContent;\n startCallRecordingRequest.recordingFormatType = options.recordingFormat;\n startCallRecordingRequest.recordingStateCallbackUri = options.recordingStateCallbackEndpointUrl;\n startCallRecordingRequest.pauseOnStart = options.pauseOnStart;\n startCallRecordingRequest.recordingStorage = options.recordingStorage;\n\n if (options.channelAffinity) {\n startCallRecordingRequest.channelAffinity = [];\n options.channelAffinity.forEach((identifier) => {\n startCallRecordingRequest.channelAffinity?.push({\n participant: communicationIdentifierModelConverter(identifier.targetParticipant),\n channel: identifier.channel,\n });\n });\n }\n\n if (options.audioChannelParticipantOrdering) {\n startCallRecordingRequest.audioChannelParticipantOrdering = [];\n options.audioChannelParticipantOrdering.forEach((identifier) => {\n startCallRecordingRequest.audioChannelParticipantOrdering?.push(\n communicationIdentifierModelConverter(identifier),\n );\n });\n }\n\n if (options.callLocator.kind === \"groupCallLocator\") {\n startCallRecordingRequest.callLocator.kind = \"groupCallLocator\";\n startCallRecordingRequest.callLocator.groupCallId = options.callLocator.id;\n } else if (options.callLocator.kind === \"roomCallLocator\") {\n startCallRecordingRequest.callLocator.kind = \"roomCallLocator\";\n startCallRecordingRequest.callLocator.roomId = options.callLocator.id;\n } else {\n startCallRecordingRequest.callLocator.kind = \"serverCallLocator\";\n startCallRecordingRequest.callLocator.serverCallId = options.callLocator.id;\n }\n\n const optionsInternal = {\n ...options,\n repeatabilityFirstSent: new Date(),\n repeatabilityRequestID: randomUUID(),\n };\n const response = await this.callRecordingImpl.startRecording(\n startCallRecordingRequest,\n optionsInternal,\n );\n\n const result: RecordingStateResult = {\n recordingId: response.recordingId!,\n recordingKind: response.recordingKind!,\n recordingState: response.recordingState!,\n };\n\n return result;\n }\n\n /**\n * Returns call recording properties.\n * @param recordingId - The recordingId associated with the recording.\n * @param options - Additional request options contains getRecordingProperties api options.\n */\n public async getState(\n recordingId: string,\n options: GetRecordingPropertiesOptions = {},\n ): Promise<RecordingStateResult> {\n const response = await this.callRecordingImpl.getRecordingProperties(recordingId, options);\n\n const result: RecordingStateResult = {\n recordingId: response.recordingId!,\n recordingKind: response.recordingKind!,\n recordingState: response.recordingState!,\n };\n\n return result;\n }\n\n /**\n * Stops a call recording.\n * @param recordingId - The recordingId associated with the recording.\n * @param options - Additional request options contains stopRecording api options.\n */\n public async stop(recordingId: string, options: StopRecordingOptions = {}): Promise<void> {\n return this.callRecordingImpl.stopRecording(recordingId, options);\n }\n\n /**\n * Pauses a call recording.\n * @param recordingId - The recordingId associated with the recording.\n * @param options - Additional request options contains pauseRecording api options.\n */\n public async pause(recordingId: string, options: PauseRecordingOptions = {}): Promise<void> {\n return this.callRecordingImpl.pauseRecording(recordingId, options);\n }\n\n /**\n * Resumes a call recording.\n * @param recordingId - The recordingId associated with the recording.\n * @param options - Additional request options contains resumeRecording api options.\n */\n public async resume(recordingId: string, options: ResumeRecordingOptions = {}): Promise<void> {\n return this.callRecordingImpl.resumeRecording(recordingId, options);\n }\n\n /**\n * Deletes a recording.\n * @param recordingLocationUrl - The recording location url. Required.\n * @param options - Additional request options contains deleteRecording api options.\n */\n public async delete(\n recordingLocationUrl: string,\n options: DeleteRecordingOptions = {},\n ): Promise<void> {\n await this.contentDownloader.deleteRecording(recordingLocationUrl, options);\n }\n\n /**\n * Returns a stream with a call recording.\n * @param sourceLocationUrl - The source location url. Required.\n * @param options - Additional request options contains downloadRecording api options.\n */\n public async downloadStreaming(\n sourceLocationUrl: string,\n options: DownloadRecordingOptions = {},\n ): Promise<NodeJS.ReadableStream> {\n const result = this.contentDownloader.download(sourceLocationUrl, options);\n const recordingStream = (await result).readableStreamBody;\n if (recordingStream) {\n return recordingStream;\n } else {\n throw Error(\"failed to get stream\");\n }\n }\n\n /**\n * Downloads a call recording file to the specified stream.\n * @param sourceLocationUrl - The source location url. Required.\n * @param destinationStream - The destination stream. Required.\n * @param options - Additional request options contains downloadRecording api options.\n */\n public async downloadToStream(\n sourceLocationUrl: string,\n destinationStream: NodeJS.WritableStream,\n options: DownloadRecordingOptions = {},\n ): Promise<void> {\n const result = this.contentDownloader.download(sourceLocationUrl, options);\n const recordingStream = (await result).readableStreamBody;\n if (recordingStream) {\n recordingStream.pipe(destinationStream);\n const finish = new Promise<void>((resolve, reject) => {\n destinationStream.on(\"finish\", resolve);\n destinationStream.on(\"error\", reject);\n });\n await finish;\n } else {\n throw Error(\"failed to get stream\");\n }\n }\n\n /**\n * Downloads a call recording file to the specified path.\n * @param sourceLocationUrl - The source location url. Required.\n * @param destinationPath - The destination path. Required.\n * @param options - Additional request options contains downloadRecording api options.\n */\n public async downloadToPath(\n sourceLocationUrl: string,\n destinationPath: string,\n options: DownloadRecordingOptions = {},\n ): Promise<void> {\n const result = this.contentDownloader.download(sourceLocationUrl, options);\n const recordingStream = (await result).readableStreamBody;\n if (recordingStream) {\n const writeFileStream = fs.createWriteStream(destinationPath);\n recordingStream.pipe(writeFileStream);\n const finish = new Promise<void>((resolve, reject) => {\n writeFileStream.on(\"finish\", resolve);\n writeFileStream.on(\"error\", reject);\n });\n await finish;\n } else {\n throw Error(\"failed to get stream\");\n }\n }\n}\n"]}
@@ -0,0 +1,25 @@
1
+ import type { CallAutomationApiClient } from "./generated/src/callAutomationApiClient.js";
2
+ import type { PipelineResponse } from "@azure/core-rest-pipeline";
3
+ import type { DeleteRecordingOptions, DownloadRecordingOptions } from "./models/options.js";
4
+ /** Class containing ContentDownloading operations. */
5
+ export declare class ContentDownloaderImpl {
6
+ private readonly client;
7
+ /**
8
+ * Initialize a new instance of the class ContentDownloader class.
9
+ * @param client - Reference to the service client
10
+ */
11
+ constructor(client: CallAutomationApiClient);
12
+ private addCustomSignUrlPolicy;
13
+ /**
14
+ * Deletes a recording.
15
+ * @param deleteLocationUrl - The recording location url. Required.
16
+ */
17
+ deleteRecording(deleteLocationUrl: string, options: DeleteRecordingOptions): Promise<void>;
18
+ /**
19
+ * Returns a stream with a call recording.
20
+ * @param sourceLocationUrl - The source location url. Required.
21
+ * @param options - Additional request options contains downloadRecording options.
22
+ */
23
+ download(sourceLocationUrl: string, options: DownloadRecordingOptions): Promise<PipelineResponse>;
24
+ }
25
+ //# sourceMappingURL=contentDownloader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contentDownloader.d.ts","sourceRoot":"","sources":["../../src/contentDownloader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAC1F,OAAO,KAAK,EAIV,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE5F,sDAAsD;AACtD,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0B;IAEjD;;;OAGG;gBACS,MAAM,EAAE,uBAAuB;IAK3C,OAAO,CAAC,sBAAsB;IAkB9B;;;OAGG;IACG,eAAe,CAAC,iBAAiB,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IA+BhG;;;;OAIG;IACG,QAAQ,CACZ,iBAAiB,EAAE,MAAM,EACzB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,gBAAgB,CAAC;CA0C7B"}
@@ -0,0 +1,104 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { createHttpHeaders, createPipelineRequest } from "@azure/core-rest-pipeline";
4
+ /** Class containing ContentDownloading operations. */
5
+ export class ContentDownloaderImpl {
6
+ /**
7
+ * Initialize a new instance of the class ContentDownloader class.
8
+ * @param client - Reference to the service client
9
+ */
10
+ constructor(client) {
11
+ this.client = client;
12
+ this.addCustomSignUrlPolicy();
13
+ }
14
+ addCustomSignUrlPolicy() {
15
+ const signUrlPolicy = {
16
+ name: "CustomSignUrlPolicy",
17
+ async sendRequest(request, next) {
18
+ if (request.headers.has("OriginalUrl")) {
19
+ request.url = `${request.headers.get("OriginalUrl")}`;
20
+ const originalRequest = new URL(request.url);
21
+ request.headers.set("Host", originalRequest.host);
22
+ }
23
+ return next(request);
24
+ },
25
+ };
26
+ const pipelineOptions = {};
27
+ pipelineOptions.afterPhase = "Sign";
28
+ this.client.pipeline.addPolicy(signUrlPolicy, pipelineOptions);
29
+ }
30
+ /**
31
+ * Deletes a recording.
32
+ * @param deleteLocationUrl - The recording location url. Required.
33
+ */
34
+ async deleteRecording(deleteLocationUrl, options) {
35
+ var _a, _b, _c;
36
+ const fileLocation = new URL(deleteLocationUrl);
37
+ const endpoint = new URL(this.client.endpoint);
38
+ const modifiedUrlForSigning = endpoint.origin + fileLocation.pathname;
39
+ const opt = {
40
+ url: modifiedUrlForSigning,
41
+ method: "DELETE",
42
+ headers: createHttpHeaders(),
43
+ body: "",
44
+ abortSignal: options === null || options === void 0 ? void 0 : options.abortSignal,
45
+ tracingOptions: options === null || options === void 0 ? void 0 : options.tracingOptions,
46
+ };
47
+ (_a = opt.headers) === null || _a === void 0 ? void 0 : _a.set("OriginalUrl", deleteLocationUrl);
48
+ (_b = opt.headers) === null || _b === void 0 ? void 0 : _b.set("x-ms-host", endpoint.host);
49
+ (_c = opt.headers) === null || _c === void 0 ? void 0 : _c.set("accept", "application/json");
50
+ const req = createPipelineRequest(opt);
51
+ const results = await this.client.sendRequest(req);
52
+ if (results.status !== 200) {
53
+ if (results.bodyAsText) {
54
+ const jsonBody = JSON.parse(results.bodyAsText);
55
+ throw { status: jsonBody.status, message: jsonBody.message };
56
+ }
57
+ throw { status: results.status };
58
+ }
59
+ }
60
+ /**
61
+ * Returns a stream with a call recording.
62
+ * @param sourceLocationUrl - The source location url. Required.
63
+ * @param options - Additional request options contains downloadRecording options.
64
+ */
65
+ async download(sourceLocationUrl, options) {
66
+ var _a, _b, _c, _d;
67
+ const fileLocation = new URL(sourceLocationUrl);
68
+ const endpoint = new URL(this.client.endpoint);
69
+ const modifiedUrlForSigning = endpoint.origin + fileLocation.pathname;
70
+ const opt = {
71
+ url: modifiedUrlForSigning,
72
+ method: "GET",
73
+ headers: createHttpHeaders(),
74
+ body: "",
75
+ streamResponseStatusCodes: new Set([200, 206]),
76
+ abortSignal: options.abortSignal,
77
+ tracingOptions: options === null || options === void 0 ? void 0 : options.tracingOptions,
78
+ };
79
+ if (options.length && !options.offset) {
80
+ throw Error("Download offset value must not be empty if length is set.");
81
+ }
82
+ else if (options.length && options.offset) {
83
+ options.length = options.offset + options.length - 1;
84
+ }
85
+ let rangeHeader = "bytes=" + options.offset;
86
+ if (options.length)
87
+ rangeHeader += "-" + options.length;
88
+ (_a = opt.headers) === null || _a === void 0 ? void 0 : _a.set("OriginalUrl", sourceLocationUrl);
89
+ (_b = opt.headers) === null || _b === void 0 ? void 0 : _b.set("x-ms-host", endpoint.host);
90
+ (_c = opt.headers) === null || _c === void 0 ? void 0 : _c.set("accept", "application/json");
91
+ (_d = opt.headers) === null || _d === void 0 ? void 0 : _d.set("Range", rangeHeader);
92
+ const req = createPipelineRequest(opt);
93
+ const results = await this.client.sendRequest(req);
94
+ if (results.status !== 200 && results.status !== 206) {
95
+ if (results.bodyAsText) {
96
+ const jsonBody = JSON.parse(results.bodyAsText);
97
+ throw { status: jsonBody.status, message: jsonBody.message };
98
+ }
99
+ throw { status: results.status };
100
+ }
101
+ return results;
102
+ }
103
+ }
104
+ //# sourceMappingURL=contentDownloader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contentDownloader.js","sourceRoot":"","sources":["../../src/contentDownloader.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGrF,sDAAsD;AACtD,MAAM,OAAO,qBAAqB;IAGhC;;;OAGG;IACH,YAAY,MAA+B;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,sBAAsB,EAAE,CAAC;IAChC,CAAC;IAEO,sBAAsB;QAC5B,MAAM,aAAa,GAAG;YACpB,IAAI,EAAE,qBAAqB;YAC3B,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;gBAC3D,IAAI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;oBACvC,OAAO,CAAC,GAAG,G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;YACD,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;QACnC,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { CallAutomationApiClient } from \"./generated/src/callAutomationApiClient.js\";\nimport type {\n AddPipelineOptions,\n PipelineRequest,\n PipelineRequestOptions,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { createHttpHeaders, createPipelineRequest } from \"@azure/core-rest-pipeline\";\nimport type { DeleteRecordingOptions, DownloadRecordingOptions } from \"./models/options.js\";\n\n/** Class containing ContentDownloading operations. */\nexport class ContentDownloaderImpl {\n private readonly client: CallAutomationApiClient;\n\n /**\n * Initialize a new instance of the class ContentDownloader class.\n * @param client - Reference to the service client\n */\n constructor(client: CallAutomationApiClient) {\n this.client = client;\n this.addCustomSignUrlPolicy();\n }\n\n private addCustomSignUrlPolicy(): void {\n const signUrlPolicy = {\n name: \"CustomSignUrlPolicy\",\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n if (request.headers.has(\"OriginalUrl\")) {\n request.url = `${request.headers.get(\"OriginalUrl\")}`;\n const originalRequest = new URL(request.url);\n request.headers.set(\"Host\", originalRequest.host);\n }\n return next(request);\n },\n };\n\n const pipelineOptions: AddPipelineOptions = {};\n pipelineOptions.afterPhase = \"Sign\";\n this.client.pipeline.addPolicy(signUrlPolicy, pipelineOptions);\n }\n\n /**\n * Deletes a recording.\n * @param deleteLocationUrl - The recording location url. Required.\n */\n async deleteRecording(deleteLocationUrl: string, options: DeleteRecordingOptions): Promise<void> {\n const fileLocation = new URL(deleteLocationUrl);\n const endpoint = new URL(this.client.endpoint);\n const modifiedUrlForSigning = endpoint.origin + fileLocation.pathname;\n\n const opt: PipelineRequestOptions = {\n url: modifiedUrlForSigning,\n method: \"DELETE\",\n headers: createHttpHeaders(),\n body: \"\",\n abortSignal: options?.abortSignal,\n tracingOptions: options?.tracingOptions,\n };\n\n opt.headers?.set(\"OriginalUrl\", deleteLocationUrl);\n opt.headers?.set(\"x-ms-host\", endpoint.host);\n opt.headers?.set(\"accept\", \"application/json\");\n\n const req = createPipelineRequest(opt);\n\n const results = await this.client.sendRequest(req);\n\n if (results.status !== 200) {\n if (results.bodyAsText) {\n const jsonBody = JSON.parse(results.bodyAsText);\n throw { status: jsonBody.status, message: jsonBody.message };\n }\n throw { status: results.status };\n }\n }\n\n /**\n * Returns a stream with a call recording.\n * @param sourceLocationUrl - The source location url. Required.\n * @param options - Additional request options contains downloadRecording options.\n */\n async download(\n sourceLocationUrl: string,\n options: DownloadRecordingOptions,\n ): Promise<PipelineResponse> {\n const fileLocation = new URL(sourceLocationUrl);\n const endpoint = new URL(this.client.endpoint);\n const modifiedUrlForSigning = endpoint.origin + fileLocation.pathname;\n\n const opt: PipelineRequestOptions = {\n url: modifiedUrlForSigning,\n method: \"GET\",\n headers: createHttpHeaders(),\n body: \"\",\n streamResponseStatusCodes: new Set([200, 206]),\n abortSignal: options.abortSignal,\n tracingOptions: options?.tracingOptions,\n };\n\n if (options.length && !options.offset) {\n throw Error(\"Download offset value must not be empty if length is set.\");\n } else if (options.length && options.offset) {\n options.length = options.offset + options.length - 1;\n }\n\n let rangeHeader = \"bytes=\" + options.offset;\n if (options.length) rangeHeader += \"-\" + options.length;\n\n opt.headers?.set(\"OriginalUrl\", sourceLocationUrl);\n opt.headers?.set(\"x-ms-host\", endpoint.host);\n opt.headers?.set(\"accept\", \"application/json\");\n opt.headers?.set(\"Range\", rangeHeader);\n\n const req = createPipelineRequest(opt);\n\n const results = await this.client.sendRequest(req);\n\n if (results.status !== 200 && results.status !== 206) {\n if (results.bodyAsText) {\n const jsonBody = JSON.parse(results.bodyAsText);\n throw { status: jsonBody.status, message: jsonBody.message };\n }\n throw { status: results.status };\n }\n return results;\n }\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import type { PipelinePolicy } from "@azure/core-rest-pipeline";
2
+ import type { KeyCredential } from "@azure/core-auth";
3
+ /**
4
+ * Creates an HTTP pipeline policy to authenticate a request using a `KeyCredential`.
5
+ * @hidden
6
+ *
7
+ * @param credential - The key credential.
8
+ */
9
+ export declare function createCallAutomationAccessKeyCredentialPolicy(credential: KeyCredential, acsUrl: string): PipelinePolicy;
10
+ //# sourceMappingURL=callAutomationAccessKeyCredentialPolicy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callAutomationAccessKeyCredentialPolicy.d.ts","sourceRoot":"","sources":["../../../src/credential/callAutomationAccessKeyCredentialPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAMtD;;;;;GAKG;AACH,wBAAgB,6CAA6C,CAC3D,UAAU,EAAE,aAAa,EACzB,MAAM,EAAE,MAAM,GACb,cAAc,CAiChB"}
@@ -0,0 +1,39 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { shaHMAC, shaHash } from "./cryptoUtils.js";
4
+ import { isNode } from "@azure/core-util";
5
+ const callAutomationAccessKeyCredentialPolicy = "CallAutomationAccessKeyCredentialPolicy";
6
+ /**
7
+ * Creates an HTTP pipeline policy to authenticate a request using a `KeyCredential`.
8
+ * @hidden
9
+ *
10
+ * @param credential - The key credential.
11
+ */
12
+ export function createCallAutomationAccessKeyCredentialPolicy(credential, acsUrl) {
13
+ return {
14
+ name: callAutomationAccessKeyCredentialPolicy,
15
+ async sendRequest(request, next) {
16
+ var _a;
17
+ const verb = request.method.toUpperCase();
18
+ const utcNow = new Date().toUTCString();
19
+ const contentHash = await shaHash(((_a = request.body) === null || _a === void 0 ? void 0 : _a.toString()) || "");
20
+ const dateHeader = "x-ms-date";
21
+ const signedHeaders = `${dateHeader};host;x-ms-content-sha256`;
22
+ const acsUrlCast = new URL(acsUrl);
23
+ request.headers.set("x-ms-host", acsUrlCast.host);
24
+ const url = new URL(request.url);
25
+ const query = url.searchParams.toString();
26
+ const urlPathAndQuery = query ? `${url.pathname}?${query}` : url.pathname;
27
+ const stringToSign = `${verb}\n${urlPathAndQuery}\n${utcNow};${acsUrlCast.host};${contentHash}`;
28
+ const signature = await shaHMAC(credential.key, stringToSign);
29
+ if (isNode) {
30
+ request.headers.set("Host", url.host || "");
31
+ }
32
+ request.headers.set(dateHeader, utcNow);
33
+ request.headers.set("x-ms-content-sha256", contentHash);
34
+ request.headers.set("Authorization", `HMAC-SHA256 SignedHeaders=${signedHeaders}&Signature=${signature}`);
35
+ return next(request);
36
+ },
37
+ };
38
+ }
39
+ //# sourceMappingURL=callAutomationAccessKeyCredentialPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callAutomationAccessKeyCredentialPolicy.js","sourceRoot":"","sources":["../../../src/credential/callAutomationAccessKeyCredentialPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,uCAAuC,GAAG,yCAAyC,CAAC;AAE1F;;;;;GAKG;AACH,MAAM,UAAU,6CAA6C,CAC3D,UAAyB,EACzB,MAAc;IAEd,OAAO;QACL,IAAI,EAAE,uCAAuC;QAC7C,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;;YAC3D,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YAC1C,MAAM,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;YACxC,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,CAAA,MAAA,OAAO,CAAC,IAAI,0CAAE,QAAQ,EAAE,KAAI,EAAE,CAAC,CAAC;YAClE,MAAM,UAAU,GAAG,WAAW,CAAC;YAC/B,MAAM,aAAa,GAAG,GAAG,UAAU,2BAA2B,CAAC;YAE/D,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;YACnC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;YAElD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACjC,MAAM,KAAK,GAAG,GAAG,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;YAC1C,MAAM,eAAe,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,QAAQ,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC;YAE1E,MAAM,YAAY,GAAG,GAAG,IAAI,KAAK,eAAe,KAAK,MAAM,IAAI,UAAU,CAAC,IAAI,IAAI,WAAW,EAAE,CAAC;YAChG,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;YAE9D,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;YAC9C,CAAC;YAED,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;YACxC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;YACxD,OAAO,CAAC,OAAO,CAAC,GAAG,CACjB,eAAe,EACf,6BAA6B,aAAa,cAAc,SAAS,EAAE,CACpE,CAAC;YACF,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n PipelinePolicy,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport type { KeyCredential } from \"@azure/core-auth\";\nimport { shaHMAC, shaHash } from \"./cryptoUtils.js\";\nimport { isNode } from \"@azure/core-util\";\n\nconst callAutomationAccessKeyCredentialPolicy = \"CallAutomationAccessKeyCredentialPolicy\";\n\n/**\n * Creates an HTTP pipeline policy to authenticate a request using a `KeyCredential`.\n * @hidden\n *\n * @param credential - The key credential.\n */\nexport function createCallAutomationAccessKeyCredentialPolicy(\n credential: KeyCredential,\n acsUrl: string,\n): PipelinePolicy {\n return {\n name: callAutomationAccessKeyCredentialPolicy,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n const verb = request.method.toUpperCase();\n const utcNow = new Date().toUTCString();\n const contentHash = await shaHash(request.body?.toString() || \"\");\n const dateHeader = \"x-ms-date\";\n const signedHeaders = `${dateHeader};host;x-ms-content-sha256`;\n\n const acsUrlCast = new URL(acsUrl);\n request.headers.set(\"x-ms-host\", acsUrlCast.host);\n\n const url = new URL(request.url);\n const query = url.searchParams.toString();\n const urlPathAndQuery = query ? `${url.pathname}?${query}` : url.pathname;\n\n const stringToSign = `${verb}\\n${urlPathAndQuery}\\n${utcNow};${acsUrlCast.host};${contentHash}`;\n const signature = await shaHMAC(credential.key, stringToSign);\n\n if (isNode) {\n request.headers.set(\"Host\", url.host || \"\");\n }\n\n request.headers.set(dateHeader, utcNow);\n request.headers.set(\"x-ms-content-sha256\", contentHash);\n request.headers.set(\n \"Authorization\",\n `HMAC-SHA256 SignedHeaders=${signedHeaders}&Signature=${signature}`,\n );\n return next(request);\n },\n };\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import type { PipelinePolicy } from "@azure/core-rest-pipeline";
2
+ import type { KeyCredential, TokenCredential } from "@azure/core-auth";
3
+ import type { CallAutomationApiClientOptionalParams } from "./../generated/src/index.js";
4
+ import { CallAutomationApiClient } from "./../generated/src/index.js";
5
+ /**
6
+ * Creates a pipeline policy to authenticate request based
7
+ * on the credential passed in.
8
+ * @hidden
9
+ *
10
+ * @param credential - The KeyCredential or TokenCredential.
11
+ */
12
+ export declare function createCallAutomationAuthPolicy(credential: KeyCredential | TokenCredential, acsUrl: string): PipelinePolicy;
13
+ /**
14
+ * Creates CallAutomationApiClient for custom endpoint
15
+ * @hidden
16
+ *
17
+ * @param credential - The KeyCredential or TokenCredential.
18
+ * @param internalPipelineOptions - CallAutomationApiClientOptionalParams if provided.
19
+ * @param url - ACS url.
20
+ */
21
+ export declare function createCustomCallAutomationApiClient(credential: KeyCredential | TokenCredential, internalPipelineOptions: CallAutomationApiClientOptionalParams | undefined, url: string): CallAutomationApiClient;
22
+ //# sourceMappingURL=callAutomationAuthPolicy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callAutomationAuthPolicy.d.ts","sourceRoot":"","sources":["../../../src/credential/callAutomationAuthPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,cAAc,EACf,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGvE,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,6BAA6B,CAAC;AACzF,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,aAAa,GAAG,eAAe,EAC3C,MAAM,EAAE,MAAM,GACb,cAAc,CAUhB;AAED;;;;;;;GAOG;AACH,wBAAgB,mCAAmC,CACjD,UAAU,EAAE,aAAa,GAAG,eAAe,EAC3C,uBAAuB,EAAE,qCAAqC,GAAG,SAAS,EAC1E,GAAG,EAAE,MAAM,GACV,uBAAuB,CAiBzB"}
@@ -0,0 +1,53 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { bearerTokenAuthenticationPolicy } from "@azure/core-rest-pipeline";
4
+ import { isTokenCredential } from "@azure/core-auth";
5
+ import { createCallAutomationAccessKeyCredentialPolicy } from "./callAutomationAccessKeyCredentialPolicy.js";
6
+ import { CallAutomationApiClient } from "./../generated/src/index.js";
7
+ import { createCommunicationAuthPolicy } from "@azure/communication-common";
8
+ /**
9
+ * Creates a pipeline policy to authenticate request based
10
+ * on the credential passed in.
11
+ * @hidden
12
+ *
13
+ * @param credential - The KeyCredential or TokenCredential.
14
+ */
15
+ export function createCallAutomationAuthPolicy(credential, acsUrl) {
16
+ if (isTokenCredential(credential)) {
17
+ const policyOptions = {
18
+ credential: credential,
19
+ scopes: ["https://communication.azure.com//.default"],
20
+ };
21
+ return bearerTokenAuthenticationPolicy(policyOptions);
22
+ }
23
+ else {
24
+ return createCallAutomationAccessKeyCredentialPolicy(credential, acsUrl);
25
+ }
26
+ }
27
+ /**
28
+ * Creates CallAutomationApiClient for custom endpoint
29
+ * @hidden
30
+ *
31
+ * @param credential - The KeyCredential or TokenCredential.
32
+ * @param internalPipelineOptions - CallAutomationApiClientOptionalParams if provided.
33
+ * @param url - ACS url.
34
+ */
35
+ export function createCustomCallAutomationApiClient(credential, internalPipelineOptions, url) {
36
+ // read environment variable for callAutomation auth
37
+ const customEnabled = process.env.COMMUNICATION_CUSTOM_ENDPOINT_ENABLED;
38
+ const customUrl = process.env.COMMUNICATION_CUSTOM_URL;
39
+ let callAutomationApiClient;
40
+ if ((customEnabled === null || customEnabled === void 0 ? void 0 : customEnabled.toLowerCase()) === "true" && customUrl) {
41
+ // add custom header for Call Automation auth when flag is true
42
+ callAutomationApiClient = new CallAutomationApiClient(customUrl, internalPipelineOptions);
43
+ const callAutomationAuthPolicy = createCallAutomationAuthPolicy(credential, url);
44
+ callAutomationApiClient.pipeline.addPolicy(callAutomationAuthPolicy);
45
+ }
46
+ else {
47
+ callAutomationApiClient = new CallAutomationApiClient(url, internalPipelineOptions);
48
+ const authPolicy = createCommunicationAuthPolicy(credential);
49
+ callAutomationApiClient.pipeline.addPolicy(authPolicy);
50
+ }
51
+ return callAutomationApiClient;
52
+ }
53
+ //# sourceMappingURL=callAutomationAuthPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callAutomationAuthPolicy.js","sourceRoot":"","sources":["../../../src/credential/callAutomationAuthPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,+BAA+B,EAAE,MAAM,2BAA2B,CAAC;AAE5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,6CAA6C,EAAE,MAAM,8CAA8C,CAAC;AAE7G,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B,CAC5C,UAA2C,EAC3C,MAAc;IAEd,IAAI,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;QAClC,MAAM,aAAa,GAA2C;YAC5D,UAAU,EAAE,UAAU;YACtB,MAAM,EAAE,CAAC,2CAA2C,CAAC;SACtD,CAAC;QACF,OAAO,+BAA+B,CAAC,aAAa,CAAC,CAAC;IACxD,CAAC;SAAM,CAAC;QACN,OAAO,6CAA6C,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mCAAmC,CACjD,UAA2C,EAC3C,uBAA0E,EAC1E,GAAW;IAEX,oDAAoD;IACpD,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC;IACxE,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC;IACvD,IAAI,uBAAgD,CAAC;IAErD,IAAI,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,WAAW,EAAE,MAAK,MAAM,IAAI,SAAS,EAAE,CAAC;QACzD,+DAA+D;QAC/D,uBAAuB,GAAG,IAAI,uBAAuB,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;QAC1F,MAAM,wBAAwB,GAAG,8BAA8B,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QACjF,uBAAuB,CAAC,QAAQ,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;IACvE,CAAC;SAAM,CAAC;QACN,uBAAuB,GAAG,IAAI,uBAAuB,CAAC,GAAG,EAAE,uBAAuB,CAAC,CAAC;QACpF,MAAM,UAAU,GAAG,6BAA6B,CAAC,UAAU,CAAC,CAAC;QAC7D,uBAAuB,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,uBAAuB,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n BearerTokenAuthenticationPolicyOptions,\n PipelinePolicy,\n} from \"@azure/core-rest-pipeline\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport { createCallAutomationAccessKeyCredentialPolicy } from \"./callAutomationAccessKeyCredentialPolicy.js\";\nimport type { CallAutomationApiClientOptionalParams } from \"./../generated/src/index.js\";\nimport { CallAutomationApiClient } from \"./../generated/src/index.js\";\nimport { createCommunicationAuthPolicy } from \"@azure/communication-common\";\n/**\n * Creates a pipeline policy to authenticate request based\n * on the credential passed in.\n * @hidden\n *\n * @param credential - The KeyCredential or TokenCredential.\n */\nexport function createCallAutomationAuthPolicy(\n credential: KeyCredential | TokenCredential,\n acsUrl: string,\n): PipelinePolicy {\n if (isTokenCredential(credential)) {\n const policyOptions: BearerTokenAuthenticationPolicyOptions = {\n credential: credential,\n scopes: [\"https://communication.azure.com//.default\"],\n };\n return bearerTokenAuthenticationPolicy(policyOptions);\n } else {\n return createCallAutomationAccessKeyCredentialPolicy(credential, acsUrl);\n }\n}\n\n/**\n * Creates CallAutomationApiClient for custom endpoint\n * @hidden\n *\n * @param credential - The KeyCredential or TokenCredential.\n * @param internalPipelineOptions - CallAutomationApiClientOptionalParams if provided.\n * @param url - ACS url.\n */\nexport function createCustomCallAutomationApiClient(\n credential: KeyCredential | TokenCredential,\n internalPipelineOptions: CallAutomationApiClientOptionalParams | undefined,\n url: string,\n): CallAutomationApiClient {\n // read environment variable for callAutomation auth\n const customEnabled = process.env.COMMUNICATION_CUSTOM_ENDPOINT_ENABLED;\n const customUrl = process.env.COMMUNICATION_CUSTOM_URL;\n let callAutomationApiClient: CallAutomationApiClient;\n\n if (customEnabled?.toLowerCase() === \"true\" && customUrl) {\n // add custom header for Call Automation auth when flag is true\n callAutomationApiClient = new CallAutomationApiClient(customUrl, internalPipelineOptions);\n const callAutomationAuthPolicy = createCallAutomationAuthPolicy(credential, url);\n callAutomationApiClient.pipeline.addPolicy(callAutomationAuthPolicy);\n } else {\n callAutomationApiClient = new CallAutomationApiClient(url, internalPipelineOptions);\n const authPolicy = createCommunicationAuthPolicy(credential);\n callAutomationApiClient.pipeline.addPolicy(authPolicy);\n }\n return callAutomationApiClient;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const shaHash: (content: string) => Promise<string>;
2
+ export declare const shaHMAC: (secret: string, content: string) => Promise<string>;
3
+ //# sourceMappingURL=cryptoUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cryptoUtils.d.ts","sourceRoot":"","sources":["../../../src/credential/cryptoUtils.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,YAAmB,MAAM,KAAG,OAAO,CAAC,MAAM,CACP,CAAC;AAExD,eAAO,MAAM,OAAO,WAAkB,MAAM,WAAW,MAAM,KAAG,OAAO,CAAC,MAAM,CAI7E,CAAC"}
@@ -0,0 +1,9 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { createHash, createHmac } from "node:crypto";
4
+ export const shaHash = async (content) => createHash("sha256").update(content).digest("base64");
5
+ export const shaHMAC = async (secret, content) => {
6
+ const decodedSecret = Buffer.from(secret, "base64");
7
+ return createHmac("sha256", decodedSecret).update(content).digest("base64");
8
+ };
9
+ //# sourceMappingURL=cryptoUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cryptoUtils.js","sourceRoot":"","sources":["../../../src/credential/cryptoUtils.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,OAAe,EAAmB,EAAE,CAChE,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,MAAc,EAAE,OAAe,EAAmB,EAAE;IAChF,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEpD,OAAO,UAAU,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAC9E,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { createHash, createHmac } from \"node:crypto\";\n\nexport const shaHash = async (content: string): Promise<string> =>\n createHash(\"sha256\").update(content).digest(\"base64\");\n\nexport const shaHMAC = async (secret: string, content: string): Promise<string> => {\n const decodedSecret = Buffer.from(secret, \"base64\");\n\n return createHmac(\"sha256\", decodedSecret).update(content).digest(\"base64\");\n};\n"]}
@@ -0,0 +1,4 @@
1
+ export declare const encodeUTF8: (str: string) => Uint8Array;
2
+ export declare function encodeUTF8fromBase64(str: string): Uint8Array;
3
+ export declare function encodeBase64(value: ArrayBuffer): string;
4
+ //# sourceMappingURL=encodeUtils.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encodeUtils.browser.d.ts","sourceRoot":"","sources":["../../../src/credential/encodeUtils.browser.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,QAAS,MAAM,KAAG,UAA2C,CAAC;AAErF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAU5D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAUvD"}
@@ -0,0 +1,26 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ export const encodeUTF8 = (str) => new TextEncoder().encode(str);
4
+ export function encodeUTF8fromBase64(str) {
5
+ if (typeof atob !== "function") {
6
+ throw new Error("Your browser environment is missing the global `atob` function");
7
+ }
8
+ const binary = atob(str);
9
+ const bytes = new Uint8Array(binary.length);
10
+ for (let i = 0; i < binary.length; i++) {
11
+ bytes[i] = binary.charCodeAt(i);
12
+ }
13
+ return bytes;
14
+ }
15
+ export function encodeBase64(value) {
16
+ if (typeof btoa !== "function") {
17
+ throw new Error("Your browser environment is missing the global `btoa` function");
18
+ }
19
+ const bytes = new Uint8Array(value);
20
+ let binary = "";
21
+ for (const byte of bytes) {
22
+ binary += String.fromCharCode(byte);
23
+ }
24
+ return btoa(binary);
25
+ }
26
+ //# sourceMappingURL=encodeUtils.browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encodeUtils.browser.js","sourceRoot":"","sources":["../../../src/credential/encodeUtils.browser.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAc,EAAE,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAErF,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;IACpF,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAkB;IAC7C,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;IACpF,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport const encodeUTF8 = (str: string): Uint8Array => new TextEncoder().encode(str);\n\nexport function encodeUTF8fromBase64(str: string): Uint8Array {\n if (typeof atob !== \"function\") {\n throw new Error(\"Your browser environment is missing the global `atob` function\");\n }\n const binary = atob(str);\n const bytes = new Uint8Array(binary.length);\n for (let i = 0; i < binary.length; i++) {\n bytes[i] = binary.charCodeAt(i);\n }\n return bytes;\n}\n\nexport function encodeBase64(value: ArrayBuffer): string {\n if (typeof btoa !== \"function\") {\n throw new Error(\"Your browser environment is missing the global `btoa` function\");\n }\n const bytes = new Uint8Array(value);\n let binary = \"\";\n for (const byte of bytes) {\n binary += String.fromCharCode(byte);\n }\n return btoa(binary);\n}\n"]}