@typespec/ts-http-runtime 0.1.0 → 0.2.0

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 (692) hide show
  1. package/LICENSE +3 -3
  2. package/README.md +9 -10
  3. package/dist/browser/abort-controller/AbortError.d.ts +4 -1
  4. package/dist/browser/abort-controller/AbortError.js +4 -1
  5. package/dist/browser/abort-controller/AbortError.js.map +1 -1
  6. package/dist/browser/auth/credentials.d.ts +77 -0
  7. package/dist/browser/auth/credentials.js +27 -0
  8. package/dist/browser/auth/credentials.js.map +1 -0
  9. package/dist/browser/auth/oauth2Flows.d.ts +57 -0
  10. package/dist/{esm/abort-controller/AbortSignalLike.js → browser/auth/oauth2Flows.js} +1 -1
  11. package/dist/browser/auth/oauth2Flows.js.map +1 -0
  12. package/dist/browser/auth/schemes.d.ts +53 -0
  13. package/dist/{react-native/abort-controller/AbortSignalLike.js → browser/auth/schemes.js} +1 -1
  14. package/dist/browser/auth/schemes.js.map +1 -0
  15. package/dist/browser/client/clientHelpers.d.ts +1 -20
  16. package/dist/browser/client/clientHelpers.js +21 -30
  17. package/dist/browser/client/clientHelpers.js.map +1 -1
  18. package/dist/browser/client/common.d.ts +21 -16
  19. package/dist/browser/client/common.js.map +1 -1
  20. package/dist/browser/client/getClient.d.ts +1 -9
  21. package/dist/browser/client/getClient.js +21 -18
  22. package/dist/browser/client/getClient.js.map +1 -1
  23. package/dist/browser/client/multipart.js +1 -1
  24. package/dist/browser/client/multipart.js.map +1 -1
  25. package/dist/browser/client/restError.js +4 -4
  26. package/dist/browser/client/restError.js.map +1 -1
  27. package/dist/browser/client/sendRequest.js +2 -2
  28. package/dist/browser/client/sendRequest.js.map +1 -1
  29. package/dist/browser/constants.js +1 -1
  30. package/dist/browser/constants.js.map +1 -1
  31. package/dist/browser/createPipelineFromOptions.d.ts +3 -1
  32. package/dist/browser/createPipelineFromOptions.js +4 -0
  33. package/dist/browser/createPipelineFromOptions.js.map +1 -1
  34. package/dist/browser/fetchHttpClient.js +1 -1
  35. package/dist/browser/fetchHttpClient.js.map +1 -1
  36. package/dist/browser/index.d.ts +3 -3
  37. package/dist/browser/index.js +2 -2
  38. package/dist/browser/index.js.map +1 -1
  39. package/dist/browser/interfaces.d.ts +11 -2
  40. package/dist/browser/interfaces.js.map +1 -1
  41. package/dist/browser/nodeHttpClient.js +10 -3
  42. package/dist/browser/nodeHttpClient.js.map +1 -1
  43. package/dist/browser/pipelineRequest.d.ts +1 -2
  44. package/dist/browser/pipelineRequest.js.map +1 -1
  45. package/dist/browser/policies/agentPolicy.d.ts +11 -0
  46. package/dist/browser/policies/agentPolicy.js +22 -0
  47. package/dist/browser/policies/agentPolicy.js.map +1 -0
  48. package/dist/browser/policies/auth/apiKeyAuthenticationPolicy.d.ts +30 -0
  49. package/dist/browser/policies/auth/apiKeyAuthenticationPolicy.js +31 -0
  50. package/dist/browser/policies/auth/apiKeyAuthenticationPolicy.js.map +1 -0
  51. package/dist/browser/policies/auth/basicAuthenticationPolicy.d.ts +30 -0
  52. package/dist/browser/policies/auth/basicAuthenticationPolicy.js +31 -0
  53. package/dist/browser/policies/auth/basicAuthenticationPolicy.js.map +1 -0
  54. package/dist/browser/policies/auth/bearerAuthenticationPolicy.d.ts +30 -0
  55. package/dist/browser/policies/auth/bearerAuthenticationPolicy.js +31 -0
  56. package/dist/browser/policies/auth/bearerAuthenticationPolicy.js.map +1 -0
  57. package/dist/browser/policies/auth/checkInsecureConnection.d.ts +9 -0
  58. package/dist/browser/policies/auth/checkInsecureConnection.js +50 -0
  59. package/dist/browser/policies/auth/checkInsecureConnection.js.map +1 -0
  60. package/dist/browser/policies/auth/oauth2AuthenticationPolicy.d.ts +31 -0
  61. package/dist/browser/policies/auth/oauth2AuthenticationPolicy.js +31 -0
  62. package/dist/browser/policies/auth/oauth2AuthenticationPolicy.js.map +1 -0
  63. package/dist/browser/policies/retryPolicy.js +0 -1
  64. package/dist/browser/policies/retryPolicy.js.map +1 -1
  65. package/dist/browser/policies/throttlingRetryPolicy.d.ts +3 -3
  66. package/dist/browser/policies/throttlingRetryPolicy.js +3 -3
  67. package/dist/browser/policies/throttlingRetryPolicy.js.map +1 -1
  68. package/dist/browser/restError.js +9 -8
  69. package/dist/browser/restError.js.map +1 -1
  70. package/dist/browser/util/aborterUtils.d.ts +3 -4
  71. package/dist/browser/util/aborterUtils.js.map +1 -1
  72. package/dist/browser/util/file.js +3 -0
  73. package/dist/browser/util/file.js.map +1 -1
  74. package/dist/browser/util/helpers.d.ts +1 -2
  75. package/dist/browser/util/helpers.js.map +1 -1
  76. package/dist/browser/util/inspect.common.d.ts +1 -1
  77. package/dist/browser/util/inspect.common.js +1 -1
  78. package/dist/browser/util/inspect.common.js.map +1 -1
  79. package/dist/browser/xhrHttpClient.js +1 -1
  80. package/dist/browser/xhrHttpClient.js.map +1 -1
  81. package/dist/commonjs/abort-controller/AbortError.d.ts +4 -1
  82. package/dist/commonjs/abort-controller/AbortError.js +4 -1
  83. package/dist/commonjs/abort-controller/AbortError.js.map +1 -1
  84. package/dist/commonjs/auth/credentials.d.ts +77 -0
  85. package/dist/commonjs/auth/credentials.js +33 -0
  86. package/dist/commonjs/auth/credentials.js.map +1 -0
  87. package/dist/commonjs/auth/oauth2Flows.d.ts +57 -0
  88. package/dist/commonjs/{abort-controller/AbortSignalLike.js → auth/oauth2Flows.js} +1 -1
  89. package/dist/commonjs/auth/oauth2Flows.js.map +1 -0
  90. package/dist/commonjs/auth/schemes.d.ts +53 -0
  91. package/dist/commonjs/auth/schemes.js +5 -0
  92. package/dist/commonjs/auth/schemes.js.map +1 -0
  93. package/dist/commonjs/client/clientHelpers.d.ts +1 -20
  94. package/dist/commonjs/client/clientHelpers.js +21 -31
  95. package/dist/commonjs/client/clientHelpers.js.map +1 -1
  96. package/dist/commonjs/client/common.d.ts +21 -16
  97. package/dist/commonjs/client/common.js.map +1 -1
  98. package/dist/commonjs/client/getClient.d.ts +1 -9
  99. package/dist/commonjs/client/getClient.js +21 -18
  100. package/dist/commonjs/client/getClient.js.map +1 -1
  101. package/dist/commonjs/client/multipart.js +1 -1
  102. package/dist/commonjs/client/multipart.js.map +1 -1
  103. package/dist/commonjs/client/restError.js +4 -4
  104. package/dist/commonjs/client/restError.js.map +1 -1
  105. package/dist/commonjs/client/sendRequest.js +2 -2
  106. package/dist/commonjs/client/sendRequest.js.map +1 -1
  107. package/dist/commonjs/constants.js +1 -1
  108. package/dist/commonjs/constants.js.map +1 -1
  109. package/dist/commonjs/createPipelineFromOptions.d.ts +3 -1
  110. package/dist/commonjs/createPipelineFromOptions.js +4 -0
  111. package/dist/commonjs/createPipelineFromOptions.js.map +1 -1
  112. package/dist/commonjs/fetchHttpClient.js +1 -1
  113. package/dist/commonjs/fetchHttpClient.js.map +1 -1
  114. package/dist/commonjs/index.d.ts +3 -3
  115. package/dist/commonjs/index.js +4 -5
  116. package/dist/commonjs/index.js.map +1 -1
  117. package/dist/commonjs/interfaces.d.ts +11 -2
  118. package/dist/commonjs/interfaces.js.map +1 -1
  119. package/dist/commonjs/nodeHttpClient.js +10 -3
  120. package/dist/commonjs/nodeHttpClient.js.map +1 -1
  121. package/dist/commonjs/pipelineRequest.d.ts +1 -2
  122. package/dist/commonjs/pipelineRequest.js.map +1 -1
  123. package/dist/commonjs/policies/agentPolicy.d.ts +11 -0
  124. package/dist/commonjs/policies/agentPolicy.js +26 -0
  125. package/dist/commonjs/policies/agentPolicy.js.map +1 -0
  126. package/dist/commonjs/policies/auth/apiKeyAuthenticationPolicy.d.ts +30 -0
  127. package/dist/commonjs/policies/auth/apiKeyAuthenticationPolicy.js +35 -0
  128. package/dist/commonjs/policies/auth/apiKeyAuthenticationPolicy.js.map +1 -0
  129. package/dist/commonjs/policies/auth/basicAuthenticationPolicy.d.ts +30 -0
  130. package/dist/commonjs/policies/auth/basicAuthenticationPolicy.js +35 -0
  131. package/dist/commonjs/policies/auth/basicAuthenticationPolicy.js.map +1 -0
  132. package/dist/commonjs/policies/auth/bearerAuthenticationPolicy.d.ts +30 -0
  133. package/dist/commonjs/policies/auth/bearerAuthenticationPolicy.js +35 -0
  134. package/dist/commonjs/policies/auth/bearerAuthenticationPolicy.js.map +1 -0
  135. package/dist/commonjs/policies/auth/checkInsecureConnection.d.ts +9 -0
  136. package/dist/commonjs/policies/auth/checkInsecureConnection.js +53 -0
  137. package/dist/commonjs/policies/auth/checkInsecureConnection.js.map +1 -0
  138. package/dist/commonjs/policies/auth/oauth2AuthenticationPolicy.d.ts +31 -0
  139. package/dist/commonjs/policies/auth/oauth2AuthenticationPolicy.js +35 -0
  140. package/dist/commonjs/policies/auth/oauth2AuthenticationPolicy.js.map +1 -0
  141. package/dist/commonjs/policies/retryPolicy.js +0 -1
  142. package/dist/commonjs/policies/retryPolicy.js.map +1 -1
  143. package/dist/commonjs/policies/throttlingRetryPolicy.d.ts +3 -3
  144. package/dist/commonjs/policies/throttlingRetryPolicy.js +3 -3
  145. package/dist/commonjs/policies/throttlingRetryPolicy.js.map +1 -1
  146. package/dist/commonjs/restError.js +9 -8
  147. package/dist/commonjs/restError.js.map +1 -1
  148. package/dist/commonjs/tsdoc-metadata.json +1 -1
  149. package/dist/commonjs/util/aborterUtils.d.ts +3 -4
  150. package/dist/commonjs/util/aborterUtils.js.map +1 -1
  151. package/dist/commonjs/util/file.js +3 -0
  152. package/dist/commonjs/util/file.js.map +1 -1
  153. package/dist/commonjs/util/helpers.d.ts +1 -2
  154. package/dist/commonjs/util/helpers.js.map +1 -1
  155. package/dist/commonjs/util/inspect.common.d.ts +1 -1
  156. package/dist/commonjs/util/inspect.common.js +1 -1
  157. package/dist/commonjs/util/inspect.common.js.map +1 -1
  158. package/dist/commonjs/xhrHttpClient.js +1 -1
  159. package/dist/commonjs/xhrHttpClient.js.map +1 -1
  160. package/dist/esm/abort-controller/AbortError.d.ts +4 -1
  161. package/dist/esm/abort-controller/AbortError.js +4 -1
  162. package/dist/esm/abort-controller/AbortError.js.map +1 -1
  163. package/dist/esm/auth/credentials.d.ts +77 -0
  164. package/dist/esm/auth/credentials.js +27 -0
  165. package/dist/esm/auth/credentials.js.map +1 -0
  166. package/dist/esm/auth/oauth2Flows.d.ts +57 -0
  167. package/dist/{browser/abort-controller/AbortSignalLike.js → esm/auth/oauth2Flows.js} +1 -1
  168. package/dist/esm/auth/oauth2Flows.js.map +1 -0
  169. package/dist/esm/auth/schemes.d.ts +53 -0
  170. package/dist/esm/auth/schemes.js +4 -0
  171. package/dist/esm/auth/schemes.js.map +1 -0
  172. package/dist/esm/client/clientHelpers.d.ts +1 -20
  173. package/dist/esm/client/clientHelpers.js +21 -30
  174. package/dist/esm/client/clientHelpers.js.map +1 -1
  175. package/dist/esm/client/common.d.ts +21 -16
  176. package/dist/esm/client/common.js.map +1 -1
  177. package/dist/esm/client/getClient.d.ts +1 -9
  178. package/dist/esm/client/getClient.js +21 -18
  179. package/dist/esm/client/getClient.js.map +1 -1
  180. package/dist/esm/client/multipart.js +1 -1
  181. package/dist/esm/client/multipart.js.map +1 -1
  182. package/dist/esm/client/restError.js +4 -4
  183. package/dist/esm/client/restError.js.map +1 -1
  184. package/dist/esm/client/sendRequest.js +2 -2
  185. package/dist/esm/client/sendRequest.js.map +1 -1
  186. package/dist/esm/constants.js +1 -1
  187. package/dist/esm/constants.js.map +1 -1
  188. package/dist/esm/createPipelineFromOptions.d.ts +3 -1
  189. package/dist/esm/createPipelineFromOptions.js +4 -0
  190. package/dist/esm/createPipelineFromOptions.js.map +1 -1
  191. package/dist/esm/fetchHttpClient.js +1 -1
  192. package/dist/esm/fetchHttpClient.js.map +1 -1
  193. package/dist/esm/index.d.ts +3 -3
  194. package/dist/esm/index.js +2 -2
  195. package/dist/esm/index.js.map +1 -1
  196. package/dist/esm/interfaces.d.ts +11 -2
  197. package/dist/esm/interfaces.js.map +1 -1
  198. package/dist/esm/nodeHttpClient.js +10 -3
  199. package/dist/esm/nodeHttpClient.js.map +1 -1
  200. package/dist/esm/pipelineRequest.d.ts +1 -2
  201. package/dist/esm/pipelineRequest.js.map +1 -1
  202. package/dist/esm/policies/agentPolicy.d.ts +11 -0
  203. package/dist/esm/policies/agentPolicy.js +22 -0
  204. package/dist/esm/policies/agentPolicy.js.map +1 -0
  205. package/dist/esm/policies/auth/apiKeyAuthenticationPolicy.d.ts +30 -0
  206. package/dist/esm/policies/auth/apiKeyAuthenticationPolicy.js +31 -0
  207. package/dist/esm/policies/auth/apiKeyAuthenticationPolicy.js.map +1 -0
  208. package/dist/esm/policies/auth/basicAuthenticationPolicy.d.ts +30 -0
  209. package/dist/esm/policies/auth/basicAuthenticationPolicy.js +31 -0
  210. package/dist/esm/policies/auth/basicAuthenticationPolicy.js.map +1 -0
  211. package/dist/esm/policies/auth/bearerAuthenticationPolicy.d.ts +30 -0
  212. package/dist/esm/policies/auth/bearerAuthenticationPolicy.js +31 -0
  213. package/dist/esm/policies/auth/bearerAuthenticationPolicy.js.map +1 -0
  214. package/dist/esm/policies/auth/checkInsecureConnection.d.ts +9 -0
  215. package/dist/esm/policies/auth/checkInsecureConnection.js +50 -0
  216. package/dist/esm/policies/auth/checkInsecureConnection.js.map +1 -0
  217. package/dist/esm/policies/auth/oauth2AuthenticationPolicy.d.ts +31 -0
  218. package/dist/esm/policies/auth/oauth2AuthenticationPolicy.js +31 -0
  219. package/dist/esm/policies/auth/oauth2AuthenticationPolicy.js.map +1 -0
  220. package/dist/esm/policies/retryPolicy.js +0 -1
  221. package/dist/esm/policies/retryPolicy.js.map +1 -1
  222. package/dist/esm/policies/throttlingRetryPolicy.d.ts +3 -3
  223. package/dist/esm/policies/throttlingRetryPolicy.js +3 -3
  224. package/dist/esm/policies/throttlingRetryPolicy.js.map +1 -1
  225. package/dist/esm/restError.js +9 -8
  226. package/dist/esm/restError.js.map +1 -1
  227. package/dist/esm/util/aborterUtils.d.ts +3 -4
  228. package/dist/esm/util/aborterUtils.js.map +1 -1
  229. package/dist/esm/util/file.js +3 -0
  230. package/dist/esm/util/file.js.map +1 -1
  231. package/dist/esm/util/helpers.d.ts +1 -2
  232. package/dist/esm/util/helpers.js.map +1 -1
  233. package/dist/esm/util/inspect.common.d.ts +1 -1
  234. package/dist/esm/util/inspect.common.js +1 -1
  235. package/dist/esm/util/inspect.common.js.map +1 -1
  236. package/dist/esm/xhrHttpClient.js +1 -1
  237. package/dist/esm/xhrHttpClient.js.map +1 -1
  238. package/dist/react-native/abort-controller/AbortError.d.ts +4 -1
  239. package/dist/react-native/abort-controller/AbortError.js +4 -1
  240. package/dist/react-native/abort-controller/AbortError.js.map +1 -1
  241. package/dist/react-native/auth/credentials.d.ts +77 -0
  242. package/dist/react-native/auth/credentials.js +27 -0
  243. package/dist/react-native/auth/credentials.js.map +1 -0
  244. package/dist/react-native/auth/oauth2Flows.d.ts +57 -0
  245. package/dist/react-native/auth/oauth2Flows.js +4 -0
  246. package/dist/react-native/auth/oauth2Flows.js.map +1 -0
  247. package/dist/react-native/auth/schemes.d.ts +53 -0
  248. package/dist/react-native/auth/schemes.js +4 -0
  249. package/dist/react-native/auth/schemes.js.map +1 -0
  250. package/dist/react-native/client/clientHelpers.d.ts +1 -20
  251. package/dist/react-native/client/clientHelpers.js +21 -30
  252. package/dist/react-native/client/clientHelpers.js.map +1 -1
  253. package/dist/react-native/client/common.d.ts +21 -16
  254. package/dist/react-native/client/common.js.map +1 -1
  255. package/dist/react-native/client/getClient.d.ts +1 -9
  256. package/dist/react-native/client/getClient.js +21 -18
  257. package/dist/react-native/client/getClient.js.map +1 -1
  258. package/dist/react-native/client/multipart.js +1 -1
  259. package/dist/react-native/client/multipart.js.map +1 -1
  260. package/dist/react-native/client/restError.js +4 -4
  261. package/dist/react-native/client/restError.js.map +1 -1
  262. package/dist/react-native/client/sendRequest.js +2 -2
  263. package/dist/react-native/client/sendRequest.js.map +1 -1
  264. package/dist/react-native/constants.js +1 -1
  265. package/dist/react-native/constants.js.map +1 -1
  266. package/dist/react-native/createPipelineFromOptions.d.ts +3 -1
  267. package/dist/react-native/createPipelineFromOptions.js +4 -0
  268. package/dist/react-native/createPipelineFromOptions.js.map +1 -1
  269. package/dist/react-native/fetchHttpClient.js +1 -1
  270. package/dist/react-native/fetchHttpClient.js.map +1 -1
  271. package/dist/react-native/index.d.ts +3 -3
  272. package/dist/react-native/index.js +2 -2
  273. package/dist/react-native/index.js.map +1 -1
  274. package/dist/react-native/interfaces.d.ts +11 -2
  275. package/dist/react-native/interfaces.js.map +1 -1
  276. package/dist/react-native/nodeHttpClient.js +10 -3
  277. package/dist/react-native/nodeHttpClient.js.map +1 -1
  278. package/dist/react-native/pipelineRequest.d.ts +1 -2
  279. package/dist/react-native/pipelineRequest.js.map +1 -1
  280. package/dist/react-native/policies/agentPolicy.d.ts +11 -0
  281. package/dist/react-native/policies/agentPolicy.js +22 -0
  282. package/dist/react-native/policies/agentPolicy.js.map +1 -0
  283. package/dist/react-native/policies/auth/apiKeyAuthenticationPolicy.d.ts +30 -0
  284. package/dist/react-native/policies/auth/apiKeyAuthenticationPolicy.js +31 -0
  285. package/dist/react-native/policies/auth/apiKeyAuthenticationPolicy.js.map +1 -0
  286. package/dist/react-native/policies/auth/basicAuthenticationPolicy.d.ts +30 -0
  287. package/dist/react-native/policies/auth/basicAuthenticationPolicy.js +31 -0
  288. package/dist/react-native/policies/auth/basicAuthenticationPolicy.js.map +1 -0
  289. package/dist/react-native/policies/auth/bearerAuthenticationPolicy.d.ts +30 -0
  290. package/dist/react-native/policies/auth/bearerAuthenticationPolicy.js +31 -0
  291. package/dist/react-native/policies/auth/bearerAuthenticationPolicy.js.map +1 -0
  292. package/dist/react-native/policies/auth/checkInsecureConnection.d.ts +9 -0
  293. package/dist/react-native/policies/auth/checkInsecureConnection.js +50 -0
  294. package/dist/react-native/policies/auth/checkInsecureConnection.js.map +1 -0
  295. package/dist/react-native/policies/auth/oauth2AuthenticationPolicy.d.ts +31 -0
  296. package/dist/react-native/policies/auth/oauth2AuthenticationPolicy.js +31 -0
  297. package/dist/react-native/policies/auth/oauth2AuthenticationPolicy.js.map +1 -0
  298. package/dist/react-native/policies/retryPolicy.js +0 -1
  299. package/dist/react-native/policies/retryPolicy.js.map +1 -1
  300. package/dist/react-native/policies/throttlingRetryPolicy.d.ts +3 -3
  301. package/dist/react-native/policies/throttlingRetryPolicy.js +3 -3
  302. package/dist/react-native/policies/throttlingRetryPolicy.js.map +1 -1
  303. package/dist/react-native/restError.js +9 -8
  304. package/dist/react-native/restError.js.map +1 -1
  305. package/dist/react-native/util/aborterUtils.d.ts +3 -4
  306. package/dist/react-native/util/aborterUtils.js.map +1 -1
  307. package/dist/react-native/util/file.js +3 -0
  308. package/dist/react-native/util/file.js.map +1 -1
  309. package/dist/react-native/util/helpers.d.ts +1 -2
  310. package/dist/react-native/util/helpers.js.map +1 -1
  311. package/dist/react-native/util/inspect.common.d.ts +1 -1
  312. package/dist/react-native/util/inspect.common.js +1 -1
  313. package/dist/react-native/util/inspect.common.js.map +1 -1
  314. package/dist/react-native/xhrHttpClient.js +1 -1
  315. package/dist/react-native/xhrHttpClient.js.map +1 -1
  316. package/package.json +10 -8
  317. package/dist/browser/abort-controller/AbortError.d.ts.map +0 -1
  318. package/dist/browser/abort-controller/AbortSignalLike.d.ts +0 -19
  319. package/dist/browser/abort-controller/AbortSignalLike.d.ts.map +0 -1
  320. package/dist/browser/abort-controller/AbortSignalLike.js.map +0 -1
  321. package/dist/browser/accessTokenCache.d.ts +0 -40
  322. package/dist/browser/accessTokenCache.d.ts.map +0 -1
  323. package/dist/browser/accessTokenCache.js +0 -32
  324. package/dist/browser/accessTokenCache.js.map +0 -1
  325. package/dist/browser/auth/keyCredential.d.ts +0 -16
  326. package/dist/browser/auth/keyCredential.d.ts.map +0 -1
  327. package/dist/browser/auth/keyCredential.js +0 -12
  328. package/dist/browser/auth/keyCredential.js.map +0 -1
  329. package/dist/browser/auth/tokenCredential.d.ts +0 -71
  330. package/dist/browser/auth/tokenCredential.d.ts.map +0 -1
  331. package/dist/browser/auth/tokenCredential.js +0 -19
  332. package/dist/browser/auth/tokenCredential.js.map +0 -1
  333. package/dist/browser/client/apiVersionPolicy.d.ts.map +0 -1
  334. package/dist/browser/client/clientHelpers.d.ts.map +0 -1
  335. package/dist/browser/client/common.d.ts.map +0 -1
  336. package/dist/browser/client/getClient.d.ts.map +0 -1
  337. package/dist/browser/client/keyCredentialAuthenticationPolicy.d.ts +0 -8
  338. package/dist/browser/client/keyCredentialAuthenticationPolicy.d.ts.map +0 -1
  339. package/dist/browser/client/keyCredentialAuthenticationPolicy.js +0 -16
  340. package/dist/browser/client/keyCredentialAuthenticationPolicy.js.map +0 -1
  341. package/dist/browser/client/multipart.d.ts.map +0 -1
  342. package/dist/browser/client/operationOptionHelpers.d.ts.map +0 -1
  343. package/dist/browser/client/restError.d.ts.map +0 -1
  344. package/dist/browser/client/sendRequest.d.ts.map +0 -1
  345. package/dist/browser/client/urlHelpers.d.ts.map +0 -1
  346. package/dist/browser/constants.d.ts.map +0 -1
  347. package/dist/browser/createPipelineFromOptions.d.ts.map +0 -1
  348. package/dist/browser/defaultHttpClient-browser.d.mts.map +0 -1
  349. package/dist/browser/fetchHttpClient.d.ts.map +0 -1
  350. package/dist/browser/httpHeaders.d.ts.map +0 -1
  351. package/dist/browser/index.d.ts.map +0 -1
  352. package/dist/browser/interfaces.d.ts.map +0 -1
  353. package/dist/browser/log.d.ts.map +0 -1
  354. package/dist/browser/logger/debug.d.ts.map +0 -1
  355. package/dist/browser/logger/log-browser.d.mts.map +0 -1
  356. package/dist/browser/logger/log.common.d.ts.map +0 -1
  357. package/dist/browser/logger/logger.d.ts.map +0 -1
  358. package/dist/browser/nodeHttpClient.d.ts.map +0 -1
  359. package/dist/browser/pipeline.d.ts.map +0 -1
  360. package/dist/browser/pipelineRequest.d.ts.map +0 -1
  361. package/dist/browser/policies/bearerTokenAuthenticationPolicy.d.ts +0 -99
  362. package/dist/browser/policies/bearerTokenAuthenticationPolicy.d.ts.map +0 -1
  363. package/dist/browser/policies/bearerTokenAuthenticationPolicy.js +0 -107
  364. package/dist/browser/policies/bearerTokenAuthenticationPolicy.js.map +0 -1
  365. package/dist/browser/policies/decompressResponsePolicy-browser.d.mts.map +0 -1
  366. package/dist/browser/policies/defaultRetryPolicy.d.ts.map +0 -1
  367. package/dist/browser/policies/exponentialRetryPolicy.d.ts.map +0 -1
  368. package/dist/browser/policies/formDataPolicy.d.ts.map +0 -1
  369. package/dist/browser/policies/logPolicy.d.ts.map +0 -1
  370. package/dist/browser/policies/multipartPolicy.d.ts.map +0 -1
  371. package/dist/browser/policies/proxyPolicy-browser.d.mts.map +0 -1
  372. package/dist/browser/policies/proxyPolicy.common.d.ts.map +0 -1
  373. package/dist/browser/policies/redirectPolicy.d.ts.map +0 -1
  374. package/dist/browser/policies/retryPolicy.d.ts.map +0 -1
  375. package/dist/browser/policies/systemErrorRetryPolicy.d.ts.map +0 -1
  376. package/dist/browser/policies/throttlingRetryPolicy.d.ts.map +0 -1
  377. package/dist/browser/policies/tlsPolicy.d.ts.map +0 -1
  378. package/dist/browser/policies/userAgentPolicy.d.ts.map +0 -1
  379. package/dist/browser/restError.d.ts.map +0 -1
  380. package/dist/browser/retryStrategies/exponentialRetryStrategy.d.ts.map +0 -1
  381. package/dist/browser/retryStrategies/retryStrategy.d.ts.map +0 -1
  382. package/dist/browser/retryStrategies/throttlingRetryStrategy.d.ts.map +0 -1
  383. package/dist/browser/util/aborterUtils.d.ts.map +0 -1
  384. package/dist/browser/util/bytesEncoding-browser.d.mts.map +0 -1
  385. package/dist/browser/util/bytesEncoding.common.d.ts.map +0 -1
  386. package/dist/browser/util/checkEnvironment.d.ts.map +0 -1
  387. package/dist/browser/util/concat-browser.d.mts.map +0 -1
  388. package/dist/browser/util/concat.common.d.ts.map +0 -1
  389. package/dist/browser/util/createAbortablePromise.d.ts.map +0 -1
  390. package/dist/browser/util/delay.d.ts.map +0 -1
  391. package/dist/browser/util/error.d.ts.map +0 -1
  392. package/dist/browser/util/file.d.ts.map +0 -1
  393. package/dist/browser/util/helpers.d.ts.map +0 -1
  394. package/dist/browser/util/inspect-browser.d.mts.map +0 -1
  395. package/dist/browser/util/inspect.common.d.ts.map +0 -1
  396. package/dist/browser/util/object.d.ts.map +0 -1
  397. package/dist/browser/util/random.d.ts.map +0 -1
  398. package/dist/browser/util/sanitizer.d.ts.map +0 -1
  399. package/dist/browser/util/sha256-browser.d.mts.map +0 -1
  400. package/dist/browser/util/sha256.common.d.ts.map +0 -1
  401. package/dist/browser/util/tokenCycler.d.ts +0 -45
  402. package/dist/browser/util/tokenCycler.d.ts.map +0 -1
  403. package/dist/browser/util/tokenCycler.js +0 -162
  404. package/dist/browser/util/tokenCycler.js.map +0 -1
  405. package/dist/browser/util/typeGuards.d.ts.map +0 -1
  406. package/dist/browser/util/userAgent.d.ts.map +0 -1
  407. package/dist/browser/util/userAgentPlatform-browser.d.mts.map +0 -1
  408. package/dist/browser/util/uuidUtils-browser.d.mts.map +0 -1
  409. package/dist/browser/util/uuidUtils.common.d.ts.map +0 -1
  410. package/dist/browser/xhrHttpClient.d.ts.map +0 -1
  411. package/dist/commonjs/abort-controller/AbortError.d.ts.map +0 -1
  412. package/dist/commonjs/abort-controller/AbortSignalLike.d.ts +0 -19
  413. package/dist/commonjs/abort-controller/AbortSignalLike.d.ts.map +0 -1
  414. package/dist/commonjs/abort-controller/AbortSignalLike.js.map +0 -1
  415. package/dist/commonjs/accessTokenCache.d.ts +0 -40
  416. package/dist/commonjs/accessTokenCache.d.ts.map +0 -1
  417. package/dist/commonjs/accessTokenCache.js +0 -36
  418. package/dist/commonjs/accessTokenCache.js.map +0 -1
  419. package/dist/commonjs/auth/keyCredential.d.ts +0 -16
  420. package/dist/commonjs/auth/keyCredential.d.ts.map +0 -1
  421. package/dist/commonjs/auth/keyCredential.js +0 -15
  422. package/dist/commonjs/auth/keyCredential.js.map +0 -1
  423. package/dist/commonjs/auth/tokenCredential.d.ts +0 -71
  424. package/dist/commonjs/auth/tokenCredential.d.ts.map +0 -1
  425. package/dist/commonjs/auth/tokenCredential.js +0 -22
  426. package/dist/commonjs/auth/tokenCredential.js.map +0 -1
  427. package/dist/commonjs/client/apiVersionPolicy.d.ts.map +0 -1
  428. package/dist/commonjs/client/clientHelpers.d.ts.map +0 -1
  429. package/dist/commonjs/client/common.d.ts.map +0 -1
  430. package/dist/commonjs/client/getClient.d.ts.map +0 -1
  431. package/dist/commonjs/client/keyCredentialAuthenticationPolicy.d.ts +0 -8
  432. package/dist/commonjs/client/keyCredentialAuthenticationPolicy.d.ts.map +0 -1
  433. package/dist/commonjs/client/keyCredentialAuthenticationPolicy.js +0 -20
  434. package/dist/commonjs/client/keyCredentialAuthenticationPolicy.js.map +0 -1
  435. package/dist/commonjs/client/multipart.d.ts.map +0 -1
  436. package/dist/commonjs/client/operationOptionHelpers.d.ts.map +0 -1
  437. package/dist/commonjs/client/restError.d.ts.map +0 -1
  438. package/dist/commonjs/client/sendRequest.d.ts.map +0 -1
  439. package/dist/commonjs/client/urlHelpers.d.ts.map +0 -1
  440. package/dist/commonjs/constants.d.ts.map +0 -1
  441. package/dist/commonjs/createPipelineFromOptions.d.ts.map +0 -1
  442. package/dist/commonjs/defaultHttpClient.d.ts.map +0 -1
  443. package/dist/commonjs/fetchHttpClient.d.ts.map +0 -1
  444. package/dist/commonjs/httpHeaders.d.ts.map +0 -1
  445. package/dist/commonjs/index.d.ts.map +0 -1
  446. package/dist/commonjs/interfaces.d.ts.map +0 -1
  447. package/dist/commonjs/log.d.ts.map +0 -1
  448. package/dist/commonjs/logger/debug.d.ts.map +0 -1
  449. package/dist/commonjs/logger/log.common.d.ts.map +0 -1
  450. package/dist/commonjs/logger/log.d.ts.map +0 -1
  451. package/dist/commonjs/logger/logger.d.ts.map +0 -1
  452. package/dist/commonjs/nodeHttpClient.d.ts.map +0 -1
  453. package/dist/commonjs/pipeline.d.ts.map +0 -1
  454. package/dist/commonjs/pipelineRequest.d.ts.map +0 -1
  455. package/dist/commonjs/policies/bearerTokenAuthenticationPolicy.d.ts +0 -99
  456. package/dist/commonjs/policies/bearerTokenAuthenticationPolicy.d.ts.map +0 -1
  457. package/dist/commonjs/policies/bearerTokenAuthenticationPolicy.js +0 -111
  458. package/dist/commonjs/policies/bearerTokenAuthenticationPolicy.js.map +0 -1
  459. package/dist/commonjs/policies/decompressResponsePolicy.d.ts.map +0 -1
  460. package/dist/commonjs/policies/defaultRetryPolicy.d.ts.map +0 -1
  461. package/dist/commonjs/policies/exponentialRetryPolicy.d.ts.map +0 -1
  462. package/dist/commonjs/policies/formDataPolicy.d.ts.map +0 -1
  463. package/dist/commonjs/policies/logPolicy.d.ts.map +0 -1
  464. package/dist/commonjs/policies/multipartPolicy.d.ts.map +0 -1
  465. package/dist/commonjs/policies/proxyPolicy.common.d.ts.map +0 -1
  466. package/dist/commonjs/policies/proxyPolicy.d.ts.map +0 -1
  467. package/dist/commonjs/policies/redirectPolicy.d.ts.map +0 -1
  468. package/dist/commonjs/policies/retryPolicy.d.ts.map +0 -1
  469. package/dist/commonjs/policies/systemErrorRetryPolicy.d.ts.map +0 -1
  470. package/dist/commonjs/policies/throttlingRetryPolicy.d.ts.map +0 -1
  471. package/dist/commonjs/policies/tlsPolicy.d.ts.map +0 -1
  472. package/dist/commonjs/policies/userAgentPolicy.d.ts.map +0 -1
  473. package/dist/commonjs/restError.d.ts.map +0 -1
  474. package/dist/commonjs/retryStrategies/exponentialRetryStrategy.d.ts.map +0 -1
  475. package/dist/commonjs/retryStrategies/retryStrategy.d.ts.map +0 -1
  476. package/dist/commonjs/retryStrategies/throttlingRetryStrategy.d.ts.map +0 -1
  477. package/dist/commonjs/util/aborterUtils.d.ts.map +0 -1
  478. package/dist/commonjs/util/bytesEncoding.common.d.ts.map +0 -1
  479. package/dist/commonjs/util/bytesEncoding.d.ts.map +0 -1
  480. package/dist/commonjs/util/checkEnvironment.d.ts.map +0 -1
  481. package/dist/commonjs/util/concat.common.d.ts.map +0 -1
  482. package/dist/commonjs/util/concat.d.ts.map +0 -1
  483. package/dist/commonjs/util/createAbortablePromise.d.ts.map +0 -1
  484. package/dist/commonjs/util/delay.d.ts.map +0 -1
  485. package/dist/commonjs/util/error.d.ts.map +0 -1
  486. package/dist/commonjs/util/file.d.ts.map +0 -1
  487. package/dist/commonjs/util/helpers.d.ts.map +0 -1
  488. package/dist/commonjs/util/inspect.common.d.ts.map +0 -1
  489. package/dist/commonjs/util/inspect.d.ts.map +0 -1
  490. package/dist/commonjs/util/object.d.ts.map +0 -1
  491. package/dist/commonjs/util/random.d.ts.map +0 -1
  492. package/dist/commonjs/util/sanitizer.d.ts.map +0 -1
  493. package/dist/commonjs/util/sha256.common.d.ts.map +0 -1
  494. package/dist/commonjs/util/sha256.d.ts.map +0 -1
  495. package/dist/commonjs/util/tokenCycler.d.ts +0 -45
  496. package/dist/commonjs/util/tokenCycler.d.ts.map +0 -1
  497. package/dist/commonjs/util/tokenCycler.js +0 -166
  498. package/dist/commonjs/util/tokenCycler.js.map +0 -1
  499. package/dist/commonjs/util/typeGuards.d.ts.map +0 -1
  500. package/dist/commonjs/util/userAgent.d.ts.map +0 -1
  501. package/dist/commonjs/util/userAgentPlatform.d.ts.map +0 -1
  502. package/dist/commonjs/util/uuidUtils.common.d.ts.map +0 -1
  503. package/dist/commonjs/util/uuidUtils.d.ts.map +0 -1
  504. package/dist/commonjs/xhrHttpClient.d.ts.map +0 -1
  505. package/dist/esm/abort-controller/AbortError.d.ts.map +0 -1
  506. package/dist/esm/abort-controller/AbortSignalLike.d.ts +0 -19
  507. package/dist/esm/abort-controller/AbortSignalLike.d.ts.map +0 -1
  508. package/dist/esm/abort-controller/AbortSignalLike.js.map +0 -1
  509. package/dist/esm/accessTokenCache.d.ts +0 -40
  510. package/dist/esm/accessTokenCache.d.ts.map +0 -1
  511. package/dist/esm/accessTokenCache.js +0 -32
  512. package/dist/esm/accessTokenCache.js.map +0 -1
  513. package/dist/esm/auth/keyCredential.d.ts +0 -16
  514. package/dist/esm/auth/keyCredential.d.ts.map +0 -1
  515. package/dist/esm/auth/keyCredential.js +0 -12
  516. package/dist/esm/auth/keyCredential.js.map +0 -1
  517. package/dist/esm/auth/tokenCredential.d.ts +0 -71
  518. package/dist/esm/auth/tokenCredential.d.ts.map +0 -1
  519. package/dist/esm/auth/tokenCredential.js +0 -19
  520. package/dist/esm/auth/tokenCredential.js.map +0 -1
  521. package/dist/esm/client/apiVersionPolicy.d.ts.map +0 -1
  522. package/dist/esm/client/clientHelpers.d.ts.map +0 -1
  523. package/dist/esm/client/common.d.ts.map +0 -1
  524. package/dist/esm/client/getClient.d.ts.map +0 -1
  525. package/dist/esm/client/keyCredentialAuthenticationPolicy.d.ts +0 -8
  526. package/dist/esm/client/keyCredentialAuthenticationPolicy.d.ts.map +0 -1
  527. package/dist/esm/client/keyCredentialAuthenticationPolicy.js +0 -16
  528. package/dist/esm/client/keyCredentialAuthenticationPolicy.js.map +0 -1
  529. package/dist/esm/client/multipart.d.ts.map +0 -1
  530. package/dist/esm/client/operationOptionHelpers.d.ts.map +0 -1
  531. package/dist/esm/client/restError.d.ts.map +0 -1
  532. package/dist/esm/client/sendRequest.d.ts.map +0 -1
  533. package/dist/esm/client/urlHelpers.d.ts.map +0 -1
  534. package/dist/esm/constants.d.ts.map +0 -1
  535. package/dist/esm/createPipelineFromOptions.d.ts.map +0 -1
  536. package/dist/esm/defaultHttpClient.d.ts.map +0 -1
  537. package/dist/esm/fetchHttpClient.d.ts.map +0 -1
  538. package/dist/esm/httpHeaders.d.ts.map +0 -1
  539. package/dist/esm/index.d.ts.map +0 -1
  540. package/dist/esm/interfaces.d.ts.map +0 -1
  541. package/dist/esm/log.d.ts.map +0 -1
  542. package/dist/esm/logger/debug.d.ts.map +0 -1
  543. package/dist/esm/logger/log.common.d.ts.map +0 -1
  544. package/dist/esm/logger/log.d.ts.map +0 -1
  545. package/dist/esm/logger/logger.d.ts.map +0 -1
  546. package/dist/esm/nodeHttpClient.d.ts.map +0 -1
  547. package/dist/esm/pipeline.d.ts.map +0 -1
  548. package/dist/esm/pipelineRequest.d.ts.map +0 -1
  549. package/dist/esm/policies/bearerTokenAuthenticationPolicy.d.ts +0 -99
  550. package/dist/esm/policies/bearerTokenAuthenticationPolicy.d.ts.map +0 -1
  551. package/dist/esm/policies/bearerTokenAuthenticationPolicy.js +0 -107
  552. package/dist/esm/policies/bearerTokenAuthenticationPolicy.js.map +0 -1
  553. package/dist/esm/policies/decompressResponsePolicy.d.ts.map +0 -1
  554. package/dist/esm/policies/defaultRetryPolicy.d.ts.map +0 -1
  555. package/dist/esm/policies/exponentialRetryPolicy.d.ts.map +0 -1
  556. package/dist/esm/policies/formDataPolicy.d.ts.map +0 -1
  557. package/dist/esm/policies/logPolicy.d.ts.map +0 -1
  558. package/dist/esm/policies/multipartPolicy.d.ts.map +0 -1
  559. package/dist/esm/policies/proxyPolicy.common.d.ts.map +0 -1
  560. package/dist/esm/policies/proxyPolicy.d.ts.map +0 -1
  561. package/dist/esm/policies/redirectPolicy.d.ts.map +0 -1
  562. package/dist/esm/policies/retryPolicy.d.ts.map +0 -1
  563. package/dist/esm/policies/systemErrorRetryPolicy.d.ts.map +0 -1
  564. package/dist/esm/policies/throttlingRetryPolicy.d.ts.map +0 -1
  565. package/dist/esm/policies/tlsPolicy.d.ts.map +0 -1
  566. package/dist/esm/policies/userAgentPolicy.d.ts.map +0 -1
  567. package/dist/esm/restError.d.ts.map +0 -1
  568. package/dist/esm/retryStrategies/exponentialRetryStrategy.d.ts.map +0 -1
  569. package/dist/esm/retryStrategies/retryStrategy.d.ts.map +0 -1
  570. package/dist/esm/retryStrategies/throttlingRetryStrategy.d.ts.map +0 -1
  571. package/dist/esm/util/aborterUtils.d.ts.map +0 -1
  572. package/dist/esm/util/bytesEncoding.common.d.ts.map +0 -1
  573. package/dist/esm/util/bytesEncoding.d.ts.map +0 -1
  574. package/dist/esm/util/checkEnvironment.d.ts.map +0 -1
  575. package/dist/esm/util/concat.common.d.ts.map +0 -1
  576. package/dist/esm/util/concat.d.ts.map +0 -1
  577. package/dist/esm/util/createAbortablePromise.d.ts.map +0 -1
  578. package/dist/esm/util/delay.d.ts.map +0 -1
  579. package/dist/esm/util/error.d.ts.map +0 -1
  580. package/dist/esm/util/file.d.ts.map +0 -1
  581. package/dist/esm/util/helpers.d.ts.map +0 -1
  582. package/dist/esm/util/inspect.common.d.ts.map +0 -1
  583. package/dist/esm/util/inspect.d.ts.map +0 -1
  584. package/dist/esm/util/object.d.ts.map +0 -1
  585. package/dist/esm/util/random.d.ts.map +0 -1
  586. package/dist/esm/util/sanitizer.d.ts.map +0 -1
  587. package/dist/esm/util/sha256.common.d.ts.map +0 -1
  588. package/dist/esm/util/sha256.d.ts.map +0 -1
  589. package/dist/esm/util/tokenCycler.d.ts +0 -45
  590. package/dist/esm/util/tokenCycler.d.ts.map +0 -1
  591. package/dist/esm/util/tokenCycler.js +0 -162
  592. package/dist/esm/util/tokenCycler.js.map +0 -1
  593. package/dist/esm/util/typeGuards.d.ts.map +0 -1
  594. package/dist/esm/util/userAgent.d.ts.map +0 -1
  595. package/dist/esm/util/userAgentPlatform.d.ts.map +0 -1
  596. package/dist/esm/util/uuidUtils.common.d.ts.map +0 -1
  597. package/dist/esm/util/uuidUtils.d.ts.map +0 -1
  598. package/dist/esm/xhrHttpClient.d.ts.map +0 -1
  599. package/dist/react-native/abort-controller/AbortError.d.ts.map +0 -1
  600. package/dist/react-native/abort-controller/AbortSignalLike.d.ts +0 -19
  601. package/dist/react-native/abort-controller/AbortSignalLike.d.ts.map +0 -1
  602. package/dist/react-native/abort-controller/AbortSignalLike.js.map +0 -1
  603. package/dist/react-native/accessTokenCache.d.ts +0 -40
  604. package/dist/react-native/accessTokenCache.d.ts.map +0 -1
  605. package/dist/react-native/accessTokenCache.js +0 -32
  606. package/dist/react-native/accessTokenCache.js.map +0 -1
  607. package/dist/react-native/auth/keyCredential.d.ts +0 -16
  608. package/dist/react-native/auth/keyCredential.d.ts.map +0 -1
  609. package/dist/react-native/auth/keyCredential.js +0 -12
  610. package/dist/react-native/auth/keyCredential.js.map +0 -1
  611. package/dist/react-native/auth/tokenCredential.d.ts +0 -71
  612. package/dist/react-native/auth/tokenCredential.d.ts.map +0 -1
  613. package/dist/react-native/auth/tokenCredential.js +0 -19
  614. package/dist/react-native/auth/tokenCredential.js.map +0 -1
  615. package/dist/react-native/client/apiVersionPolicy.d.ts.map +0 -1
  616. package/dist/react-native/client/clientHelpers.d.ts.map +0 -1
  617. package/dist/react-native/client/common.d.ts.map +0 -1
  618. package/dist/react-native/client/getClient.d.ts.map +0 -1
  619. package/dist/react-native/client/keyCredentialAuthenticationPolicy.d.ts +0 -8
  620. package/dist/react-native/client/keyCredentialAuthenticationPolicy.d.ts.map +0 -1
  621. package/dist/react-native/client/keyCredentialAuthenticationPolicy.js +0 -16
  622. package/dist/react-native/client/keyCredentialAuthenticationPolicy.js.map +0 -1
  623. package/dist/react-native/client/multipart.d.ts.map +0 -1
  624. package/dist/react-native/client/operationOptionHelpers.d.ts.map +0 -1
  625. package/dist/react-native/client/restError.d.ts.map +0 -1
  626. package/dist/react-native/client/sendRequest.d.ts.map +0 -1
  627. package/dist/react-native/client/urlHelpers.d.ts.map +0 -1
  628. package/dist/react-native/constants.d.ts.map +0 -1
  629. package/dist/react-native/createPipelineFromOptions.d.ts.map +0 -1
  630. package/dist/react-native/defaultHttpClient-react-native.d.mts.map +0 -1
  631. package/dist/react-native/fetchHttpClient.d.ts.map +0 -1
  632. package/dist/react-native/httpHeaders.d.ts.map +0 -1
  633. package/dist/react-native/index.d.ts.map +0 -1
  634. package/dist/react-native/interfaces.d.ts.map +0 -1
  635. package/dist/react-native/log.d.ts.map +0 -1
  636. package/dist/react-native/logger/debug.d.ts.map +0 -1
  637. package/dist/react-native/logger/log-react-native.d.mts.map +0 -1
  638. package/dist/react-native/logger/log.common.d.ts.map +0 -1
  639. package/dist/react-native/logger/logger.d.ts.map +0 -1
  640. package/dist/react-native/nodeHttpClient.d.ts.map +0 -1
  641. package/dist/react-native/pipeline.d.ts.map +0 -1
  642. package/dist/react-native/pipelineRequest.d.ts.map +0 -1
  643. package/dist/react-native/policies/bearerTokenAuthenticationPolicy.d.ts +0 -99
  644. package/dist/react-native/policies/bearerTokenAuthenticationPolicy.d.ts.map +0 -1
  645. package/dist/react-native/policies/bearerTokenAuthenticationPolicy.js +0 -107
  646. package/dist/react-native/policies/bearerTokenAuthenticationPolicy.js.map +0 -1
  647. package/dist/react-native/policies/decompressResponsePolicy.d.ts.map +0 -1
  648. package/dist/react-native/policies/defaultRetryPolicy.d.ts.map +0 -1
  649. package/dist/react-native/policies/exponentialRetryPolicy.d.ts.map +0 -1
  650. package/dist/react-native/policies/formDataPolicy.d.ts.map +0 -1
  651. package/dist/react-native/policies/logPolicy.d.ts.map +0 -1
  652. package/dist/react-native/policies/multipartPolicy.d.ts.map +0 -1
  653. package/dist/react-native/policies/proxyPolicy-react-native.d.mts.map +0 -1
  654. package/dist/react-native/policies/proxyPolicy.common.d.ts.map +0 -1
  655. package/dist/react-native/policies/redirectPolicy.d.ts.map +0 -1
  656. package/dist/react-native/policies/retryPolicy.d.ts.map +0 -1
  657. package/dist/react-native/policies/systemErrorRetryPolicy.d.ts.map +0 -1
  658. package/dist/react-native/policies/throttlingRetryPolicy.d.ts.map +0 -1
  659. package/dist/react-native/policies/tlsPolicy.d.ts.map +0 -1
  660. package/dist/react-native/policies/userAgentPolicy.d.ts.map +0 -1
  661. package/dist/react-native/restError.d.ts.map +0 -1
  662. package/dist/react-native/retryStrategies/exponentialRetryStrategy.d.ts.map +0 -1
  663. package/dist/react-native/retryStrategies/retryStrategy.d.ts.map +0 -1
  664. package/dist/react-native/retryStrategies/throttlingRetryStrategy.d.ts.map +0 -1
  665. package/dist/react-native/util/aborterUtils.d.ts.map +0 -1
  666. package/dist/react-native/util/bytesEncoding-react-native.d.mts.map +0 -1
  667. package/dist/react-native/util/bytesEncoding.common.d.ts.map +0 -1
  668. package/dist/react-native/util/checkEnvironment.d.ts.map +0 -1
  669. package/dist/react-native/util/concat-react-native.d.mts.map +0 -1
  670. package/dist/react-native/util/concat.common.d.ts.map +0 -1
  671. package/dist/react-native/util/createAbortablePromise.d.ts.map +0 -1
  672. package/dist/react-native/util/delay.d.ts.map +0 -1
  673. package/dist/react-native/util/error.d.ts.map +0 -1
  674. package/dist/react-native/util/file.d.ts.map +0 -1
  675. package/dist/react-native/util/helpers.d.ts.map +0 -1
  676. package/dist/react-native/util/inspect-react-native.d.mts.map +0 -1
  677. package/dist/react-native/util/inspect.common.d.ts.map +0 -1
  678. package/dist/react-native/util/object.d.ts.map +0 -1
  679. package/dist/react-native/util/random.d.ts.map +0 -1
  680. package/dist/react-native/util/sanitizer.d.ts.map +0 -1
  681. package/dist/react-native/util/sha256-react-native.d.mts.map +0 -1
  682. package/dist/react-native/util/sha256.common.d.ts.map +0 -1
  683. package/dist/react-native/util/tokenCycler.d.ts +0 -45
  684. package/dist/react-native/util/tokenCycler.d.ts.map +0 -1
  685. package/dist/react-native/util/tokenCycler.js +0 -162
  686. package/dist/react-native/util/tokenCycler.js.map +0 -1
  687. package/dist/react-native/util/typeGuards.d.ts.map +0 -1
  688. package/dist/react-native/util/userAgent.d.ts.map +0 -1
  689. package/dist/react-native/util/userAgentPlatform-react-native.d.mts.map +0 -1
  690. package/dist/react-native/util/uuidUtils-react-native.d.mts.map +0 -1
  691. package/dist/react-native/util/uuidUtils.common.d.ts.map +0 -1
  692. package/dist/react-native/xhrHttpClient.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"pipelineRequest.js","sourceRoot":"","sources":["../../src/pipelineRequest.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAkGjD,MAAM,mBAAmB;IAoBvB,YAAY,OAA+B;;QACzC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,iBAAiB,EAAE,CAAC;QACtD,IAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,KAAK,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,CAAC,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,gBAAgB,GAAG,MAAA,OAAO,CAAC,gBAAgB,mCAAI,KAAK,CAAC;QAC1D,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAC;QACnE,IAAI,CAAC,eAAe,GAAG,MAAA,OAAO,CAAC,eAAe,mCAAI,KAAK,CAAC;QACxD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QACjD,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACrD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,UAAU,EAAE,CAAC;QACnD,IAAI,CAAC,uBAAuB,GAAG,MAAA,OAAO,CAAC,uBAAuB,mCAAI,KAAK,CAAC;QACxE,IAAI,CAAC,oBAAoB,GAAG,MAAA,OAAO,CAAC,oBAAoB,mCAAI,KAAK,CAAC;IACpE,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAA+B;IACnE,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n FormDataMap,\n HttpHeaders,\n HttpMethods,\n MultipartRequestBody,\n PipelineRequest,\n ProxySettings,\n RequestBodyType,\n TransferProgressEvent,\n} from \"./interfaces.js\";\nimport { createHttpHeaders } from \"./httpHeaders.js\";\nimport type { AbortSignalLike } from \"./abort-controller/AbortSignalLike.js\";\nimport { randomUUID } from \"./util/uuidUtils.js\";\n\n/**\n * Settings to initialize a request.\n * Almost equivalent to Partial<PipelineRequest>, but url is mandatory.\n */\nexport interface PipelineRequestOptions {\n /**\n * The URL to make the request to.\n */\n url: string;\n\n /**\n * The HTTP method to use when making the request.\n */\n method?: HttpMethods;\n\n /**\n * The HTTP headers to use when making the request.\n */\n headers?: HttpHeaders;\n\n /**\n * The number of milliseconds a request can take before automatically being terminated.\n * If the request is terminated, an `AbortError` is thrown.\n * Defaults to 0, which disables the timeout.\n */\n timeout?: number;\n\n /**\n * If credentials (cookies) should be sent along during an XHR.\n * Defaults to false.\n */\n withCredentials?: boolean;\n\n /**\n * A unique identifier for the request. Used for logging and tracing.\n */\n requestId?: string;\n\n /**\n * The HTTP body content (if any)\n */\n body?: RequestBodyType;\n\n /**\n * Body for a multipart request.\n */\n multipartBody?: MultipartRequestBody;\n\n /**\n * To simulate a browser form post\n */\n formData?: FormDataMap;\n\n /**\n * A list of response status codes whose corresponding PipelineResponse body should be treated as a stream.\n */\n streamResponseStatusCodes?: Set<number>;\n\n /**\n * BROWSER ONLY\n *\n * A browser only option to enable use of the Streams API. If this option is set and streaming is used\n * (see `streamResponseStatusCodes`), the response will have a property `browserStream` instead of\n * `blobBody` which will be undefined.\n *\n * Default value is false\n */\n enableBrowserStreams?: boolean;\n\n /**\n * Proxy configuration.\n */\n proxySettings?: ProxySettings;\n\n /**\n * If the connection should not be reused.\n */\n disableKeepAlive?: boolean;\n\n /**\n * Used to abort the request later.\n */\n abortSignal?: AbortSignalLike;\n\n /**\n * Callback which fires upon upload progress.\n */\n onUploadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Callback which fires upon download progress. */\n onDownloadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Set to true if the request is sent over HTTP instead of HTTPS */\n allowInsecureConnection?: boolean;\n}\n\nclass PipelineRequestImpl implements PipelineRequest {\n public url: string;\n public method: HttpMethods;\n public headers: HttpHeaders;\n public timeout: number;\n public withCredentials: boolean;\n public body?: RequestBodyType;\n public multipartBody?: MultipartRequestBody;\n public formData?: FormDataMap;\n public streamResponseStatusCodes?: Set<number>;\n public enableBrowserStreams: boolean;\n\n public proxySettings?: ProxySettings;\n public disableKeepAlive: boolean;\n public abortSignal?: AbortSignalLike;\n public requestId: string;\n public allowInsecureConnection?: boolean;\n public onUploadProgress?: (progress: TransferProgressEvent) => void;\n public onDownloadProgress?: (progress: TransferProgressEvent) => void;\n\n constructor(options: PipelineRequestOptions) {\n this.url = options.url;\n this.body = options.body;\n this.headers = options.headers ?? createHttpHeaders();\n this.method = options.method ?? \"GET\";\n this.timeout = options.timeout ?? 0;\n this.multipartBody = options.multipartBody;\n this.formData = options.formData;\n this.disableKeepAlive = options.disableKeepAlive ?? false;\n this.proxySettings = options.proxySettings;\n this.streamResponseStatusCodes = options.streamResponseStatusCodes;\n this.withCredentials = options.withCredentials ?? false;\n this.abortSignal = options.abortSignal;\n this.onUploadProgress = options.onUploadProgress;\n this.onDownloadProgress = options.onDownloadProgress;\n this.requestId = options.requestId || randomUUID();\n this.allowInsecureConnection = options.allowInsecureConnection ?? false;\n this.enableBrowserStreams = options.enableBrowserStreams ?? false;\n }\n}\n\n/**\n * Creates a new pipeline request with the given options.\n * This method is to allow for the easy setting of default values and not required.\n * @param options - The options to create the request with.\n */\nexport function createPipelineRequest(options: PipelineRequestOptions): PipelineRequest {\n return new PipelineRequestImpl(options);\n}\n"]}
1
+ {"version":3,"file":"pipelineRequest.js","sourceRoot":"","sources":["../../src/pipelineRequest.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAYlC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAkGjD,MAAM,mBAAmB;IAoBvB,YAAY,OAA+B;;QACzC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,iBAAiB,EAAE,CAAC;QACtD,IAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,KAAK,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,CAAC,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,gBAAgB,GAAG,MAAA,OAAO,CAAC,gBAAgB,mCAAI,KAAK,CAAC;QAC1D,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAC;QACnE,IAAI,CAAC,eAAe,GAAG,MAAA,OAAO,CAAC,eAAe,mCAAI,KAAK,CAAC;QACxD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;QACjD,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACrD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,UAAU,EAAE,CAAC;QACnD,IAAI,CAAC,uBAAuB,GAAG,MAAA,OAAO,CAAC,uBAAuB,mCAAI,KAAK,CAAC;QACxE,IAAI,CAAC,oBAAoB,GAAG,MAAA,OAAO,CAAC,oBAAoB,mCAAI,KAAK,CAAC;IACpE,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAA+B;IACnE,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n FormDataMap,\n HttpHeaders,\n HttpMethods,\n MultipartRequestBody,\n PipelineRequest,\n ProxySettings,\n RequestBodyType,\n TransferProgressEvent,\n} from \"./interfaces.js\";\nimport { createHttpHeaders } from \"./httpHeaders.js\";\nimport { randomUUID } from \"./util/uuidUtils.js\";\n\n/**\n * Settings to initialize a request.\n * Almost equivalent to Partial<PipelineRequest>, but url is mandatory.\n */\nexport interface PipelineRequestOptions {\n /**\n * The URL to make the request to.\n */\n url: string;\n\n /**\n * The HTTP method to use when making the request.\n */\n method?: HttpMethods;\n\n /**\n * The HTTP headers to use when making the request.\n */\n headers?: HttpHeaders;\n\n /**\n * The number of milliseconds a request can take before automatically being terminated.\n * If the request is terminated, an `AbortError` is thrown.\n * Defaults to 0, which disables the timeout.\n */\n timeout?: number;\n\n /**\n * If credentials (cookies) should be sent along during an XHR.\n * Defaults to false.\n */\n withCredentials?: boolean;\n\n /**\n * A unique identifier for the request. Used for logging and tracing.\n */\n requestId?: string;\n\n /**\n * The HTTP body content (if any)\n */\n body?: RequestBodyType;\n\n /**\n * Body for a multipart request.\n */\n multipartBody?: MultipartRequestBody;\n\n /**\n * To simulate a browser form post\n */\n formData?: FormDataMap;\n\n /**\n * A list of response status codes whose corresponding PipelineResponse body should be treated as a stream.\n */\n streamResponseStatusCodes?: Set<number>;\n\n /**\n * BROWSER ONLY\n *\n * A browser only option to enable use of the Streams API. If this option is set and streaming is used\n * (see `streamResponseStatusCodes`), the response will have a property `browserStream` instead of\n * `blobBody` which will be undefined.\n *\n * Default value is false\n */\n enableBrowserStreams?: boolean;\n\n /**\n * Proxy configuration.\n */\n proxySettings?: ProxySettings;\n\n /**\n * If the connection should not be reused.\n */\n disableKeepAlive?: boolean;\n\n /**\n * Used to abort the request later.\n */\n abortSignal?: AbortSignal;\n\n /**\n * Callback which fires upon upload progress.\n */\n onUploadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Callback which fires upon download progress. */\n onDownloadProgress?: (progress: TransferProgressEvent) => void;\n\n /** Set to true if the request is sent over HTTP instead of HTTPS */\n allowInsecureConnection?: boolean;\n}\n\nclass PipelineRequestImpl implements PipelineRequest {\n public url: string;\n public method: HttpMethods;\n public headers: HttpHeaders;\n public timeout: number;\n public withCredentials: boolean;\n public body?: RequestBodyType;\n public multipartBody?: MultipartRequestBody;\n public formData?: FormDataMap;\n public streamResponseStatusCodes?: Set<number>;\n public enableBrowserStreams: boolean;\n\n public proxySettings?: ProxySettings;\n public disableKeepAlive: boolean;\n public abortSignal?: AbortSignal;\n public requestId: string;\n public allowInsecureConnection?: boolean;\n public onUploadProgress?: (progress: TransferProgressEvent) => void;\n public onDownloadProgress?: (progress: TransferProgressEvent) => void;\n\n constructor(options: PipelineRequestOptions) {\n this.url = options.url;\n this.body = options.body;\n this.headers = options.headers ?? createHttpHeaders();\n this.method = options.method ?? \"GET\";\n this.timeout = options.timeout ?? 0;\n this.multipartBody = options.multipartBody;\n this.formData = options.formData;\n this.disableKeepAlive = options.disableKeepAlive ?? false;\n this.proxySettings = options.proxySettings;\n this.streamResponseStatusCodes = options.streamResponseStatusCodes;\n this.withCredentials = options.withCredentials ?? false;\n this.abortSignal = options.abortSignal;\n this.onUploadProgress = options.onUploadProgress;\n this.onDownloadProgress = options.onDownloadProgress;\n this.requestId = options.requestId || randomUUID();\n this.allowInsecureConnection = options.allowInsecureConnection ?? false;\n this.enableBrowserStreams = options.enableBrowserStreams ?? false;\n }\n}\n\n/**\n * Creates a new pipeline request with the given options.\n * This method is to allow for the easy setting of default values and not required.\n * @param options - The options to create the request with.\n */\nexport function createPipelineRequest(options: PipelineRequestOptions): PipelineRequest {\n return new PipelineRequestImpl(options);\n}\n"]}
@@ -0,0 +1,11 @@
1
+ import type { PipelinePolicy } from "../pipeline.js";
2
+ import type { Agent } from "../interfaces.js";
3
+ /**
4
+ * Name of the Agent Policy
5
+ */
6
+ export declare const agentPolicyName = "agentPolicy";
7
+ /**
8
+ * Gets a pipeline policy that sets http.agent
9
+ */
10
+ export declare function agentPolicy(agent?: Agent): PipelinePolicy;
11
+ //# sourceMappingURL=agentPolicy.d.ts.map
@@ -0,0 +1,22 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ /**
4
+ * Name of the Agent Policy
5
+ */
6
+ export const agentPolicyName = "agentPolicy";
7
+ /**
8
+ * Gets a pipeline policy that sets http.agent
9
+ */
10
+ export function agentPolicy(agent) {
11
+ return {
12
+ name: agentPolicyName,
13
+ sendRequest: async (req, next) => {
14
+ // Users may define an agent on the request, honor it over the client level one
15
+ if (!req.agent) {
16
+ req.agent = agent;
17
+ }
18
+ return next(req);
19
+ },
20
+ };
21
+ }
22
+ //# sourceMappingURL=agentPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentPolicy.js","sourceRoot":"","sources":["../../../src/policies/agentPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAKlC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC;AAE7C;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YAC/B,+EAA+E;YAC/E,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;gBACf,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC;YACpB,CAAC;YACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport type { Agent } from \"../interfaces.js\";\n\n/**\n * Name of the Agent Policy\n */\nexport const agentPolicyName = \"agentPolicy\";\n\n/**\n * Gets a pipeline policy that sets http.agent\n */\nexport function agentPolicy(agent?: Agent): PipelinePolicy {\n return {\n name: agentPolicyName,\n sendRequest: async (req, next) => {\n // Users may define an agent on the request, honor it over the client level one\n if (!req.agent) {\n req.agent = agent;\n }\n return next(req);\n },\n };\n}\n"]}
@@ -0,0 +1,30 @@
1
+ import type { ApiKeyCredential } from "../../auth/credentials.js";
2
+ import type { AuthScheme } from "../../auth/schemes.js";
3
+ import type { PipelinePolicy } from "../../pipeline.js";
4
+ /**
5
+ * Name of the API Key Authentication Policy
6
+ */
7
+ export declare const apiKeyAuthenticationPolicyName = "apiKeyAuthenticationPolicy";
8
+ /**
9
+ * Options for configuring the API key authentication policy
10
+ */
11
+ export interface ApiKeyAuthenticationPolicyOptions {
12
+ /**
13
+ * The credential used to authenticate requests
14
+ */
15
+ credential: ApiKeyCredential;
16
+ /**
17
+ * Optional authentication schemes to use. If `authSchemes` is provided in both request and policy options, the request options will take precedence.
18
+ */
19
+ authSchemes?: AuthScheme[];
20
+ /**
21
+ * Allows for connecting to HTTP endpoints instead of enforcing HTTPS.
22
+ * CAUTION: Never use this option in production.
23
+ */
24
+ allowInsecureConnection?: boolean;
25
+ }
26
+ /**
27
+ * Gets a pipeline policy that adds API key authentication to requests
28
+ */
29
+ export declare function apiKeyAuthenticationPolicy(options: ApiKeyAuthenticationPolicyOptions): PipelinePolicy;
30
+ //# sourceMappingURL=apiKeyAuthenticationPolicy.d.ts.map
@@ -0,0 +1,31 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { ensureSecureConnection } from "./checkInsecureConnection.js";
4
+ /**
5
+ * Name of the API Key Authentication Policy
6
+ */
7
+ export const apiKeyAuthenticationPolicyName = "apiKeyAuthenticationPolicy";
8
+ /**
9
+ * Gets a pipeline policy that adds API key authentication to requests
10
+ */
11
+ export function apiKeyAuthenticationPolicy(options) {
12
+ return {
13
+ name: apiKeyAuthenticationPolicyName,
14
+ async sendRequest(request, next) {
15
+ var _a, _b;
16
+ // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs
17
+ ensureSecureConnection(request, options);
18
+ const scheme = (_b = ((_a = request.authSchemes) !== null && _a !== void 0 ? _a : options.authSchemes)) === null || _b === void 0 ? void 0 : _b.find((x) => x.kind === "apiKey");
19
+ // Skip adding authentication header if no API key authentication scheme is found
20
+ if (!scheme) {
21
+ return next(request);
22
+ }
23
+ if (scheme.apiKeyLocation !== "header") {
24
+ throw new Error(`Unsupported API key location: ${scheme.apiKeyLocation}`);
25
+ }
26
+ request.headers.set(scheme.name, options.credential.key);
27
+ return next(request);
28
+ },
29
+ };
30
+ }
31
+ //# sourceMappingURL=apiKeyAuthenticationPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apiKeyAuthenticationPolicy.js","sourceRoot":"","sources":["../../../../src/policies/auth/apiKeyAuthenticationPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,4BAA4B,CAAC;AAqB3E;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAA0C;IAE1C,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;;YAC3D,0FAA0F;YAC1F,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAEzC,MAAM,MAAM,GAAG,MAAA,CAAC,MAAA,OAAO,CAAC,WAAW,mCAAI,OAAO,CAAC,WAAW,CAAC,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;YAE9F,iFAAiF;YACjF,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;YACD,IAAI,MAAM,CAAC,cAAc,KAAK,QAAQ,EAAE,CAAC;gBACvC,MAAM,IAAI,KAAK,CAAC,iCAAiC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC;YAC5E,CAAC;YAED,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YACzD,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 { ApiKeyCredential } from \"../../auth/credentials.js\";\nimport type { AuthScheme } from \"../../auth/schemes.js\";\nimport type { PipelineRequest, PipelineResponse, SendRequest } from \"../../interfaces.js\";\nimport type { PipelinePolicy } from \"../../pipeline.js\";\nimport { ensureSecureConnection } from \"./checkInsecureConnection.js\";\n\n/**\n * Name of the API Key Authentication Policy\n */\nexport const apiKeyAuthenticationPolicyName = \"apiKeyAuthenticationPolicy\";\n\n/**\n * Options for configuring the API key authentication policy\n */\nexport interface ApiKeyAuthenticationPolicyOptions {\n /**\n * The credential used to authenticate requests\n */\n credential: ApiKeyCredential;\n /**\n * Optional authentication schemes to use. If `authSchemes` is provided in both request and policy options, the request options will take precedence.\n */\n authSchemes?: AuthScheme[];\n /**\n * Allows for connecting to HTTP endpoints instead of enforcing HTTPS.\n * CAUTION: Never use this option in production.\n */\n allowInsecureConnection?: boolean;\n}\n\n/**\n * Gets a pipeline policy that adds API key authentication to requests\n */\nexport function apiKeyAuthenticationPolicy(\n options: ApiKeyAuthenticationPolicyOptions,\n): PipelinePolicy {\n return {\n name: apiKeyAuthenticationPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs\n ensureSecureConnection(request, options);\n\n const scheme = (request.authSchemes ?? options.authSchemes)?.find((x) => x.kind === \"apiKey\");\n\n // Skip adding authentication header if no API key authentication scheme is found\n if (!scheme) {\n return next(request);\n }\n if (scheme.apiKeyLocation !== \"header\") {\n throw new Error(`Unsupported API key location: ${scheme.apiKeyLocation}`);\n }\n\n request.headers.set(scheme.name, options.credential.key);\n return next(request);\n },\n };\n}\n"]}
@@ -0,0 +1,30 @@
1
+ import type { BasicCredential } from "../../auth/credentials.js";
2
+ import type { AuthScheme } from "../../auth/schemes.js";
3
+ import type { PipelinePolicy } from "../../pipeline.js";
4
+ /**
5
+ * Name of the Basic Authentication Policy
6
+ */
7
+ export declare const basicAuthenticationPolicyName = "bearerAuthenticationPolicy";
8
+ /**
9
+ * Options for configuring the basic authentication policy
10
+ */
11
+ export interface BasicAuthenticationPolicyOptions {
12
+ /**
13
+ * The credential used to authenticate requests
14
+ */
15
+ credential: BasicCredential;
16
+ /**
17
+ * Optional authentication schemes to use. If not provided, schemes from the request will be used.
18
+ */
19
+ authSchemes?: AuthScheme[];
20
+ /**
21
+ * Allows for connecting to HTTP endpoints instead of enforcing HTTPS.
22
+ * CAUTION: Never use this option in production.
23
+ */
24
+ allowInsecureConnection?: boolean;
25
+ }
26
+ /**
27
+ * Gets a pipeline policy that adds basic authentication to requests
28
+ */
29
+ export declare function basicAuthenticationPolicy(options: BasicAuthenticationPolicyOptions): PipelinePolicy;
30
+ //# sourceMappingURL=basicAuthenticationPolicy.d.ts.map
@@ -0,0 +1,31 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { stringToUint8Array, uint8ArrayToString } from "../../util/bytesEncoding.js";
4
+ import { ensureSecureConnection } from "./checkInsecureConnection.js";
5
+ /**
6
+ * Name of the Basic Authentication Policy
7
+ */
8
+ export const basicAuthenticationPolicyName = "bearerAuthenticationPolicy";
9
+ /**
10
+ * Gets a pipeline policy that adds basic authentication to requests
11
+ */
12
+ export function basicAuthenticationPolicy(options) {
13
+ return {
14
+ name: basicAuthenticationPolicyName,
15
+ async sendRequest(request, next) {
16
+ var _a, _b;
17
+ // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs
18
+ ensureSecureConnection(request, options);
19
+ const scheme = (_b = ((_a = request.authSchemes) !== null && _a !== void 0 ? _a : options.authSchemes)) === null || _b === void 0 ? void 0 : _b.find((x) => x.kind === "http" && x.scheme === "basic");
20
+ // Skip adding authentication header if no basic authentication scheme is found
21
+ if (!scheme) {
22
+ return next(request);
23
+ }
24
+ const { username, password } = options.credential;
25
+ const headerValue = uint8ArrayToString(stringToUint8Array(`${username}:${password}`, "utf-8"), "base64");
26
+ request.headers.set("Authorization", `Basic ${headerValue}`);
27
+ return next(request);
28
+ },
29
+ };
30
+ }
31
+ //# sourceMappingURL=basicAuthenticationPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"basicAuthenticationPolicy.js","sourceRoot":"","sources":["../../../../src/policies/auth/basicAuthenticationPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,4BAA4B,CAAC;AAqB1E;;GAEG;AACH,MAAM,UAAU,yBAAyB,CACvC,OAAyC;IAEzC,OAAO;QACL,IAAI,EAAE,6BAA6B;QACnC,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;;YAC3D,0FAA0F;YAC1F,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAEzC,MAAM,MAAM,GAAG,MAAA,CAAC,MAAA,OAAO,CAAC,WAAW,mCAAI,OAAO,CAAC,WAAW,CAAC,0CAAE,IAAI,CAC/D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,OAAO,CACjD,CAAC;YAEF,+EAA+E;YAC/E,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;YAED,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAClD,MAAM,WAAW,GAAG,kBAAkB,CACpC,kBAAkB,CAAC,GAAG,QAAQ,IAAI,QAAQ,EAAE,EAAE,OAAO,CAAC,EACtD,QAAQ,CACT,CAAC;YACF,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,SAAS,WAAW,EAAE,CAAC,CAAC;YAC7D,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 { BasicCredential } from \"../../auth/credentials.js\";\nimport type { AuthScheme } from \"../../auth/schemes.js\";\nimport type { PipelineRequest, PipelineResponse, SendRequest } from \"../../interfaces.js\";\nimport type { PipelinePolicy } from \"../../pipeline.js\";\nimport { stringToUint8Array, uint8ArrayToString } from \"../../util/bytesEncoding.js\";\nimport { ensureSecureConnection } from \"./checkInsecureConnection.js\";\n\n/**\n * Name of the Basic Authentication Policy\n */\nexport const basicAuthenticationPolicyName = \"bearerAuthenticationPolicy\";\n\n/**\n * Options for configuring the basic authentication policy\n */\nexport interface BasicAuthenticationPolicyOptions {\n /**\n * The credential used to authenticate requests\n */\n credential: BasicCredential;\n /**\n * Optional authentication schemes to use. If not provided, schemes from the request will be used.\n */\n authSchemes?: AuthScheme[];\n /**\n * Allows for connecting to HTTP endpoints instead of enforcing HTTPS.\n * CAUTION: Never use this option in production.\n */\n allowInsecureConnection?: boolean;\n}\n\n/**\n * Gets a pipeline policy that adds basic authentication to requests\n */\nexport function basicAuthenticationPolicy(\n options: BasicAuthenticationPolicyOptions,\n): PipelinePolicy {\n return {\n name: basicAuthenticationPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs\n ensureSecureConnection(request, options);\n\n const scheme = (request.authSchemes ?? options.authSchemes)?.find(\n (x) => x.kind === \"http\" && x.scheme === \"basic\",\n );\n\n // Skip adding authentication header if no basic authentication scheme is found\n if (!scheme) {\n return next(request);\n }\n\n const { username, password } = options.credential;\n const headerValue = uint8ArrayToString(\n stringToUint8Array(`${username}:${password}`, \"utf-8\"),\n \"base64\",\n );\n request.headers.set(\"Authorization\", `Basic ${headerValue}`);\n return next(request);\n },\n };\n}\n"]}
@@ -0,0 +1,30 @@
1
+ import type { BearerTokenCredential } from "../../auth/credentials.js";
2
+ import type { AuthScheme } from "../../auth/schemes.js";
3
+ import type { PipelinePolicy } from "../../pipeline.js";
4
+ /**
5
+ * Name of the Bearer Authentication Policy
6
+ */
7
+ export declare const bearerAuthenticationPolicyName = "bearerAuthenticationPolicy";
8
+ /**
9
+ * Options for configuring the bearer authentication policy
10
+ */
11
+ export interface BearerAuthenticationPolicyOptions {
12
+ /**
13
+ * The BearerTokenCredential implementation that can supply the bearer token.
14
+ */
15
+ credential: BearerTokenCredential;
16
+ /**
17
+ * Optional authentication schemes to use. If not provided, schemes from the request will be used.
18
+ */
19
+ authSchemes?: AuthScheme[];
20
+ /**
21
+ * Allows for connecting to HTTP endpoints instead of enforcing HTTPS.
22
+ * CAUTION: Never use this option in production.
23
+ */
24
+ allowInsecureConnection?: boolean;
25
+ }
26
+ /**
27
+ * Gets a pipeline policy that adds bearer token authentication to requests
28
+ */
29
+ export declare function bearerAuthenticationPolicy(options: BearerAuthenticationPolicyOptions): PipelinePolicy;
30
+ //# sourceMappingURL=bearerAuthenticationPolicy.d.ts.map
@@ -0,0 +1,31 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { ensureSecureConnection } from "./checkInsecureConnection.js";
4
+ /**
5
+ * Name of the Bearer Authentication Policy
6
+ */
7
+ export const bearerAuthenticationPolicyName = "bearerAuthenticationPolicy";
8
+ /**
9
+ * Gets a pipeline policy that adds bearer token authentication to requests
10
+ */
11
+ export function bearerAuthenticationPolicy(options) {
12
+ return {
13
+ name: bearerAuthenticationPolicyName,
14
+ async sendRequest(request, next) {
15
+ var _a, _b;
16
+ // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs
17
+ ensureSecureConnection(request, options);
18
+ const scheme = (_b = ((_a = request.authSchemes) !== null && _a !== void 0 ? _a : options.authSchemes)) === null || _b === void 0 ? void 0 : _b.find((x) => x.kind === "http" && x.scheme === "bearer");
19
+ // Skip adding authentication header if no bearer authentication scheme is found
20
+ if (!scheme) {
21
+ return next(request);
22
+ }
23
+ const token = await options.credential.getBearerToken({
24
+ abortSignal: request.abortSignal,
25
+ });
26
+ request.headers.set("Authorization", `Bearer ${token}`);
27
+ return next(request);
28
+ },
29
+ };
30
+ }
31
+ //# sourceMappingURL=bearerAuthenticationPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bearerAuthenticationPolicy.js","sourceRoot":"","sources":["../../../../src/policies/auth/bearerAuthenticationPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAMlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,4BAA4B,CAAC;AAqB3E;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAA0C;IAE1C,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;;YAC3D,0FAA0F;YAC1F,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAEzC,MAAM,MAAM,GAAG,MAAA,CAAC,MAAA,OAAO,CAAC,WAAW,mCAAI,OAAO,CAAC,WAAW,CAAC,0CAAE,IAAI,CAC/D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,QAAQ,CAClD,CAAC;YAEF,gFAAgF;YAChF,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;YAED,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC;gBACpD,WAAW,EAAE,OAAO,CAAC,WAAW;aACjC,CAAC,CAAC;YACH,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,KAAK,EAAE,CAAC,CAAC;YACxD,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 { BearerTokenCredential } from \"../../auth/credentials.js\";\nimport type { AuthScheme } from \"../../auth/schemes.js\";\nimport type { PipelineRequest, PipelineResponse, SendRequest } from \"../../interfaces.js\";\nimport type { PipelinePolicy } from \"../../pipeline.js\";\nimport { ensureSecureConnection } from \"./checkInsecureConnection.js\";\n\n/**\n * Name of the Bearer Authentication Policy\n */\nexport const bearerAuthenticationPolicyName = \"bearerAuthenticationPolicy\";\n\n/**\n * Options for configuring the bearer authentication policy\n */\nexport interface BearerAuthenticationPolicyOptions {\n /**\n * The BearerTokenCredential implementation that can supply the bearer token.\n */\n credential: BearerTokenCredential;\n /**\n * Optional authentication schemes to use. If not provided, schemes from the request will be used.\n */\n authSchemes?: AuthScheme[];\n /**\n * Allows for connecting to HTTP endpoints instead of enforcing HTTPS.\n * CAUTION: Never use this option in production.\n */\n allowInsecureConnection?: boolean;\n}\n\n/**\n * Gets a pipeline policy that adds bearer token authentication to requests\n */\nexport function bearerAuthenticationPolicy(\n options: BearerAuthenticationPolicyOptions,\n): PipelinePolicy {\n return {\n name: bearerAuthenticationPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs\n ensureSecureConnection(request, options);\n\n const scheme = (request.authSchemes ?? options.authSchemes)?.find(\n (x) => x.kind === \"http\" && x.scheme === \"bearer\",\n );\n\n // Skip adding authentication header if no bearer authentication scheme is found\n if (!scheme) {\n return next(request);\n }\n\n const token = await options.credential.getBearerToken({\n abortSignal: request.abortSignal,\n });\n request.headers.set(\"Authorization\", `Bearer ${token}`);\n return next(request);\n },\n };\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type { PipelineRequest } from "../../interfaces.js";
2
+ /**
3
+ * Ensures that authentication is only allowed over HTTPS unless explicitly allowed.
4
+ * Throws an error if the connection is not secure and not explicitly allowed.
5
+ */
6
+ export declare function ensureSecureConnection(request: PipelineRequest, options: {
7
+ allowInsecureConnection?: boolean;
8
+ }): void;
9
+ //# sourceMappingURL=checkInsecureConnection.d.ts.map
@@ -0,0 +1,50 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { logger } from "../../log.js";
4
+ // Ensure the warining is only emitted once
5
+ let insecureConnectionWarningEmmitted = false;
6
+ /**
7
+ * Checks if the request is allowed to be sent over an insecure connection.
8
+ *
9
+ * A request is allowed to be sent over an insecure connection when:
10
+ * - The `allowInsecureConnection` option is set to `true`.
11
+ * - The request has the `allowInsecureConnection` property set to `true`.
12
+ * - The request is being sent to `localhost` or `127.0.0.1`
13
+ */
14
+ function allowInsecureConnection(request, options) {
15
+ if (options.allowInsecureConnection && request.allowInsecureConnection) {
16
+ const url = new URL(request.url);
17
+ if (url.hostname === "localhost" || url.hostname === "127.0.0.1") {
18
+ return true;
19
+ }
20
+ }
21
+ return false;
22
+ }
23
+ /**
24
+ * Logs a warning about sending a bearer token over an insecure connection.
25
+ *
26
+ * This function will emit a node warning once, but log the warning every time.
27
+ */
28
+ function emitInsecureConnectionWarning() {
29
+ const warning = "Sending bearer token over insecure transport. Assume any token issued is compromised.";
30
+ logger.warning(warning);
31
+ if (typeof (process === null || process === void 0 ? void 0 : process.emitWarning) === "function" && !insecureConnectionWarningEmmitted) {
32
+ insecureConnectionWarningEmmitted = true;
33
+ process.emitWarning(warning);
34
+ }
35
+ }
36
+ /**
37
+ * Ensures that authentication is only allowed over HTTPS unless explicitly allowed.
38
+ * Throws an error if the connection is not secure and not explicitly allowed.
39
+ */
40
+ export function ensureSecureConnection(request, options) {
41
+ if (!request.url.toLowerCase().startsWith("https://")) {
42
+ if (allowInsecureConnection(request, options)) {
43
+ emitInsecureConnectionWarning();
44
+ }
45
+ else {
46
+ throw new Error("Authentication is not permitted for non-TLS protected (non-https) URLs when allowInsecureConnection is false.");
47
+ }
48
+ }
49
+ }
50
+ //# sourceMappingURL=checkInsecureConnection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkInsecureConnection.js","sourceRoot":"","sources":["../../../../src/policies/auth/checkInsecureConnection.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,2CAA2C;AAC3C,IAAI,iCAAiC,GAAG,KAAK,CAAC;AAE9C;;;;;;;GAOG;AACH,SAAS,uBAAuB,CAC9B,OAAwB,EACxB,OAA8C;IAE9C,IAAI,OAAO,CAAC,uBAAuB,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC;QACvE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,GAAG,CAAC,QAAQ,KAAK,WAAW,IAAI,GAAG,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;YACjE,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,SAAS,6BAA6B;IACpC,MAAM,OAAO,GACX,uFAAuF,CAAC;IAE1F,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAExB,IAAI,OAAO,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,CAAA,KAAK,UAAU,IAAI,CAAC,iCAAiC,EAAE,CAAC;QACrF,iCAAiC,GAAG,IAAI,CAAC;QACzC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAwB,EACxB,OAA8C;IAE9C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QACtD,IAAI,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;YAC9C,6BAA6B,EAAE,CAAC;QAClC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CACb,+GAA+G,CAChH,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest } from \"../../interfaces.js\";\nimport { logger } from \"../../log.js\";\n\n// Ensure the warining is only emitted once\nlet insecureConnectionWarningEmmitted = false;\n\n/**\n * Checks if the request is allowed to be sent over an insecure connection.\n *\n * A request is allowed to be sent over an insecure connection when:\n * - The `allowInsecureConnection` option is set to `true`.\n * - The request has the `allowInsecureConnection` property set to `true`.\n * - The request is being sent to `localhost` or `127.0.0.1`\n */\nfunction allowInsecureConnection(\n request: PipelineRequest,\n options: { allowInsecureConnection?: boolean },\n): boolean {\n if (options.allowInsecureConnection && request.allowInsecureConnection) {\n const url = new URL(request.url);\n if (url.hostname === \"localhost\" || url.hostname === \"127.0.0.1\") {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Logs a warning about sending a bearer token over an insecure connection.\n *\n * This function will emit a node warning once, but log the warning every time.\n */\nfunction emitInsecureConnectionWarning(): void {\n const warning =\n \"Sending bearer token over insecure transport. Assume any token issued is compromised.\";\n\n logger.warning(warning);\n\n if (typeof process?.emitWarning === \"function\" && !insecureConnectionWarningEmmitted) {\n insecureConnectionWarningEmmitted = true;\n process.emitWarning(warning);\n }\n}\n\n/**\n * Ensures that authentication is only allowed over HTTPS unless explicitly allowed.\n * Throws an error if the connection is not secure and not explicitly allowed.\n */\nexport function ensureSecureConnection(\n request: PipelineRequest,\n options: { allowInsecureConnection?: boolean },\n): void {\n if (!request.url.toLowerCase().startsWith(\"https://\")) {\n if (allowInsecureConnection(request, options)) {\n emitInsecureConnectionWarning();\n } else {\n throw new Error(\n \"Authentication is not permitted for non-TLS protected (non-https) URLs when allowInsecureConnection is false.\",\n );\n }\n }\n}\n"]}
@@ -0,0 +1,31 @@
1
+ import type { OAuth2Flow } from "../../auth/oauth2Flows.js";
2
+ import type { OAuth2TokenCredential } from "../../auth/credentials.js";
3
+ import type { AuthScheme } from "../../auth/schemes.js";
4
+ import type { PipelinePolicy } from "../../pipeline.js";
5
+ /**
6
+ * Name of the OAuth2 Authentication Policy
7
+ */
8
+ export declare const oauth2AuthenticationPolicyName = "oauth2AuthenticationPolicy";
9
+ /**
10
+ * Options for configuring the OAuth2 authentication policy
11
+ */
12
+ export interface OAuth2AuthenticationPolicyOptions<TFlows extends OAuth2Flow> {
13
+ /**
14
+ * The OAuth2TokenCredential implementation that can supply the bearer token.
15
+ */
16
+ credential: OAuth2TokenCredential<TFlows>;
17
+ /**
18
+ * Optional authentication schemes to use. If not provided, schemes from the request will be used.
19
+ */
20
+ authSchemes?: AuthScheme[];
21
+ /**
22
+ * Allows for connecting to HTTP endpoints instead of enforcing HTTPS.
23
+ * CAUTION: Never use this option in production.
24
+ */
25
+ allowInsecureConnection?: boolean;
26
+ }
27
+ /**
28
+ * Gets a pipeline policy that adds authorization header from OAuth2 schemes
29
+ */
30
+ export declare function oauth2AuthenticationPolicy<TFlows extends OAuth2Flow>(options: OAuth2AuthenticationPolicyOptions<TFlows>): PipelinePolicy;
31
+ //# sourceMappingURL=oauth2AuthenticationPolicy.d.ts.map
@@ -0,0 +1,31 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { ensureSecureConnection } from "./checkInsecureConnection.js";
4
+ /**
5
+ * Name of the OAuth2 Authentication Policy
6
+ */
7
+ export const oauth2AuthenticationPolicyName = "oauth2AuthenticationPolicy";
8
+ /**
9
+ * Gets a pipeline policy that adds authorization header from OAuth2 schemes
10
+ */
11
+ export function oauth2AuthenticationPolicy(options) {
12
+ return {
13
+ name: oauth2AuthenticationPolicyName,
14
+ async sendRequest(request, next) {
15
+ var _a, _b;
16
+ // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs
17
+ ensureSecureConnection(request, options);
18
+ const scheme = (_b = ((_a = request.authSchemes) !== null && _a !== void 0 ? _a : options.authSchemes)) === null || _b === void 0 ? void 0 : _b.find((x) => x.kind === "oauth2");
19
+ // Skip adding authentication header if no OAuth2 authentication scheme is found
20
+ if (!scheme) {
21
+ return next(request);
22
+ }
23
+ const token = await options.credential.getOAuth2Token(scheme.flows, {
24
+ abortSignal: request.abortSignal,
25
+ });
26
+ request.headers.set("Authorization", `Bearer ${token}`);
27
+ return next(request);
28
+ },
29
+ };
30
+ }
31
+ //# sourceMappingURL=oauth2AuthenticationPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth2AuthenticationPolicy.js","sourceRoot":"","sources":["../../../../src/policies/auth/oauth2AuthenticationPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAOlC,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,4BAA4B,CAAC;AAqB3E;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAkD;IAElD,OAAO;QACL,IAAI,EAAE,8BAA8B;QACpC,KAAK,CAAC,WAAW,CAAC,OAAwB,EAAE,IAAiB;;YAC3D,0FAA0F;YAC1F,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAEzC,MAAM,MAAM,GAAG,MAAA,CAAC,MAAA,OAAO,CAAC,WAAW,mCAAI,OAAO,CAAC,WAAW,CAAC,0CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;YAE9F,gFAAgF;YAChF,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;YACD,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,KAAiB,EAAE;gBAC9E,WAAW,EAAE,OAAO,CAAC,WAAW;aACjC,CAAC,CAAC;YACH,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,KAAK,EAAE,CAAC,CAAC;YACxD,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 { OAuth2Flow } from \"../../auth/oauth2Flows.js\";\nimport type { OAuth2TokenCredential } from \"../../auth/credentials.js\";\nimport type { AuthScheme } from \"../../auth/schemes.js\";\nimport type { PipelineRequest, PipelineResponse, SendRequest } from \"../../interfaces.js\";\nimport type { PipelinePolicy } from \"../../pipeline.js\";\nimport { ensureSecureConnection } from \"./checkInsecureConnection.js\";\n\n/**\n * Name of the OAuth2 Authentication Policy\n */\nexport const oauth2AuthenticationPolicyName = \"oauth2AuthenticationPolicy\";\n\n/**\n * Options for configuring the OAuth2 authentication policy\n */\nexport interface OAuth2AuthenticationPolicyOptions<TFlows extends OAuth2Flow> {\n /**\n * The OAuth2TokenCredential implementation that can supply the bearer token.\n */\n credential: OAuth2TokenCredential<TFlows>;\n /**\n * Optional authentication schemes to use. If not provided, schemes from the request will be used.\n */\n authSchemes?: AuthScheme[];\n /**\n * Allows for connecting to HTTP endpoints instead of enforcing HTTPS.\n * CAUTION: Never use this option in production.\n */\n allowInsecureConnection?: boolean;\n}\n\n/**\n * Gets a pipeline policy that adds authorization header from OAuth2 schemes\n */\nexport function oauth2AuthenticationPolicy<TFlows extends OAuth2Flow>(\n options: OAuth2AuthenticationPolicyOptions<TFlows>,\n): PipelinePolicy {\n return {\n name: oauth2AuthenticationPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n // Ensure allowInsecureConnection is explicitly set when sending request to non-https URLs\n ensureSecureConnection(request, options);\n\n const scheme = (request.authSchemes ?? options.authSchemes)?.find((x) => x.kind === \"oauth2\");\n\n // Skip adding authentication header if no OAuth2 authentication scheme is found\n if (!scheme) {\n return next(request);\n }\n const token = await options.credential.getOAuth2Token(scheme.flows as TFlows[], {\n abortSignal: request.abortSignal,\n });\n request.headers.set(\"Authorization\", `Bearer ${token}`);\n return next(request);\n },\n };\n}\n"]}
@@ -21,7 +21,6 @@ export function retryPolicy(strategies, options = { maxRetries: DEFAULT_RETRY_PO
21
21
  let response;
22
22
  let responseError;
23
23
  let retryCount = -1;
24
- // eslint-disable-next-line no-constant-condition
25
24
  retryRequest: while (true) {
26
25
  retryCount += 1;
27
26
  response = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"retryPolicy.js","sourceRoot":"","sources":["../../../src/policies/retryPolicy.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest, PipelineResponse, SendRequest } from \"../interfaces.js\";\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport { delay } from \"../util/helpers.js\";\nimport type { RetryStrategy } from \"../retryStrategies/retryStrategy.js\";\nimport type { RestError } from \"../restError.js\";\nimport { AbortError } from \"../abort-controller/AbortError.js\";\nimport type { TypeSpecRuntimeLogger } from \"../logger/logger.js\";\nimport { createClientLogger } from \"../logger/logger.js\";\nimport { DEFAULT_RETRY_POLICY_COUNT } from \"../constants.js\";\n\nconst retryPolicyLogger = createClientLogger(\"core-rest-pipeline retryPolicy\");\n\n/**\n * The programmatic identifier of the retryPolicy.\n */\nconst retryPolicyName = \"retryPolicy\";\n\n/**\n * Options to the {@link retryPolicy}\n */\nexport interface RetryPolicyOptions {\n /**\n * Maximum number of retries. If not specified, it will limit to 3 retries.\n */\n maxRetries?: number;\n /**\n * Logger. If it's not provided, a default logger is used.\n */\n logger?: TypeSpecRuntimeLogger;\n}\n\n/**\n * retryPolicy is a generic policy to enable retrying requests when certain conditions are met\n */\nexport function retryPolicy(\n strategies: RetryStrategy[],\n options: RetryPolicyOptions = { maxRetries: DEFAULT_RETRY_POLICY_COUNT },\n): PipelinePolicy {\n const logger = options.logger || retryPolicyLogger;\n return {\n name: retryPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n let response: PipelineResponse | undefined;\n let responseError: RestError | undefined;\n let retryCount = -1;\n\n // eslint-disable-next-line no-constant-condition\n retryRequest: while (true) {\n retryCount += 1;\n response = undefined;\n responseError = undefined;\n\n try {\n logger.info(`Retry ${retryCount}: Attempting to send request`, request.requestId);\n response = await next(request);\n logger.info(`Retry ${retryCount}: Received a response from request`, request.requestId);\n } catch (e: any) {\n logger.error(`Retry ${retryCount}: Received an error from request`, request.requestId);\n\n // RestErrors are valid targets for the retry strategies.\n // If none of the retry strategies can work with them, they will be thrown later in this policy.\n // If the received error is not a RestError, it is immediately thrown.\n responseError = e as RestError;\n if (!e || responseError.name !== \"RestError\") {\n throw e;\n }\n\n response = responseError.response;\n }\n\n if (request.abortSignal?.aborted) {\n logger.error(`Retry ${retryCount}: Request aborted.`);\n const abortError = new AbortError();\n throw abortError;\n }\n\n if (retryCount >= (options.maxRetries ?? DEFAULT_RETRY_POLICY_COUNT)) {\n logger.info(\n `Retry ${retryCount}: Maximum retries reached. Returning the last received response, or throwing the last received error.`,\n );\n if (responseError) {\n throw responseError;\n } else if (response) {\n return response;\n } else {\n throw new Error(\"Maximum retries reached with no response or error to throw\");\n }\n }\n\n logger.info(`Retry ${retryCount}: Processing ${strategies.length} retry strategies.`);\n\n strategiesLoop: for (const strategy of strategies) {\n const strategyLogger = strategy.logger || retryPolicyLogger;\n strategyLogger.info(`Retry ${retryCount}: Processing retry strategy ${strategy.name}.`);\n\n const modifiers = strategy.retry({\n retryCount,\n response,\n responseError,\n });\n\n if (modifiers.skipStrategy) {\n strategyLogger.info(`Retry ${retryCount}: Skipped.`);\n continue strategiesLoop;\n }\n\n const { errorToThrow, retryAfterInMs, redirectTo } = modifiers;\n\n if (errorToThrow) {\n strategyLogger.error(\n `Retry ${retryCount}: Retry strategy ${strategy.name} throws error:`,\n errorToThrow,\n );\n throw errorToThrow;\n }\n\n if (retryAfterInMs || retryAfterInMs === 0) {\n strategyLogger.info(\n `Retry ${retryCount}: Retry strategy ${strategy.name} retries after ${retryAfterInMs}`,\n );\n await delay(retryAfterInMs, undefined, { abortSignal: request.abortSignal });\n continue retryRequest;\n }\n\n if (redirectTo) {\n strategyLogger.info(\n `Retry ${retryCount}: Retry strategy ${strategy.name} redirects to ${redirectTo}`,\n );\n request.url = redirectTo;\n continue retryRequest;\n }\n }\n\n if (responseError) {\n logger.info(\n `None of the retry strategies could work with the received error. Throwing it.`,\n );\n throw responseError;\n }\n if (response) {\n logger.info(\n `None of the retry strategies could work with the received response. Returning it.`,\n );\n return response;\n }\n\n // If all the retries skip and there's no response,\n // we're still in the retry loop, so a new request will be sent\n // until `maxRetries` is reached.\n }\n },\n };\n}\n"]}
1
+ {"version":3,"file":"retryPolicy.js","sourceRoot":"","sources":["../../../src/policies/retryPolicy.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelineRequest, PipelineResponse, SendRequest } from \"../interfaces.js\";\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport { delay } from \"../util/helpers.js\";\nimport type { RetryStrategy } from \"../retryStrategies/retryStrategy.js\";\nimport type { RestError } from \"../restError.js\";\nimport { AbortError } from \"../abort-controller/AbortError.js\";\nimport type { TypeSpecRuntimeLogger } from \"../logger/logger.js\";\nimport { createClientLogger } from \"../logger/logger.js\";\nimport { DEFAULT_RETRY_POLICY_COUNT } from \"../constants.js\";\n\nconst retryPolicyLogger = createClientLogger(\"core-rest-pipeline retryPolicy\");\n\n/**\n * The programmatic identifier of the retryPolicy.\n */\nconst retryPolicyName = \"retryPolicy\";\n\n/**\n * Options to the {@link retryPolicy}\n */\nexport interface RetryPolicyOptions {\n /**\n * Maximum number of retries. If not specified, it will limit to 3 retries.\n */\n maxRetries?: number;\n /**\n * Logger. If it's not provided, a default logger is used.\n */\n logger?: TypeSpecRuntimeLogger;\n}\n\n/**\n * retryPolicy is a generic policy to enable retrying requests when certain conditions are met\n */\nexport function retryPolicy(\n strategies: RetryStrategy[],\n options: RetryPolicyOptions = { maxRetries: DEFAULT_RETRY_POLICY_COUNT },\n): PipelinePolicy {\n const logger = options.logger || retryPolicyLogger;\n return {\n name: retryPolicyName,\n async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {\n let response: PipelineResponse | undefined;\n let responseError: RestError | undefined;\n let retryCount = -1;\n\n retryRequest: while (true) {\n retryCount += 1;\n response = undefined;\n responseError = undefined;\n\n try {\n logger.info(`Retry ${retryCount}: Attempting to send request`, request.requestId);\n response = await next(request);\n logger.info(`Retry ${retryCount}: Received a response from request`, request.requestId);\n } catch (e: any) {\n logger.error(`Retry ${retryCount}: Received an error from request`, request.requestId);\n\n // RestErrors are valid targets for the retry strategies.\n // If none of the retry strategies can work with them, they will be thrown later in this policy.\n // If the received error is not a RestError, it is immediately thrown.\n responseError = e as RestError;\n if (!e || responseError.name !== \"RestError\") {\n throw e;\n }\n\n response = responseError.response;\n }\n\n if (request.abortSignal?.aborted) {\n logger.error(`Retry ${retryCount}: Request aborted.`);\n const abortError = new AbortError();\n throw abortError;\n }\n\n if (retryCount >= (options.maxRetries ?? DEFAULT_RETRY_POLICY_COUNT)) {\n logger.info(\n `Retry ${retryCount}: Maximum retries reached. Returning the last received response, or throwing the last received error.`,\n );\n if (responseError) {\n throw responseError;\n } else if (response) {\n return response;\n } else {\n throw new Error(\"Maximum retries reached with no response or error to throw\");\n }\n }\n\n logger.info(`Retry ${retryCount}: Processing ${strategies.length} retry strategies.`);\n\n strategiesLoop: for (const strategy of strategies) {\n const strategyLogger = strategy.logger || retryPolicyLogger;\n strategyLogger.info(`Retry ${retryCount}: Processing retry strategy ${strategy.name}.`);\n\n const modifiers = strategy.retry({\n retryCount,\n response,\n responseError,\n });\n\n if (modifiers.skipStrategy) {\n strategyLogger.info(`Retry ${retryCount}: Skipped.`);\n continue strategiesLoop;\n }\n\n const { errorToThrow, retryAfterInMs, redirectTo } = modifiers;\n\n if (errorToThrow) {\n strategyLogger.error(\n `Retry ${retryCount}: Retry strategy ${strategy.name} throws error:`,\n errorToThrow,\n );\n throw errorToThrow;\n }\n\n if (retryAfterInMs || retryAfterInMs === 0) {\n strategyLogger.info(\n `Retry ${retryCount}: Retry strategy ${strategy.name} retries after ${retryAfterInMs}`,\n );\n await delay(retryAfterInMs, undefined, { abortSignal: request.abortSignal });\n continue retryRequest;\n }\n\n if (redirectTo) {\n strategyLogger.info(\n `Retry ${retryCount}: Retry strategy ${strategy.name} redirects to ${redirectTo}`,\n );\n request.url = redirectTo;\n continue retryRequest;\n }\n }\n\n if (responseError) {\n logger.info(\n `None of the retry strategies could work with the received error. Throwing it.`,\n );\n throw responseError;\n }\n if (response) {\n logger.info(\n `None of the retry strategies could work with the received response. Returning it.`,\n );\n return response;\n }\n\n // If all the retries skip and there's no response,\n // we're still in the retry loop, so a new request will be sent\n // until `maxRetries` is reached.\n }\n },\n };\n}\n"]}
@@ -16,9 +16,9 @@ export interface ThrottlingRetryPolicyOptions {
16
16
  * A policy that retries when the server sends a 429 response with a Retry-After header.
17
17
  *
18
18
  * To learn more, please refer to
19
- * https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-request-limits,
20
- * https://docs.microsoft.com/en-us/azure/azure-subscription-service-limits and
21
- * https://docs.microsoft.com/en-us/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors
19
+ * https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-request-limits,
20
+ * https://learn.microsoft.com/en-us/azure/azure-subscription-service-limits and
21
+ * https://learn.microsoft.com/en-us/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors
22
22
  *
23
23
  * @param options - Options that configure retry logic.
24
24
  */
@@ -11,9 +11,9 @@ export const throttlingRetryPolicyName = "throttlingRetryPolicy";
11
11
  * A policy that retries when the server sends a 429 response with a Retry-After header.
12
12
  *
13
13
  * To learn more, please refer to
14
- * https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-request-limits,
15
- * https://docs.microsoft.com/en-us/azure/azure-subscription-service-limits and
16
- * https://docs.microsoft.com/en-us/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors
14
+ * https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-request-limits,
15
+ * https://learn.microsoft.com/en-us/azure/azure-subscription-service-limits and
16
+ * https://learn.microsoft.com/en-us/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors
17
17
  *
18
18
  * @param options - Options that configure retry logic.
19
19
  */
@@ -1 +1 @@
1
- {"version":3,"file":"throttlingRetryPolicy.js","sourceRoot":"","sources":["../../../src/policies/throttlingRetryPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAE7D;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,uBAAuB,CAAC;AAYjE;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAwC,EAAE;;IAC9E,OAAO;QACL,IAAI,EAAE,yBAAyB;QAC/B,WAAW,EAAE,WAAW,CAAC,CAAC,uBAAuB,EAAE,CAAC,EAAE;YACpD,UAAU,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,0BAA0B;SAC7D,CAAC,CAAC,WAAW;KACf,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport { throttlingRetryStrategy } from \"../retryStrategies/throttlingRetryStrategy.js\";\nimport { retryPolicy } from \"./retryPolicy.js\";\nimport { DEFAULT_RETRY_POLICY_COUNT } from \"../constants.js\";\n\n/**\n * Name of the {@link throttlingRetryPolicy}\n */\nexport const throttlingRetryPolicyName = \"throttlingRetryPolicy\";\n\n/**\n * Options that control how to retry failed requests.\n */\nexport interface ThrottlingRetryPolicyOptions {\n /**\n * The maximum number of retry attempts. Defaults to 3.\n */\n maxRetries?: number;\n}\n\n/**\n * A policy that retries when the server sends a 429 response with a Retry-After header.\n *\n * To learn more, please refer to\n * https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-request-limits,\n * https://docs.microsoft.com/en-us/azure/azure-subscription-service-limits and\n * https://docs.microsoft.com/en-us/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors\n *\n * @param options - Options that configure retry logic.\n */\nexport function throttlingRetryPolicy(options: ThrottlingRetryPolicyOptions = {}): PipelinePolicy {\n return {\n name: throttlingRetryPolicyName,\n sendRequest: retryPolicy([throttlingRetryStrategy()], {\n maxRetries: options.maxRetries ?? DEFAULT_RETRY_POLICY_COUNT,\n }).sendRequest,\n };\n}\n"]}
1
+ {"version":3,"file":"throttlingRetryPolicy.js","sourceRoot":"","sources":["../../../src/policies/throttlingRetryPolicy.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAE7D;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,uBAAuB,CAAC;AAYjE;;;;;;;;;GASG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAAwC,EAAE;;IAC9E,OAAO;QACL,IAAI,EAAE,yBAAyB;QAC/B,WAAW,EAAE,WAAW,CAAC,CAAC,uBAAuB,EAAE,CAAC,EAAE;YACpD,UAAU,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,0BAA0B;SAC7D,CAAC,CAAC,WAAW;KACf,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { PipelinePolicy } from \"../pipeline.js\";\nimport { throttlingRetryStrategy } from \"../retryStrategies/throttlingRetryStrategy.js\";\nimport { retryPolicy } from \"./retryPolicy.js\";\nimport { DEFAULT_RETRY_POLICY_COUNT } from \"../constants.js\";\n\n/**\n * Name of the {@link throttlingRetryPolicy}\n */\nexport const throttlingRetryPolicyName = \"throttlingRetryPolicy\";\n\n/**\n * Options that control how to retry failed requests.\n */\nexport interface ThrottlingRetryPolicyOptions {\n /**\n * The maximum number of retry attempts. Defaults to 3.\n */\n maxRetries?: number;\n}\n\n/**\n * A policy that retries when the server sends a 429 response with a Retry-After header.\n *\n * To learn more, please refer to\n * https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-request-limits,\n * https://learn.microsoft.com/en-us/azure/azure-subscription-service-limits and\n * https://learn.microsoft.com/en-us/azure/virtual-machines/troubleshooting/troubleshooting-throttling-errors\n *\n * @param options - Options that configure retry logic.\n */\nexport function throttlingRetryPolicy(options: ThrottlingRetryPolicyOptions = {}): PipelinePolicy {\n return {\n name: throttlingRetryPolicyName,\n sendRequest: retryPolicy([throttlingRetryStrategy()], {\n maxRetries: options.maxRetries ?? DEFAULT_RETRY_POLICY_COUNT,\n }).sendRequest,\n };\n}\n"]}
@@ -19,16 +19,17 @@ export class RestError extends Error {
19
19
  // JSON.stringify and console.log.
20
20
  Object.defineProperty(this, "request", { value: options.request, enumerable: false });
21
21
  Object.defineProperty(this, "response", { value: options.response, enumerable: false });
22
+ // Logging method for util.inspect in Node
23
+ Object.defineProperty(this, custom, {
24
+ value: () => {
25
+ // Extract non-enumerable properties and add them back. This is OK since in this output the request and
26
+ // response get sanitized.
27
+ return `RestError: ${this.message} \n ${errorSanitizer.sanitize(Object.assign(Object.assign({}, this), { request: this.request, response: this.response }))}`;
28
+ },
29
+ enumerable: false,
30
+ });
22
31
  Object.setPrototypeOf(this, RestError.prototype);
23
32
  }
24
- /**
25
- * Logging method for util.inspect in Node
26
- */
27
- [custom]() {
28
- // Extract non-enumerable properties and add them back. This is OK since in this output the request and
29
- // response get sanitized.
30
- return `RestError: ${this.message} \n ${errorSanitizer.sanitize(Object.assign(Object.assign({}, this), { request: this.request, response: this.response }))}`;
31
- }
32
33
  }
33
34
  /**
34
35
  * Something went wrong when making the request.
@@ -1 +1 @@
1
- {"version":3,"file":"restError.js","sourceRoot":"","sources":["../../src/restError.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,cAAc,GAAG,IAAI,SAAS,EAAE,CAAC;AAwBvC;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAoClC,YAAY,OAAe,EAAE,UAA4B,EAAE;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QAErC,qFAAqF;QACrF,iGAAiG;QACjG,+FAA+F;QAC/F,kCAAkC;QAClC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QACtF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QAExF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC;IAED;;OAEG;IACH,CAAC,MAAM,CAAC;QACN,uGAAuG;QACvG,0BAA0B;QAC1B,OAAO,cAAc,IAAI,CAAC,OAAO,OAAO,cAAc,CAAC,QAAQ,iCAC1D,IAAI,KACP,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IACvB,EAAE,CAAC;IACP,CAAC;;AA9DD;;;;GAIG;AACa,4BAAkB,GAAW,oBAAoB,CAAC;AAClE;;;GAGG;AACa,qBAAW,GAAW,aAAa,CAAC;AAuDtD;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,CAAU;IACpC,IAAI,CAAC,YAAY,SAAS,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC;AAC9C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { isError } from \"./util/error.js\";\nimport type { PipelineRequest, PipelineResponse } from \"./interfaces.js\";\nimport { custom } from \"./util/inspect.js\";\nimport { Sanitizer } from \"./util/sanitizer.js\";\n\nconst errorSanitizer = new Sanitizer();\n\n/**\n * The options supported by RestError.\n */\nexport interface RestErrorOptions {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n */\n response?: PipelineResponse;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport class RestError extends Error {\n /**\n * Something went wrong when making the request.\n * This means the actual request failed for some reason,\n * such as a DNS issue or the connection being lost.\n */\n static readonly REQUEST_SEND_ERROR: string = \"REQUEST_SEND_ERROR\";\n /**\n * This means that parsing the response from the server failed.\n * It may have been malformed.\n */\n static readonly PARSE_ERROR: string = \"PARSE_ERROR\";\n\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n public code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n public statusCode?: number;\n /**\n * The request that was made.\n * This property is non-enumerable.\n */\n public request?: PipelineRequest;\n /**\n * The response received (if any.)\n * This property is non-enumerable.\n */\n public response?: PipelineResponse;\n /**\n * Bonus property set by the throw site.\n */\n public details?: unknown;\n\n constructor(message: string, options: RestErrorOptions = {}) {\n super(message);\n this.name = \"RestError\";\n this.code = options.code;\n this.statusCode = options.statusCode;\n\n // The request and response may contain sensitive information in the headers or body.\n // To help prevent this sensitive information being accidentally logged, the request and response\n // properties are marked as non-enumerable here. This prevents them showing up in the output of\n // JSON.stringify and console.log.\n Object.defineProperty(this, \"request\", { value: options.request, enumerable: false });\n Object.defineProperty(this, \"response\", { value: options.response, enumerable: false });\n\n Object.setPrototypeOf(this, RestError.prototype);\n }\n\n /**\n * Logging method for util.inspect in Node\n */\n [custom](): string {\n // Extract non-enumerable properties and add them back. This is OK since in this output the request and\n // response get sanitized.\n return `RestError: ${this.message} \\n ${errorSanitizer.sanitize({\n ...this,\n request: this.request,\n response: this.response,\n })}`;\n }\n}\n\n/**\n * Typeguard for RestError\n * @param e - Something caught by a catch clause.\n */\nexport function isRestError(e: unknown): e is RestError {\n if (e instanceof RestError) {\n return true;\n }\n return isError(e) && e.name === \"RestError\";\n}\n"]}
1
+ {"version":3,"file":"restError.js","sourceRoot":"","sources":["../../src/restError.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,MAAM,cAAc,GAAG,IAAI,SAAS,EAAE,CAAC;AAwBvC;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAoClC,YAAY,OAAe,EAAE,UAA4B,EAAE;QACzD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QAErC,qFAAqF;QACrF,iGAAiG;QACjG,+FAA+F;QAC/F,kCAAkC;QAClC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QACtF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QAExF,0CAA0C;QAC1C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE;YAClC,KAAK,EAAE,GAAG,EAAE;gBACV,uGAAuG;gBACvG,0BAA0B;gBAC1B,OAAO,cAAc,IAAI,CAAC,OAAO,OAAO,cAAc,CAAC,QAAQ,iCAC1D,IAAI,KACP,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IACvB,EAAE,CAAC;YACP,CAAC;YACD,UAAU,EAAE,KAAK;SAClB,CAAC,CAAC;QAEH,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC;;AA/DD;;;;GAIG;AACa,4BAAkB,GAAW,oBAAoB,CAAC;AAClE;;;GAGG;AACa,qBAAW,GAAW,aAAa,CAAC;AAwDtD;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,CAAU;IACpC,IAAI,CAAC,YAAY,SAAS,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC;AAC9C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { isError } from \"./util/error.js\";\nimport type { PipelineRequest, PipelineResponse } from \"./interfaces.js\";\nimport { custom } from \"./util/inspect.js\";\nimport { Sanitizer } from \"./util/sanitizer.js\";\n\nconst errorSanitizer = new Sanitizer();\n\n/**\n * The options supported by RestError.\n */\nexport interface RestErrorOptions {\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n statusCode?: number;\n /**\n * The request that was made.\n */\n request?: PipelineRequest;\n /**\n * The response received (if any.)\n */\n response?: PipelineResponse;\n}\n\n/**\n * A custom error type for failed pipeline requests.\n */\nexport class RestError extends Error {\n /**\n * Something went wrong when making the request.\n * This means the actual request failed for some reason,\n * such as a DNS issue or the connection being lost.\n */\n static readonly REQUEST_SEND_ERROR: string = \"REQUEST_SEND_ERROR\";\n /**\n * This means that parsing the response from the server failed.\n * It may have been malformed.\n */\n static readonly PARSE_ERROR: string = \"PARSE_ERROR\";\n\n /**\n * The code of the error itself (use statics on RestError if possible.)\n */\n public code?: string;\n /**\n * The HTTP status code of the request (if applicable.)\n */\n public statusCode?: number;\n /**\n * The request that was made.\n * This property is non-enumerable.\n */\n public request?: PipelineRequest;\n /**\n * The response received (if any.)\n * This property is non-enumerable.\n */\n public response?: PipelineResponse;\n /**\n * Bonus property set by the throw site.\n */\n public details?: unknown;\n\n constructor(message: string, options: RestErrorOptions = {}) {\n super(message);\n this.name = \"RestError\";\n this.code = options.code;\n this.statusCode = options.statusCode;\n\n // The request and response may contain sensitive information in the headers or body.\n // To help prevent this sensitive information being accidentally logged, the request and response\n // properties are marked as non-enumerable here. This prevents them showing up in the output of\n // JSON.stringify and console.log.\n Object.defineProperty(this, \"request\", { value: options.request, enumerable: false });\n Object.defineProperty(this, \"response\", { value: options.response, enumerable: false });\n\n // Logging method for util.inspect in Node\n Object.defineProperty(this, custom, {\n value: () => {\n // Extract non-enumerable properties and add them back. This is OK since in this output the request and\n // response get sanitized.\n return `RestError: ${this.message} \\n ${errorSanitizer.sanitize({\n ...this,\n request: this.request,\n response: this.response,\n })}`;\n },\n enumerable: false,\n });\n\n Object.setPrototypeOf(this, RestError.prototype);\n }\n}\n\n/**\n * Typeguard for RestError\n * @param e - Something caught by a catch clause.\n */\nexport function isRestError(e: unknown): e is RestError {\n if (e instanceof RestError) {\n return true;\n }\n return isError(e) && e.name === \"RestError\";\n}\n"]}