@typespec/ts-http-runtime 0.3.5-alpha.20260311.2 → 0.3.6

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 (586) hide show
  1. package/dist/browser/client/clientHelpers.js +1 -1
  2. package/dist/browser/client/clientHelpers.js.map +1 -1
  3. package/dist/browser/client/common.d.ts +3 -2
  4. package/dist/browser/client/common.js.map +1 -1
  5. package/dist/browser/client/getClient.js +1 -1
  6. package/dist/browser/client/getClient.js.map +1 -1
  7. package/dist/browser/client/multipart.js +1 -1
  8. package/dist/browser/client/multipart.js.map +1 -1
  9. package/dist/browser/client/restError.js +5 -4
  10. package/dist/browser/client/restError.js.map +1 -1
  11. package/dist/browser/client/sendRequest.js +25 -14
  12. package/dist/browser/client/sendRequest.js.map +1 -1
  13. package/dist/browser/client/urlHelpers.js +9 -3
  14. package/dist/browser/client/urlHelpers.js.map +1 -1
  15. package/dist/browser/constants.js +1 -1
  16. package/dist/browser/constants.js.map +1 -1
  17. package/dist/browser/createPipelineFromOptions.d.ts +1 -1
  18. package/dist/browser/createPipelineFromOptions.js +2 -21
  19. package/dist/browser/createPipelineFromOptions.js.map +1 -1
  20. package/dist/browser/{defaultHttpClient.d.ts → defaultHttpClient-browser.d.mts} +1 -1
  21. package/dist/browser/{defaultHttpClient.js → defaultHttpClient-browser.mjs} +1 -1
  22. package/dist/browser/defaultHttpClient-browser.mjs.map +1 -0
  23. package/dist/browser/encoding.d.ts +13 -0
  24. package/dist/browser/encoding.js +19 -0
  25. package/dist/browser/encoding.js.map +1 -0
  26. package/dist/{esm/util/checkEnvironment.d.ts → browser/env-browser.d.mts} +21 -1
  27. package/dist/{esm/util/checkEnvironment.js → browser/env-browser.mjs} +26 -12
  28. package/dist/browser/env-browser.mjs.map +1 -0
  29. package/dist/browser/fetchHttpClient.d.ts +5 -0
  30. package/dist/browser/fetchHttpClient.js.map +1 -1
  31. package/dist/browser/formData-web.d.mts +9 -0
  32. package/dist/browser/formData-web.mjs +12 -0
  33. package/dist/browser/formData-web.mjs.map +1 -0
  34. package/dist/browser/httpHeaders.js +11 -1
  35. package/dist/browser/httpHeaders.js.map +1 -1
  36. package/dist/browser/index.d.ts +3 -14
  37. package/dist/browser/index.js +2 -2
  38. package/dist/browser/index.js.map +1 -1
  39. package/dist/browser/interfaces.d.ts +15 -14
  40. package/dist/browser/interfaces.js.map +1 -1
  41. package/dist/browser/logger/debug.js +3 -2
  42. package/dist/browser/logger/debug.js.map +1 -1
  43. package/dist/{react-native/logger/log.d.ts → browser/logger/log-web.d.mts} +1 -1
  44. package/dist/browser/logger/{log.js → log-web.mjs} +1 -1
  45. package/dist/browser/logger/log-web.mjs.map +1 -0
  46. package/dist/browser/logger/logger.js +2 -2
  47. package/dist/browser/logger/logger.js.map +1 -1
  48. package/dist/browser/pipelineRequest.js +1 -1
  49. package/dist/browser/pipelineRequest.js.map +1 -1
  50. package/dist/browser/policies/auth/basicAuthenticationPolicy.js +1 -1
  51. package/dist/browser/policies/auth/basicAuthenticationPolicy.js.map +1 -1
  52. package/dist/browser/policies/auth/checkInsecureConnection.js +3 -2
  53. package/dist/browser/policies/auth/checkInsecureConnection.js.map +1 -1
  54. package/dist/browser/policies/{decompressResponsePolicy.d.ts → decompressResponsePolicy-web.d.mts} +1 -1
  55. package/dist/browser/policies/{decompressResponsePolicy.js → decompressResponsePolicy-web.mjs} +1 -1
  56. package/dist/browser/policies/decompressResponsePolicy-web.mjs.map +1 -0
  57. package/dist/browser/policies/formDataPolicy.js +5 -12
  58. package/dist/browser/policies/formDataPolicy.js.map +1 -1
  59. package/dist/browser/policies/internal.d.ts +2 -2
  60. package/dist/browser/policies/internal.js +2 -2
  61. package/dist/browser/policies/internal.js.map +1 -1
  62. package/dist/browser/policies/multipartPolicy.js +7 -3
  63. package/dist/browser/policies/multipartPolicy.js.map +1 -1
  64. package/dist/browser/policies/platformPolicies-web.d.mts +10 -0
  65. package/dist/browser/policies/platformPolicies-web.mjs +12 -0
  66. package/dist/browser/policies/platformPolicies-web.mjs.map +1 -0
  67. package/dist/browser/policies/platformPolicies.d.ts +25 -0
  68. package/dist/browser/policies/platformPolicies.js +30 -0
  69. package/dist/browser/policies/platformPolicies.js.map +1 -0
  70. package/dist/browser/policies/proxyPolicy-web.d.mts +2 -0
  71. package/dist/{react-native/policies/proxyPolicy.js → browser/policies/proxyPolicy-web.mjs} +1 -1
  72. package/dist/browser/policies/proxyPolicy-web.mjs.map +1 -0
  73. package/dist/browser/policies/retryPolicy.js +4 -3
  74. package/dist/browser/policies/retryPolicy.js.map +1 -1
  75. package/dist/browser/restError.js +1 -1
  76. package/dist/browser/restError.js.map +1 -1
  77. package/dist/browser/types-browser.d.mts +19 -0
  78. package/dist/browser/{util/concat.js → types-browser.mjs} +2 -2
  79. package/dist/browser/types-browser.mjs.map +1 -0
  80. package/dist/browser/util/bytesEncoding-web.d.mts +2 -0
  81. package/dist/{react-native/util/bytesEncoding.js → browser/util/bytesEncoding-web.mjs} +1 -1
  82. package/dist/browser/util/bytesEncoding-web.mjs.map +1 -0
  83. package/dist/browser/util/bytesEncoding.common.d.ts +4 -4
  84. package/dist/browser/util/bytesEncoding.common.js +3 -4
  85. package/dist/browser/util/bytesEncoding.common.js.map +1 -1
  86. package/dist/browser/util/concat-browser.d.mts +16 -0
  87. package/dist/{esm/util/concat.common.js → browser/util/concat-browser.mjs} +4 -11
  88. package/dist/browser/util/concat-browser.mjs.map +1 -0
  89. package/dist/browser/util/inspect-web.d.mts +2 -0
  90. package/dist/{react-native/util/inspect.js → browser/util/inspect-web.mjs} +1 -1
  91. package/dist/browser/util/inspect-web.mjs.map +1 -0
  92. package/dist/browser/util/internal.d.ts +4 -4
  93. package/dist/browser/util/internal.js +4 -4
  94. package/dist/browser/util/internal.js.map +1 -1
  95. package/dist/browser/util/sanitizer.js +3 -3
  96. package/dist/browser/util/sanitizer.js.map +1 -1
  97. package/dist/browser/util/sha256-web.d.mts +2 -0
  98. package/dist/{react-native/util/sha256.js → browser/util/sha256-web.mjs} +1 -1
  99. package/dist/browser/util/sha256-web.mjs.map +1 -0
  100. package/dist/browser/util/sha256.common.js +1 -1
  101. package/dist/browser/util/sha256.common.js.map +1 -1
  102. package/dist/browser/util/typeGuards-browser.d.mts +14 -0
  103. package/dist/browser/util/typeGuards-browser.mjs +26 -0
  104. package/dist/browser/util/typeGuards-browser.mjs.map +1 -0
  105. package/dist/browser/util/typeGuards.d.ts +5 -4
  106. package/dist/browser/util/typeGuards.js +3 -9
  107. package/dist/browser/util/typeGuards.js.map +1 -1
  108. package/dist/browser/util/userAgent.d.ts +2 -0
  109. package/dist/browser/util/userAgent.js +2 -1
  110. package/dist/browser/util/userAgent.js.map +1 -1
  111. package/dist/browser/util/userAgentPlatform-browser.d.mts +37 -0
  112. package/dist/browser/util/{userAgentPlatform.js → userAgentPlatform-browser.mjs} +10 -11
  113. package/dist/browser/util/userAgentPlatform-browser.mjs.map +1 -0
  114. package/dist/browser/util/{uuidUtils.d.ts → uuidUtils-browser.d.mts} +1 -1
  115. package/dist/browser/util/{uuidUtils.js → uuidUtils-browser.mjs} +1 -1
  116. package/dist/browser/util/uuidUtils-browser.mjs.map +1 -0
  117. package/dist/browser/util/uuidUtils.common.js +1 -1
  118. package/dist/browser/util/uuidUtils.common.js.map +1 -1
  119. package/dist/commonjs/abort-controller/AbortError.js +1 -0
  120. package/dist/commonjs/abort-controller/AbortError.js.map +1 -1
  121. package/dist/commonjs/auth/credentials.js +1 -0
  122. package/dist/commonjs/auth/credentials.js.map +1 -1
  123. package/dist/commonjs/auth/oauth2Flows.js +1 -0
  124. package/dist/commonjs/auth/oauth2Flows.js.map +1 -1
  125. package/dist/commonjs/auth/schemes.js +1 -0
  126. package/dist/commonjs/auth/schemes.js.map +1 -1
  127. package/dist/commonjs/client/apiVersionPolicy.js +1 -0
  128. package/dist/commonjs/client/apiVersionPolicy.js.map +1 -1
  129. package/dist/commonjs/client/clientHelpers.js +3 -2
  130. package/dist/commonjs/client/clientHelpers.js.map +3 -3
  131. package/dist/commonjs/client/common.d.ts +3 -2
  132. package/dist/commonjs/client/common.js +1 -0
  133. package/dist/commonjs/client/common.js.map +2 -2
  134. package/dist/commonjs/client/getClient.js +4 -3
  135. package/dist/commonjs/client/getClient.js.map +3 -3
  136. package/dist/commonjs/client/multipart.js +1 -0
  137. package/dist/commonjs/client/multipart.js.map +3 -3
  138. package/dist/commonjs/client/operationOptionHelpers.js +1 -0
  139. package/dist/commonjs/client/operationOptionHelpers.js.map +1 -1
  140. package/dist/commonjs/client/restError.js +6 -4
  141. package/dist/commonjs/client/restError.js.map +3 -3
  142. package/dist/commonjs/client/sendRequest.js +39 -10
  143. package/dist/commonjs/client/sendRequest.js.map +3 -3
  144. package/dist/commonjs/client/urlHelpers.js +7 -3
  145. package/dist/commonjs/client/urlHelpers.js.map +3 -3
  146. package/dist/commonjs/constants.js +2 -1
  147. package/dist/commonjs/constants.js.map +2 -2
  148. package/dist/commonjs/createPipelineFromOptions.d.ts +1 -1
  149. package/dist/commonjs/createPipelineFromOptions.js +3 -19
  150. package/dist/commonjs/createPipelineFromOptions.js.map +3 -3
  151. package/dist/commonjs/defaultHttpClient.js +1 -0
  152. package/dist/commonjs/defaultHttpClient.js.map +1 -1
  153. package/dist/{browser/util/checkEnvironment.d.ts → commonjs/env.d.ts} +21 -1
  154. package/dist/commonjs/env.js +67 -0
  155. package/dist/commonjs/env.js.map +7 -0
  156. package/dist/commonjs/formData.d.ts +10 -0
  157. package/dist/commonjs/{logger/log.common.js → formData.js} +18 -18
  158. package/dist/commonjs/formData.js.map +7 -0
  159. package/dist/commonjs/httpHeaders.js +5 -1
  160. package/dist/commonjs/httpHeaders.js.map +3 -3
  161. package/dist/commonjs/index.d.ts +1 -12
  162. package/dist/commonjs/index.js +3 -2
  163. package/dist/commonjs/index.js.map +3 -3
  164. package/dist/commonjs/interfaces.d.ts +15 -14
  165. package/dist/commonjs/interfaces.js +1 -0
  166. package/dist/commonjs/interfaces.js.map +2 -2
  167. package/dist/commonjs/log.js +1 -0
  168. package/dist/commonjs/log.js.map +1 -1
  169. package/dist/commonjs/logger/debug.js +3 -1
  170. package/dist/commonjs/logger/debug.js.map +3 -3
  171. package/dist/commonjs/logger/internal.js +1 -0
  172. package/dist/commonjs/logger/internal.js.map +1 -1
  173. package/dist/commonjs/logger/log.js +1 -0
  174. package/dist/commonjs/logger/log.js.map +1 -1
  175. package/dist/commonjs/logger/logger.js +3 -1
  176. package/dist/commonjs/logger/logger.js.map +3 -3
  177. package/dist/commonjs/nodeHttpClient.js +4 -1
  178. package/dist/commonjs/nodeHttpClient.js.map +3 -3
  179. package/dist/commonjs/pipeline.js +1 -0
  180. package/dist/commonjs/pipeline.js.map +1 -1
  181. package/dist/commonjs/pipelineRequest.js +3 -2
  182. package/dist/commonjs/pipelineRequest.js.map +3 -3
  183. package/dist/commonjs/policies/agentPolicy.js +1 -0
  184. package/dist/commonjs/policies/agentPolicy.js.map +1 -1
  185. package/dist/commonjs/policies/auth/apiKeyAuthenticationPolicy.js +1 -0
  186. package/dist/commonjs/policies/auth/apiKeyAuthenticationPolicy.js.map +1 -1
  187. package/dist/commonjs/policies/auth/basicAuthenticationPolicy.js +1 -0
  188. package/dist/commonjs/policies/auth/basicAuthenticationPolicy.js.map +2 -2
  189. package/dist/commonjs/policies/auth/bearerAuthenticationPolicy.js +1 -0
  190. package/dist/commonjs/policies/auth/bearerAuthenticationPolicy.js.map +1 -1
  191. package/dist/commonjs/policies/auth/checkInsecureConnection.js +4 -2
  192. package/dist/commonjs/policies/auth/checkInsecureConnection.js.map +3 -3
  193. package/dist/commonjs/policies/auth/oauth2AuthenticationPolicy.js +1 -0
  194. package/dist/commonjs/policies/auth/oauth2AuthenticationPolicy.js.map +1 -1
  195. package/dist/commonjs/policies/decompressResponsePolicy.js +1 -0
  196. package/dist/commonjs/policies/decompressResponsePolicy.js.map +1 -1
  197. package/dist/commonjs/policies/defaultRetryPolicy.js +1 -0
  198. package/dist/commonjs/policies/defaultRetryPolicy.js.map +1 -1
  199. package/dist/commonjs/policies/exponentialRetryPolicy.js +1 -0
  200. package/dist/commonjs/policies/exponentialRetryPolicy.js.map +1 -1
  201. package/dist/commonjs/policies/formDataPolicy.js +5 -11
  202. package/dist/commonjs/policies/formDataPolicy.js.map +3 -3
  203. package/dist/commonjs/policies/internal.d.ts +1 -1
  204. package/dist/commonjs/policies/internal.js +8 -7
  205. package/dist/commonjs/policies/internal.js.map +3 -3
  206. package/dist/commonjs/policies/logPolicy.js +1 -0
  207. package/dist/commonjs/policies/logPolicy.js.map +1 -1
  208. package/dist/commonjs/policies/multipartPolicy.js +3 -2
  209. package/dist/commonjs/policies/multipartPolicy.js.map +3 -3
  210. package/dist/commonjs/policies/platformPolicies.d.ts +25 -0
  211. package/dist/commonjs/policies/platformPolicies.js +43 -0
  212. package/dist/commonjs/policies/platformPolicies.js.map +7 -0
  213. package/dist/commonjs/policies/proxyPolicy.js +3 -3
  214. package/dist/commonjs/policies/proxyPolicy.js.map +3 -3
  215. package/dist/commonjs/policies/redirectPolicy.js +1 -0
  216. package/dist/commonjs/policies/redirectPolicy.js.map +1 -1
  217. package/dist/commonjs/policies/retryPolicy.js +5 -3
  218. package/dist/commonjs/policies/retryPolicy.js.map +3 -3
  219. package/dist/commonjs/policies/systemErrorRetryPolicy.js +1 -0
  220. package/dist/commonjs/policies/systemErrorRetryPolicy.js.map +1 -1
  221. package/dist/commonjs/policies/throttlingRetryPolicy.js +1 -0
  222. package/dist/commonjs/policies/throttlingRetryPolicy.js.map +1 -1
  223. package/dist/commonjs/policies/tlsPolicy.js +1 -0
  224. package/dist/commonjs/policies/tlsPolicy.js.map +1 -1
  225. package/dist/commonjs/policies/userAgentPolicy.js +1 -0
  226. package/dist/commonjs/policies/userAgentPolicy.js.map +1 -1
  227. package/dist/commonjs/restError.js +1 -0
  228. package/dist/commonjs/restError.js.map +2 -2
  229. package/dist/commonjs/retryStrategies/exponentialRetryStrategy.js +1 -0
  230. package/dist/commonjs/retryStrategies/exponentialRetryStrategy.js.map +1 -1
  231. package/dist/commonjs/retryStrategies/retryStrategy.js +1 -0
  232. package/dist/commonjs/retryStrategies/retryStrategy.js.map +1 -1
  233. package/dist/commonjs/retryStrategies/throttlingRetryStrategy.js +1 -0
  234. package/dist/commonjs/retryStrategies/throttlingRetryStrategy.js.map +1 -1
  235. package/dist/commonjs/tsdoc-metadata.json +1 -1
  236. package/dist/commonjs/types.d.ts +19 -0
  237. package/dist/commonjs/types.js +16 -0
  238. package/dist/commonjs/types.js.map +7 -0
  239. package/dist/commonjs/util/bytesEncoding.js +1 -0
  240. package/dist/commonjs/util/bytesEncoding.js.map +1 -1
  241. package/dist/commonjs/util/concat.d.ts +1 -1
  242. package/dist/commonjs/util/concat.js +1 -0
  243. package/dist/commonjs/util/concat.js.map +3 -3
  244. package/dist/commonjs/util/delay.js +1 -0
  245. package/dist/commonjs/util/delay.js.map +1 -1
  246. package/dist/commonjs/util/error.js +1 -0
  247. package/dist/commonjs/util/error.js.map +1 -1
  248. package/dist/commonjs/util/helpers.js +1 -0
  249. package/dist/commonjs/util/helpers.js.map +1 -1
  250. package/dist/commonjs/util/inspect.js +1 -0
  251. package/dist/commonjs/util/inspect.js.map +1 -1
  252. package/dist/commonjs/util/internal.d.ts +1 -1
  253. package/dist/commonjs/util/internal.js +11 -10
  254. package/dist/commonjs/util/internal.js.map +3 -3
  255. package/dist/commonjs/util/object.js +1 -0
  256. package/dist/commonjs/util/object.js.map +1 -1
  257. package/dist/commonjs/util/random.js +1 -0
  258. package/dist/commonjs/util/random.js.map +1 -1
  259. package/dist/commonjs/util/sanitizer.js +4 -3
  260. package/dist/commonjs/util/sanitizer.js.map +3 -3
  261. package/dist/commonjs/util/sha256.js +1 -0
  262. package/dist/commonjs/util/sha256.js.map +1 -1
  263. package/dist/commonjs/util/typeGuards-node.d.ts +13 -0
  264. package/dist/commonjs/util/{inspect.common.js → typeGuards-node.js} +15 -6
  265. package/dist/commonjs/util/typeGuards-node.js.map +7 -0
  266. package/dist/commonjs/util/typeGuards.d.ts +5 -4
  267. package/dist/commonjs/util/typeGuards.js +6 -12
  268. package/dist/commonjs/util/typeGuards.js.map +3 -3
  269. package/dist/commonjs/util/userAgent.d.ts +2 -0
  270. package/dist/commonjs/util/userAgent.js +8 -5
  271. package/dist/commonjs/util/userAgent.js.map +3 -3
  272. package/dist/commonjs/util/userAgentPlatform.d.ts +8 -0
  273. package/dist/commonjs/util/userAgentPlatform.js +7 -7
  274. package/dist/commonjs/util/userAgentPlatform.js.map +3 -3
  275. package/dist/commonjs/util/uuidUtils.js +1 -0
  276. package/dist/commonjs/util/uuidUtils.js.map +1 -1
  277. package/dist/esm/client/clientHelpers.js.map +1 -1
  278. package/dist/esm/client/common.d.ts +3 -2
  279. package/dist/esm/client/common.js.map +1 -1
  280. package/dist/esm/client/getClient.js +1 -1
  281. package/dist/esm/client/getClient.js.map +1 -1
  282. package/dist/esm/client/multipart.js.map +1 -1
  283. package/dist/esm/client/restError.js +5 -4
  284. package/dist/esm/client/restError.js.map +1 -1
  285. package/dist/esm/client/sendRequest.js +25 -14
  286. package/dist/esm/client/sendRequest.js.map +1 -1
  287. package/dist/esm/client/urlHelpers.js +9 -3
  288. package/dist/esm/client/urlHelpers.js.map +1 -1
  289. package/dist/esm/constants.js +1 -1
  290. package/dist/esm/constants.js.map +1 -1
  291. package/dist/esm/createPipelineFromOptions.d.ts +1 -1
  292. package/dist/esm/createPipelineFromOptions.js +2 -21
  293. package/dist/esm/createPipelineFromOptions.js.map +1 -1
  294. package/dist/{react-native/util/checkEnvironment.d.ts → esm/env.d.ts} +21 -1
  295. package/dist/esm/env.js +48 -0
  296. package/dist/esm/env.js.map +1 -0
  297. package/dist/esm/formData.d.ts +10 -0
  298. package/dist/esm/formData.js +26 -0
  299. package/dist/esm/formData.js.map +1 -0
  300. package/dist/esm/httpHeaders.js +11 -1
  301. package/dist/esm/httpHeaders.js.map +1 -1
  302. package/dist/esm/index.d.ts +1 -12
  303. package/dist/esm/index.js.map +1 -1
  304. package/dist/esm/interfaces.d.ts +15 -14
  305. package/dist/esm/interfaces.js.map +1 -1
  306. package/dist/esm/logger/debug.js +2 -1
  307. package/dist/esm/logger/debug.js.map +1 -1
  308. package/dist/esm/logger/logger.js +2 -2
  309. package/dist/esm/logger/logger.js.map +1 -1
  310. package/dist/esm/nodeHttpClient.js +3 -1
  311. package/dist/esm/nodeHttpClient.js.map +1 -1
  312. package/dist/esm/pipelineRequest.js.map +1 -1
  313. package/dist/esm/policies/auth/basicAuthenticationPolicy.js.map +1 -1
  314. package/dist/esm/policies/auth/checkInsecureConnection.js +3 -2
  315. package/dist/esm/policies/auth/checkInsecureConnection.js.map +1 -1
  316. package/dist/esm/policies/formDataPolicy.js +4 -11
  317. package/dist/esm/policies/formDataPolicy.js.map +1 -1
  318. package/dist/esm/policies/internal.d.ts +1 -1
  319. package/dist/esm/policies/internal.js +1 -1
  320. package/dist/esm/policies/internal.js.map +1 -1
  321. package/dist/esm/policies/multipartPolicy.js +4 -0
  322. package/dist/esm/policies/multipartPolicy.js.map +1 -1
  323. package/dist/esm/policies/platformPolicies.d.ts +25 -0
  324. package/dist/esm/policies/platformPolicies.js +30 -0
  325. package/dist/esm/policies/platformPolicies.js.map +1 -0
  326. package/dist/esm/policies/proxyPolicy.js +2 -3
  327. package/dist/esm/policies/proxyPolicy.js.map +1 -1
  328. package/dist/esm/policies/retryPolicy.js +4 -3
  329. package/dist/esm/policies/retryPolicy.js.map +1 -1
  330. package/dist/esm/restError.js.map +1 -1
  331. package/dist/esm/types.d.ts +19 -0
  332. package/dist/esm/types.js +4 -0
  333. package/dist/esm/types.js.map +1 -0
  334. package/dist/esm/util/concat.d.ts +1 -1
  335. package/dist/esm/util/concat.js.map +1 -1
  336. package/dist/esm/util/internal.d.ts +1 -1
  337. package/dist/esm/util/internal.js +1 -1
  338. package/dist/esm/util/internal.js.map +1 -1
  339. package/dist/esm/util/sanitizer.js +3 -3
  340. package/dist/esm/util/sanitizer.js.map +1 -1
  341. package/dist/esm/util/typeGuards-node.d.ts +13 -0
  342. package/dist/esm/util/typeGuards-node.js +20 -0
  343. package/dist/esm/util/typeGuards-node.js.map +1 -0
  344. package/dist/esm/util/typeGuards.d.ts +5 -4
  345. package/dist/esm/util/typeGuards.js +3 -9
  346. package/dist/esm/util/typeGuards.js.map +1 -1
  347. package/dist/esm/util/userAgent.d.ts +2 -0
  348. package/dist/esm/util/userAgent.js +1 -0
  349. package/dist/esm/util/userAgent.js.map +1 -1
  350. package/dist/esm/util/userAgentPlatform.d.ts +8 -0
  351. package/dist/esm/util/userAgentPlatform.js +6 -7
  352. package/dist/esm/util/userAgentPlatform.js.map +1 -1
  353. package/dist/react-native/client/clientHelpers.js +1 -1
  354. package/dist/react-native/client/clientHelpers.js.map +1 -1
  355. package/dist/react-native/client/common.d.ts +3 -2
  356. package/dist/react-native/client/common.js.map +1 -1
  357. package/dist/react-native/client/getClient.js +1 -1
  358. package/dist/react-native/client/getClient.js.map +1 -1
  359. package/dist/react-native/client/multipart.js +1 -1
  360. package/dist/react-native/client/multipart.js.map +1 -1
  361. package/dist/react-native/client/restError.js +5 -4
  362. package/dist/react-native/client/restError.js.map +1 -1
  363. package/dist/react-native/client/sendRequest.js +25 -14
  364. package/dist/react-native/client/sendRequest.js.map +1 -1
  365. package/dist/react-native/client/urlHelpers.js +9 -3
  366. package/dist/react-native/client/urlHelpers.js.map +1 -1
  367. package/dist/react-native/constants.js +1 -1
  368. package/dist/react-native/constants.js.map +1 -1
  369. package/dist/react-native/createPipelineFromOptions.d.ts +1 -1
  370. package/dist/react-native/createPipelineFromOptions.js +2 -21
  371. package/dist/react-native/createPipelineFromOptions.js.map +1 -1
  372. package/dist/react-native/{defaultHttpClient.d.ts → defaultHttpClient-react-native.d.mts} +1 -1
  373. package/dist/react-native/{defaultHttpClient.js → defaultHttpClient-react-native.mjs} +1 -1
  374. package/dist/react-native/defaultHttpClient-react-native.mjs.map +1 -0
  375. package/dist/react-native/encoding-react-native.d.mts +21 -0
  376. package/dist/react-native/encoding-react-native.mjs +25 -0
  377. package/dist/react-native/encoding-react-native.mjs.map +1 -0
  378. package/dist/{commonjs/util/checkEnvironment.d.ts → react-native/env-react-native.d.mts} +21 -1
  379. package/dist/react-native/env-react-native.mjs +50 -0
  380. package/dist/react-native/env-react-native.mjs.map +1 -0
  381. package/dist/react-native/formData-web.d.mts +9 -0
  382. package/dist/react-native/formData-web.mjs +12 -0
  383. package/dist/react-native/formData-web.mjs.map +1 -0
  384. package/dist/react-native/httpHeaders.js +11 -1
  385. package/dist/react-native/httpHeaders.js.map +1 -1
  386. package/dist/react-native/index.d.ts +3 -14
  387. package/dist/react-native/index.js +2 -2
  388. package/dist/react-native/index.js.map +1 -1
  389. package/dist/react-native/interfaces.d.ts +15 -14
  390. package/dist/react-native/interfaces.js.map +1 -1
  391. package/dist/react-native/logger/debug.js +3 -2
  392. package/dist/react-native/logger/debug.js.map +1 -1
  393. package/dist/{browser/logger/log.d.ts → react-native/logger/log-web.d.mts} +1 -1
  394. package/dist/react-native/logger/{log.js → log-web.mjs} +1 -1
  395. package/dist/react-native/logger/log-web.mjs.map +1 -0
  396. package/dist/react-native/logger/logger.js +2 -2
  397. package/dist/react-native/logger/logger.js.map +1 -1
  398. package/dist/react-native/pipelineRequest.js +1 -1
  399. package/dist/react-native/pipelineRequest.js.map +1 -1
  400. package/dist/react-native/policies/auth/basicAuthenticationPolicy.js +1 -1
  401. package/dist/react-native/policies/auth/basicAuthenticationPolicy.js.map +1 -1
  402. package/dist/react-native/policies/auth/checkInsecureConnection.js +3 -2
  403. package/dist/react-native/policies/auth/checkInsecureConnection.js.map +1 -1
  404. package/dist/react-native/policies/decompressResponsePolicy-web.d.mts +8 -0
  405. package/dist/react-native/policies/decompressResponsePolicy-web.mjs +11 -0
  406. package/dist/react-native/policies/decompressResponsePolicy-web.mjs.map +1 -0
  407. package/dist/react-native/policies/formDataPolicy.js +5 -12
  408. package/dist/react-native/policies/formDataPolicy.js.map +1 -1
  409. package/dist/react-native/policies/internal.d.ts +2 -2
  410. package/dist/react-native/policies/internal.js +2 -2
  411. package/dist/react-native/policies/internal.js.map +1 -1
  412. package/dist/react-native/policies/multipartPolicy.js +7 -3
  413. package/dist/react-native/policies/multipartPolicy.js.map +1 -1
  414. package/dist/react-native/policies/platformPolicies-web.d.mts +10 -0
  415. package/dist/react-native/policies/platformPolicies-web.mjs +12 -0
  416. package/dist/react-native/policies/platformPolicies-web.mjs.map +1 -0
  417. package/dist/react-native/policies/platformPolicies.d.ts +25 -0
  418. package/dist/react-native/policies/platformPolicies.js +30 -0
  419. package/dist/react-native/policies/platformPolicies.js.map +1 -0
  420. package/dist/react-native/policies/proxyPolicy-web.d.mts +2 -0
  421. package/dist/{browser/policies/proxyPolicy.js → react-native/policies/proxyPolicy-web.mjs} +1 -1
  422. package/dist/react-native/policies/proxyPolicy-web.mjs.map +1 -0
  423. package/dist/react-native/policies/retryPolicy.js +4 -3
  424. package/dist/react-native/policies/retryPolicy.js.map +1 -1
  425. package/dist/react-native/restError.js +1 -1
  426. package/dist/react-native/restError.js.map +1 -1
  427. package/dist/react-native/types-react-native.d.mts +19 -0
  428. package/dist/react-native/types-react-native.mjs +4 -0
  429. package/dist/react-native/types-react-native.mjs.map +1 -0
  430. package/dist/react-native/util/bytesEncoding-web.d.mts +2 -0
  431. package/dist/{browser/util/bytesEncoding.js → react-native/util/bytesEncoding-web.mjs} +1 -1
  432. package/dist/react-native/util/bytesEncoding-web.mjs.map +1 -0
  433. package/dist/react-native/util/bytesEncoding.common.d.ts +4 -4
  434. package/dist/react-native/util/bytesEncoding.common.js +3 -4
  435. package/dist/react-native/util/bytesEncoding.common.js.map +1 -1
  436. package/dist/react-native/util/concat-react-native.d.mts +42 -0
  437. package/dist/react-native/util/concat-react-native.mjs +51 -0
  438. package/dist/react-native/util/concat-react-native.mjs.map +1 -0
  439. package/dist/react-native/util/inspect-web.d.mts +2 -0
  440. package/dist/{browser/util/inspect.js → react-native/util/inspect-web.mjs} +1 -1
  441. package/dist/react-native/util/inspect-web.mjs.map +1 -0
  442. package/dist/react-native/util/internal.d.ts +4 -4
  443. package/dist/react-native/util/internal.js +4 -4
  444. package/dist/react-native/util/internal.js.map +1 -1
  445. package/dist/react-native/util/sanitizer.js +3 -3
  446. package/dist/react-native/util/sanitizer.js.map +1 -1
  447. package/dist/react-native/util/sha256-web.d.mts +2 -0
  448. package/dist/{browser/util/sha256.js → react-native/util/sha256-web.mjs} +1 -1
  449. package/dist/react-native/util/sha256-web.mjs.map +1 -0
  450. package/dist/react-native/util/sha256.common.js +1 -1
  451. package/dist/react-native/util/sha256.common.js.map +1 -1
  452. package/dist/react-native/util/typeGuards-react-native.d.mts +16 -0
  453. package/dist/react-native/util/typeGuards-react-native.mjs +34 -0
  454. package/dist/react-native/util/typeGuards-react-native.mjs.map +1 -0
  455. package/dist/react-native/util/typeGuards.d.ts +5 -4
  456. package/dist/react-native/util/typeGuards.js +3 -9
  457. package/dist/react-native/util/typeGuards.js.map +1 -1
  458. package/dist/react-native/util/userAgent.d.ts +2 -0
  459. package/dist/react-native/util/userAgent.js +2 -1
  460. package/dist/react-native/util/userAgent.js.map +1 -1
  461. package/dist/react-native/util/{userAgentPlatform.d.ts → userAgentPlatform-react-native.d.mts} +1 -1
  462. package/dist/react-native/util/{userAgentPlatform.js → userAgentPlatform-react-native.mjs} +1 -1
  463. package/dist/react-native/util/userAgentPlatform-react-native.mjs.map +1 -0
  464. package/dist/react-native/util/uuidUtils-react-native.d.mts +2 -0
  465. package/dist/react-native/util/{uuidUtils.js → uuidUtils-react-native.mjs} +1 -1
  466. package/dist/react-native/util/uuidUtils-react-native.mjs.map +1 -0
  467. package/dist/react-native/util/uuidUtils.common.js +1 -1
  468. package/dist/react-native/util/uuidUtils.common.js.map +1 -1
  469. package/package.json +102 -14
  470. package/dist/browser/defaultHttpClient.js.map +0 -1
  471. package/dist/browser/logger/log.js.map +0 -1
  472. package/dist/browser/nodeHttpClient.d.ts +0 -9
  473. package/dist/browser/nodeHttpClient.js +0 -347
  474. package/dist/browser/nodeHttpClient.js.map +0 -1
  475. package/dist/browser/policies/decompressResponsePolicy.js.map +0 -1
  476. package/dist/browser/policies/proxyPolicy.d.ts +0 -2
  477. package/dist/browser/policies/proxyPolicy.js.map +0 -1
  478. package/dist/browser/util/bytesEncoding.d.ts +0 -2
  479. package/dist/browser/util/bytesEncoding.js.map +0 -1
  480. package/dist/browser/util/checkEnvironment.js +0 -41
  481. package/dist/browser/util/checkEnvironment.js.map +0 -1
  482. package/dist/browser/util/concat.common.d.ts +0 -17
  483. package/dist/browser/util/concat.common.js +0 -58
  484. package/dist/browser/util/concat.common.js.map +0 -1
  485. package/dist/browser/util/concat.d.ts +0 -2
  486. package/dist/browser/util/concat.js.map +0 -1
  487. package/dist/browser/util/inspect.d.ts +0 -2
  488. package/dist/browser/util/inspect.js.map +0 -1
  489. package/dist/browser/util/sha256.d.ts +0 -2
  490. package/dist/browser/util/sha256.js.map +0 -1
  491. package/dist/browser/util/userAgentPlatform.d.ts +0 -9
  492. package/dist/browser/util/userAgentPlatform.js.map +0 -1
  493. package/dist/browser/util/uuidUtils.js.map +0 -1
  494. package/dist/browser/xhrHttpClient.d.ts +0 -7
  495. package/dist/browser/xhrHttpClient.js +0 -174
  496. package/dist/browser/xhrHttpClient.js.map +0 -1
  497. package/dist/commonjs/fetchHttpClient.d.ts +0 -7
  498. package/dist/commonjs/fetchHttpClient.js +0 -237
  499. package/dist/commonjs/fetchHttpClient.js.map +0 -7
  500. package/dist/commonjs/logger/log.common.d.ts +0 -2
  501. package/dist/commonjs/logger/log.common.js.map +0 -7
  502. package/dist/commonjs/policies/proxyPolicy.common.d.ts +0 -19
  503. package/dist/commonjs/policies/proxyPolicy.common.js +0 -43
  504. package/dist/commonjs/policies/proxyPolicy.common.js.map +0 -7
  505. package/dist/commonjs/util/arrayBuffer.d.ts +0 -7
  506. package/dist/commonjs/util/arrayBuffer.js +0 -36
  507. package/dist/commonjs/util/arrayBuffer.js.map +0 -7
  508. package/dist/commonjs/util/bytesEncoding.common.d.ts +0 -61
  509. package/dist/commonjs/util/bytesEncoding.common.js +0 -105
  510. package/dist/commonjs/util/bytesEncoding.common.js.map +0 -7
  511. package/dist/commonjs/util/checkEnvironment.js +0 -45
  512. package/dist/commonjs/util/checkEnvironment.js.map +0 -7
  513. package/dist/commonjs/util/concat.common.d.ts +0 -17
  514. package/dist/commonjs/util/concat.common.js +0 -60
  515. package/dist/commonjs/util/concat.common.js.map +0 -7
  516. package/dist/commonjs/util/inspect.common.d.ts +0 -2
  517. package/dist/commonjs/util/inspect.common.js.map +0 -7
  518. package/dist/commonjs/util/sha256.common.d.ts +0 -14
  519. package/dist/commonjs/util/sha256.common.js +0 -69
  520. package/dist/commonjs/util/sha256.common.js.map +0 -7
  521. package/dist/commonjs/util/uuidUtils.common.d.ts +0 -13
  522. package/dist/commonjs/util/uuidUtils.common.js +0 -48
  523. package/dist/commonjs/util/uuidUtils.common.js.map +0 -7
  524. package/dist/commonjs/xhrHttpClient.d.ts +0 -7
  525. package/dist/commonjs/xhrHttpClient.js +0 -185
  526. package/dist/commonjs/xhrHttpClient.js.map +0 -7
  527. package/dist/esm/fetchHttpClient.d.ts +0 -7
  528. package/dist/esm/fetchHttpClient.js +0 -279
  529. package/dist/esm/fetchHttpClient.js.map +0 -1
  530. package/dist/esm/logger/log.common.d.ts +0 -2
  531. package/dist/esm/logger/log.common.js +0 -23
  532. package/dist/esm/logger/log.common.js.map +0 -1
  533. package/dist/esm/policies/proxyPolicy.common.d.ts +0 -19
  534. package/dist/esm/policies/proxyPolicy.common.js +0 -24
  535. package/dist/esm/policies/proxyPolicy.common.js.map +0 -1
  536. package/dist/esm/util/arrayBuffer.d.ts +0 -7
  537. package/dist/esm/util/arrayBuffer.js +0 -20
  538. package/dist/esm/util/arrayBuffer.js.map +0 -1
  539. package/dist/esm/util/bytesEncoding.common.d.ts +0 -61
  540. package/dist/esm/util/bytesEncoding.common.js +0 -110
  541. package/dist/esm/util/bytesEncoding.common.js.map +0 -1
  542. package/dist/esm/util/checkEnvironment.js.map +0 -1
  543. package/dist/esm/util/concat.common.d.ts +0 -17
  544. package/dist/esm/util/concat.common.js.map +0 -1
  545. package/dist/esm/util/inspect.common.d.ts +0 -2
  546. package/dist/esm/util/inspect.common.js +0 -4
  547. package/dist/esm/util/inspect.common.js.map +0 -1
  548. package/dist/esm/util/sha256.common.d.ts +0 -14
  549. package/dist/esm/util/sha256.common.js +0 -49
  550. package/dist/esm/util/sha256.common.js.map +0 -1
  551. package/dist/esm/util/uuidUtils.common.d.ts +0 -13
  552. package/dist/esm/util/uuidUtils.common.js +0 -40
  553. package/dist/esm/util/uuidUtils.common.js.map +0 -1
  554. package/dist/esm/xhrHttpClient.d.ts +0 -7
  555. package/dist/esm/xhrHttpClient.js +0 -174
  556. package/dist/esm/xhrHttpClient.js.map +0 -1
  557. package/dist/react-native/defaultHttpClient.js.map +0 -1
  558. package/dist/react-native/fetchHttpClient.d.ts +0 -7
  559. package/dist/react-native/fetchHttpClient.js +0 -279
  560. package/dist/react-native/fetchHttpClient.js.map +0 -1
  561. package/dist/react-native/logger/log.js.map +0 -1
  562. package/dist/react-native/nodeHttpClient.d.ts +0 -9
  563. package/dist/react-native/nodeHttpClient.js +0 -347
  564. package/dist/react-native/nodeHttpClient.js.map +0 -1
  565. package/dist/react-native/policies/decompressResponsePolicy.d.ts +0 -11
  566. package/dist/react-native/policies/decompressResponsePolicy.js +0 -23
  567. package/dist/react-native/policies/decompressResponsePolicy.js.map +0 -1
  568. package/dist/react-native/policies/proxyPolicy.d.ts +0 -2
  569. package/dist/react-native/policies/proxyPolicy.js.map +0 -1
  570. package/dist/react-native/util/bytesEncoding.d.ts +0 -2
  571. package/dist/react-native/util/bytesEncoding.js.map +0 -1
  572. package/dist/react-native/util/checkEnvironment.js +0 -41
  573. package/dist/react-native/util/checkEnvironment.js.map +0 -1
  574. package/dist/react-native/util/concat.common.d.ts +0 -17
  575. package/dist/react-native/util/concat.common.js +0 -58
  576. package/dist/react-native/util/concat.common.js.map +0 -1
  577. package/dist/react-native/util/concat.d.ts +0 -2
  578. package/dist/react-native/util/concat.js +0 -4
  579. package/dist/react-native/util/concat.js.map +0 -1
  580. package/dist/react-native/util/inspect.d.ts +0 -2
  581. package/dist/react-native/util/inspect.js.map +0 -1
  582. package/dist/react-native/util/sha256.d.ts +0 -2
  583. package/dist/react-native/util/sha256.js.map +0 -1
  584. package/dist/react-native/util/userAgentPlatform.js.map +0 -1
  585. package/dist/react-native/util/uuidUtils.d.ts +0 -2
  586. package/dist/react-native/util/uuidUtils.js.map +0 -1
@@ -2,15 +2,10 @@
2
2
  // Licensed under the MIT License.
3
3
  import { logPolicy } from "./policies/logPolicy.js";
4
4
  import { createEmptyPipeline } from "./pipeline.js";
5
- import { redirectPolicy } from "./policies/redirectPolicy.js";
6
5
  import { userAgentPolicy } from "./policies/userAgentPolicy.js";
7
- import { decompressResponsePolicy } from "./policies/decompressResponsePolicy.js";
8
6
  import { defaultRetryPolicy } from "./policies/defaultRetryPolicy.js";
9
7
  import { formDataPolicy } from "./policies/formDataPolicy.js";
10
- import { isNodeLike } from "./util/checkEnvironment.js";
11
- import { proxyPolicy } from "./policies/proxyPolicy.js";
12
- import { agentPolicy } from "./policies/agentPolicy.js";
13
- import { tlsPolicy } from "./policies/tlsPolicy.js";
8
+ import { addPlatformPolicies } from "./policies/platformPolicies-web.mjs";
14
9
  import { multipartPolicy, multipartPolicyName } from "./policies/multipartPolicy.js";
15
10
  /**
16
11
  * Create a new pipeline with a default set of customizable policies.
@@ -18,16 +13,7 @@ import { multipartPolicy, multipartPolicyName } from "./policies/multipartPolicy
18
13
  */
19
14
  export function createPipelineFromOptions(options) {
20
15
  const pipeline = createEmptyPipeline();
21
- if (isNodeLike) {
22
- if (options.agent) {
23
- pipeline.addPolicy(agentPolicy(options.agent));
24
- }
25
- if (options.tlsOptions) {
26
- pipeline.addPolicy(tlsPolicy(options.tlsOptions));
27
- }
28
- pipeline.addPolicy(proxyPolicy(options.proxyOptions));
29
- pipeline.addPolicy(decompressResponsePolicy());
30
- }
16
+ addPlatformPolicies(pipeline, options);
31
17
  pipeline.addPolicy(formDataPolicy(), { beforePolicies: [multipartPolicyName] });
32
18
  pipeline.addPolicy(userAgentPolicy(options.userAgentOptions));
33
19
  // The multipart policy is added after policies with no phase, so that
@@ -35,11 +21,6 @@ export function createPipelineFromOptions(options) {
35
21
  // properties (e.g., making the boundary constant in recorded tests).
36
22
  pipeline.addPolicy(multipartPolicy(), { afterPhase: "Deserialize" });
37
23
  pipeline.addPolicy(defaultRetryPolicy(options.retryOptions), { phase: "Retry" });
38
- if (isNodeLike) {
39
- // Both XHR and Fetch expect to handle redirects automatically,
40
- // so only include this policy when we're in Node.
41
- pipeline.addPolicy(redirectPolicy(options.redirectOptions), { afterPhase: "Retry" });
42
- }
43
24
  pipeline.addPolicy(logPolicy(options.loggingOptions), { afterPhase: "Sign" });
44
25
  return pipeline;
45
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createPipelineFromOptions.js","sourceRoot":"","sources":["../../src/createPipelineFromOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAyB,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAiB,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EAA8B,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAA+B,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAC7F,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;A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EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;IACvF,CAAC;IACD,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;IAE9E,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { type LogPolicyOptions, logPolicy } from \"./policies/logPolicy.js\";\nimport { type Pipeline, createEmptyPipeline } from \"./pipeline.js\";\nimport type { Agent, PipelineRetryOptions, ProxySettings, TlsSettings } from \"./interfaces.js\";\nimport { type RedirectPolicyOptions, redirectPolicy } from \"./policies/redirectPolicy.js\";\nimport { type UserAgentPolicyOptions, userAgentPolicy } from \"./policies/userAgentPolicy.js\";\nimport { decompressResponsePolicy } from \"./policies/decompressResponsePolicy.js\";\nimport { defaultRetryPolicy } from \"./policies/defaultRetryPolicy.js\";\nimport { formDataPolicy } from \"./policies/formDataPolicy.js\";\nimport { isNodeLike } from \"./util/checkEnvironment.js\";\nimport { proxyPolicy } from \"./policies/proxyPolicy.js\";\nimport { agentPolicy } from \"./policies/agentPolicy.js\";\nimport { tlsPolicy } from \"./policies/tlsPolicy.js\";\nimport { multipartPolicy, multipartPolicyName } from \"./policies/multipartPolicy.js\";\n\n/**\n * Defines options that are used to configure the HTTP pipeline for\n * an SDK client.\n */\nexport interface PipelineOptions {\n /**\n * Options that control how to retry failed requests.\n */\n retryOptions?: PipelineRetryOptions;\n\n /**\n * Options to configure a proxy for outgoing requests.\n */\n proxyOptions?: ProxySettings;\n\n /** Options for configuring Agent instance for outgoing requests */\n agent?: Agent;\n\n /** Options for configuring TLS authentication */\n tlsOptions?: TlsSettings;\n\n /**\n * Options for how redirect responses are handled.\n */\n redirectOptions?: RedirectPolicyOptions;\n\n /**\n * Options for adding user agent details to outgoing requests.\n */\n userAgentOptions?: UserAgentPolicyOptions;\n\n /**\n * Options for setting common telemetry and tracing info to outgoing requests.\n */\n telemetryOptions?: TelemetryOptions;\n}\n\n/**\n * Defines options that are used to configure common telemetry and tracing info\n */\nexport interface TelemetryOptions {\n /**\n * The name of the header to pass the request ID to.\n */\n clientRequestIdHeaderName?: string;\n}\n\n/**\n * Defines options that are used to configure internal options of\n * the HTTP pipeline for an SDK client.\n */\nexport interface InternalPipelineOptions extends PipelineOptions {\n /**\n * Options to configure request/response logging.\n */\n loggingOptions?: LogPolicyOptions;\n}\n\n/**\n * Create a new pipeline with a default set of customizable policies.\n * @param options - Options to configure a custom pipeline.\n */\nexport function createPipelineFromOptions(options: InternalPipelineOptions): Pipeline {\n const pipeline = createEmptyPipeline();\n\n if (isNodeLike) {\n if (options.agent) {\n pipeline.addPolicy(agentPolicy(options.agent));\n }\n if (options.tlsOptions) {\n pipeline.addPolicy(tlsPolicy(options.tlsOptions));\n }\n pipeline.addPolicy(proxyPolicy(options.proxyOptions));\n pipeline.addPolicy(decompressResponsePolicy());\n }\n\n pipeline.addPolicy(formDataPolicy(), { beforePolicies: [multipartPolicyName] });\n pipeline.addPolicy(userAgentPolicy(options.userAgentOptions));\n // The multipart policy is added after policies with no phase, so that\n // policies can be added between it and formDataPolicy to modify\n // properties (e.g., making the boundary constant in recorded tests).\n pipeline.addPolicy(multipartPolicy(), { afterPhase: \"Deserialize\" });\n pipeline.addPolicy(defaultRetryPolicy(options.retryOptions), { phase: \"Retry\" });\n if (isNodeLike) {\n // Both XHR and Fetch expect to handle redirects automatically,\n // so only include this policy when we're in Node.\n pipeline.addPolicy(redirectPolicy(options.redirectOptions), { afterPhase: \"Retry\" });\n }\n pipeline.addPolicy(logPolicy(options.loggingOptions), { afterPhase: \"Sign\" });\n\n return pipeline;\n}\n"]}
1
+ {"version":3,"file":"createPipelineFromOptions.js","sourceRoot":"","sources":["../../src/createPipelineFromOptions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAyB,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EAAiB,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGnE,OAAO,EAA+B,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AA4DrF;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAAgC;IACxE,MAAM,QAAQ,GAAG,mBAAmB,EAAE,CAAC;IAEvC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAEvC,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,EAAE,EAAE,cAAc,EAAE,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;IAChF,QAAQ,CAAC,SAAS,CAAC,eAAe,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC9D,sEAAsE;IACtE,gEAAgE;IAChE,qEAAqE;IACrE,QAAQ,CAAC,SAAS,CAAC,eAAe,EAAE,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC,CAAC;IACrE,QAAQ,CAAC,SAAS,CAAC,kBAAkB,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IACjF,QAAQ,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;IAE9E,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { type LogPolicyOptions, logPolicy } from \"./policies/logPolicy.js\";\nimport { type Pipeline, createEmptyPipeline } from \"./pipeline.js\";\nimport type { Agent, PipelineRetryOptions, ProxySettings, TlsSettings } from \"./interfaces.js\";\nimport type { RedirectPolicyOptions } from \"./policies/redirectPolicy.js\";\nimport { type UserAgentPolicyOptions, userAgentPolicy } from \"./policies/userAgentPolicy.js\";\nimport { defaultRetryPolicy } from \"./policies/defaultRetryPolicy.js\";\nimport { formDataPolicy } from \"./policies/formDataPolicy.js\";\nimport { addPlatformPolicies } from \"#platform/policies\";\nimport { multipartPolicy, multipartPolicyName } from \"./policies/multipartPolicy.js\";\n\n/**\n * Defines options that are used to configure the HTTP pipeline for\n * an SDK client.\n */\nexport interface PipelineOptions {\n /**\n * Options that control how to retry failed requests.\n */\n retryOptions?: PipelineRetryOptions;\n\n /**\n * Options to configure a proxy for outgoing requests.\n */\n proxyOptions?: ProxySettings;\n\n /** Options for configuring Agent instance for outgoing requests */\n agent?: Agent;\n\n /** Options for configuring TLS authentication */\n tlsOptions?: TlsSettings;\n\n /**\n * Options for how redirect responses are handled.\n */\n redirectOptions?: RedirectPolicyOptions;\n\n /**\n * Options for adding user agent details to outgoing requests.\n */\n userAgentOptions?: UserAgentPolicyOptions;\n\n /**\n * Options for setting common telemetry and tracing info to outgoing requests.\n */\n telemetryOptions?: TelemetryOptions;\n}\n\n/**\n * Defines options that are used to configure common telemetry and tracing info\n */\nexport interface TelemetryOptions {\n /**\n * The name of the header to pass the request ID to.\n */\n clientRequestIdHeaderName?: string;\n}\n\n/**\n * Defines options that are used to configure internal options of\n * the HTTP pipeline for an SDK client.\n */\nexport interface InternalPipelineOptions extends PipelineOptions {\n /**\n * Options to configure request/response logging.\n */\n loggingOptions?: LogPolicyOptions;\n}\n\n/**\n * Create a new pipeline with a default set of customizable policies.\n * @param options - Options to configure a custom pipeline.\n */\nexport function createPipelineFromOptions(options: InternalPipelineOptions): Pipeline {\n const pipeline = createEmptyPipeline();\n\n addPlatformPolicies(pipeline, options);\n\n pipeline.addPolicy(formDataPolicy(), { beforePolicies: [multipartPolicyName] });\n pipeline.addPolicy(userAgentPolicy(options.userAgentOptions));\n // The multipart policy is added after policies with no phase, so that\n // policies can be added between it and formDataPolicy to modify\n // properties (e.g., making the boundary constant in recorded tests).\n pipeline.addPolicy(multipartPolicy(), { afterPhase: \"Deserialize\" });\n pipeline.addPolicy(defaultRetryPolicy(options.retryOptions), { phase: \"Retry\" });\n pipeline.addPolicy(logPolicy(options.loggingOptions), { afterPhase: \"Sign\" });\n\n return pipeline;\n}\n"]}
@@ -3,4 +3,4 @@ import type { HttpClient } from "./interfaces.js";
3
3
  * Create the correct HttpClient for the current environment.
4
4
  */
5
5
  export declare function createDefaultHttpClient(): HttpClient;
6
- //# sourceMappingURL=defaultHttpClient.d.ts.map
6
+ //# sourceMappingURL=defaultHttpClient-browser.d.mts.map
@@ -7,4 +7,4 @@ import { createFetchHttpClient } from "./fetchHttpClient.js";
7
7
  export function createDefaultHttpClient() {
8
8
  return createFetchHttpClient();
9
9
  }
10
- //# sourceMappingURL=defaultHttpClient.js.map
10
+ //# sourceMappingURL=defaultHttpClient-browser.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultHttpClient-browser.mjs","sourceRoot":"","sources":["../../src/defaultHttpClient-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,qBAAqB,EAAE,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { HttpClient } from \"./interfaces.js\";\nimport { createFetchHttpClient } from \"./fetchHttpClient.js\";\n\n/**\n * Create the correct HttpClient for the current environment.\n */\nexport function createDefaultHttpClient(): HttpClient {\n return createFetchHttpClient();\n}\n"]}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Decodes a Uint8Array to a UTF-8 string.
3
+ *
4
+ * @internal
5
+ */
6
+ export declare function decodeUtf8(bytes: Uint8Array): string;
7
+ /**
8
+ * Encodes a string to a UTF-8 Uint8Array.
9
+ *
10
+ * @internal
11
+ */
12
+ export declare function encodeUtf8(value: string): Uint8Array<ArrayBuffer>;
13
+ //# sourceMappingURL=encoding.d.ts.map
@@ -0,0 +1,19 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ /**
4
+ * Decodes a Uint8Array to a UTF-8 string.
5
+ *
6
+ * @internal
7
+ */
8
+ export function decodeUtf8(bytes) {
9
+ return new TextDecoder().decode(bytes);
10
+ }
11
+ /**
12
+ * Encodes a string to a UTF-8 Uint8Array.
13
+ *
14
+ * @internal
15
+ */
16
+ export function encodeUtf8(value) {
17
+ return new TextEncoder().encode(value);
18
+ }
19
+ //# sourceMappingURL=encoding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoding.js","sourceRoot":"","sources":["../../src/encoding.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAiB;IAC1C,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACzC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Decodes a Uint8Array to a UTF-8 string.\n *\n * @internal\n */\nexport function decodeUtf8(bytes: Uint8Array): string {\n return new TextDecoder().decode(bytes);\n}\n\n/**\n * Encodes a string to a UTF-8 Uint8Array.\n *\n * @internal\n */\nexport function encodeUtf8(value: string): Uint8Array<ArrayBuffer> {\n return new TextEncoder().encode(value);\n}\n"]}
@@ -1,3 +1,23 @@
1
+ declare global {
2
+ var process: {
3
+ env?: Record<string, string | undefined>;
4
+ emitWarning?: (warning: string) => void;
5
+ } | undefined;
6
+ }
7
+ /**
8
+ * Returns the value of the specified environment variable.
9
+ * In browser environments, this checks for a globally-defined `process.env`
10
+ * which may be injected by bundlers or test frameworks (e.g. vitest's `define`).
11
+ *
12
+ * @internal
13
+ */
14
+ export declare function getEnvironmentVariable(name: string): string | undefined;
15
+ /**
16
+ * Emits a warning via `process.emitWarning` if available.
17
+ *
18
+ * @internal
19
+ */
20
+ export declare function emitNodeWarning(warning: string): void;
1
21
  /**
2
22
  * A constant that indicates whether the environment the code is running is a Web Browser.
3
23
  */
@@ -26,4 +46,4 @@ export declare const isNodeRuntime: boolean;
26
46
  * A constant that indicates whether the environment the code is running is in React-Native.
27
47
  */
28
48
  export declare const isReactNative: boolean;
29
- //# sourceMappingURL=checkEnvironment.d.ts.map
49
+ //# sourceMappingURL=env-browser.d.mts.map
@@ -1,5 +1,23 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
+ /**
4
+ * Returns the value of the specified environment variable.
5
+ * In browser environments, this checks for a globally-defined `process.env`
6
+ * which may be injected by bundlers or test frameworks (e.g. vitest's `define`).
7
+ *
8
+ * @internal
9
+ */
10
+ export function getEnvironmentVariable(name) {
11
+ return globalThis.process?.env?.[name];
12
+ }
13
+ /**
14
+ * Emits a warning via `process.emitWarning` if available.
15
+ *
16
+ * @internal
17
+ */
18
+ export function emitNodeWarning(warning) {
19
+ globalThis.process?.emitWarning?.(warning);
20
+ }
3
21
  /**
4
22
  * A constant that indicates whether the environment the code is running is a Web Browser.
5
23
  */
@@ -9,33 +27,29 @@ export const isBrowser = typeof window !== "undefined" && typeof window.document
9
27
  * A constant that indicates whether the environment the code is running is a Web Worker.
10
28
  */
11
29
  export const isWebWorker = typeof self === "object" &&
12
- typeof self?.importScripts === "function" &&
30
+ "importScripts" in self &&
31
+ typeof self.importScripts === "function" &&
13
32
  (self.constructor?.name === "DedicatedWorkerGlobalScope" ||
14
33
  self.constructor?.name === "ServiceWorkerGlobalScope" ||
15
34
  self.constructor?.name === "SharedWorkerGlobalScope");
16
35
  /**
17
36
  * A constant that indicates whether the environment the code is running is Deno.
18
37
  */
19
- export const isDeno = typeof Deno !== "undefined" &&
20
- typeof Deno.version !== "undefined" &&
21
- typeof Deno.version.deno !== "undefined";
38
+ export const isDeno = false;
22
39
  /**
23
40
  * A constant that indicates whether the environment the code is running is Bun.sh.
24
41
  */
25
- export const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
42
+ export const isBun = false;
26
43
  /**
27
44
  * A constant that indicates whether the environment the code is running is a Node.js compatible environment.
28
45
  */
29
- export const isNodeLike = typeof globalThis.process !== "undefined" &&
30
- Boolean(globalThis.process.version) &&
31
- Boolean(globalThis.process.versions?.node);
46
+ export const isNodeLike = false;
32
47
  /**
33
48
  * A constant that indicates whether the environment the code is running is Node.JS.
34
49
  */
35
- export const isNodeRuntime = isNodeLike && !isBun && !isDeno;
50
+ export const isNodeRuntime = false;
36
51
  /**
37
52
  * A constant that indicates whether the environment the code is running is in React-Native.
38
53
  */
39
- // https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js
40
- export const isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative";
41
- //# sourceMappingURL=checkEnvironment.js.map
54
+ export const isReactNative = false;
55
+ //# sourceMappingURL=env-browser.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-browser.mjs","sourceRoot":"","sources":["../../src/env-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAclC;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAY;IACjD,OAAO,UAAU,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,UAAU,CAAC,OAAO,EAAE,WAAW,EAAE,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,yDAAyD;AACzD,MAAM,CAAC,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC;AAEjG;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GACtB,OAAO,IAAI,KAAK,QAAQ;IACxB,eAAe,IAAI,IAAI;IACvB,OAAO,IAAI,CAAC,aAAa,KAAK,UAAU;IACxC,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,KAAK,4BAA4B;QACtD,IAAI,CAAC,WAAW,EAAE,IAAI,KAAK,0BAA0B;QACrD,IAAI,CAAC,WAAW,EAAE,IAAI,KAAK,yBAAyB,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAY,KAAK,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAY,KAAK,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAY,KAAK,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAY,KAAK,CAAC;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAY,KAAK,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n// Bundlers and test frameworks (e.g. vitest's `define`) may inject a `process.env`\n// object into browser bundles. Declare the minimal shape on globalThis so we can\n// access it type-safely without pulling in @types/node.\n// Using `globalThis.process` (property access) instead of bare `process` avoids\n// ReferenceError when the binding doesn't exist at all.\ndeclare global {\n // eslint-disable-next-line no-var\n var process:\n | { env?: Record<string, string | undefined>; emitWarning?: (warning: string) => void }\n | undefined;\n}\n\n/**\n * Returns the value of the specified environment variable.\n * In browser environments, this checks for a globally-defined `process.env`\n * which may be injected by bundlers or test frameworks (e.g. vitest's `define`).\n *\n * @internal\n */\nexport function getEnvironmentVariable(name: string): string | undefined {\n return globalThis.process?.env?.[name];\n}\n\n/**\n * Emits a warning via `process.emitWarning` if available.\n *\n * @internal\n */\nexport function emitNodeWarning(warning: string): void {\n globalThis.process?.emitWarning?.(warning);\n}\n\n/**\n * A constant that indicates whether the environment the code is running is a Web Browser.\n */\n// eslint-disable-next-line @azure/azure-sdk/ts-no-window\nexport const isBrowser = typeof window !== \"undefined\" && typeof window.document !== \"undefined\";\n\n/**\n * A constant that indicates whether the environment the code is running is a Web Worker.\n */\nexport const isWebWorker =\n typeof self === \"object\" &&\n \"importScripts\" in self &&\n typeof self.importScripts === \"function\" &&\n (self.constructor?.name === \"DedicatedWorkerGlobalScope\" ||\n self.constructor?.name === \"ServiceWorkerGlobalScope\" ||\n self.constructor?.name === \"SharedWorkerGlobalScope\");\n\n/**\n * A constant that indicates whether the environment the code is running is Deno.\n */\nexport const isDeno: boolean = false;\n\n/**\n * A constant that indicates whether the environment the code is running is Bun.sh.\n */\nexport const isBun: boolean = false;\n\n/**\n * A constant that indicates whether the environment the code is running is a Node.js compatible environment.\n */\nexport const isNodeLike: boolean = false;\n\n/**\n * A constant that indicates whether the environment the code is running is Node.JS.\n */\nexport const isNodeRuntime: boolean = false;\n\n/**\n * A constant that indicates whether the environment the code is running is in React-Native.\n */\nexport const isReactNative: boolean = false;\n"]}
@@ -1,4 +1,9 @@
1
1
  import type { HttpClient } from "./interfaces.js";
2
+ declare global {
3
+ interface RequestInit {
4
+ duplex?: "half";
5
+ }
6
+ }
2
7
  /**
3
8
  * Create a new HttpClient instance for the browser environment.
4
9
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"fetchHttpClient.js","sourceRoot":"","sources":["../../src/fetchHttpClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAQ9D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,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C5D,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;oBACnB,KAAK,EAAE,EAAE,CAAC;oBACV,mBAAmB;oBACnB,UAAU,CAAC,KAAK,EAAE,CAAC;oBACnB,MAAM,CAAC,WAAW,EAAE,CAAC;oBACrB,OAAO;gBACT,CAAC;gBAED,WAAW,IAAI,KAAK,EAAE,MAAM,IAAI,CAAC,CAAC;gBAElC,qDAAqD;gBACrD,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBAE1B,IAAI,UAAU,EAAE,CAAC;oBACf,UAAU,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;gBAC9B,CAAC;YACH,CAAC;YACD,MAAM,CAAC,MAAe;gBACpB,KAAK,EAAE,EAAE,CAAC;gBACV,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC/B,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,IAAI,eAAe,EAAE,CAAC;AAC/B,CAAC;AAED,SAAS,0BAA0B,CAAC,cAA8B;IAChE,OAAO,cAAc,CAAC,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,CAAC;AACxF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AbortError } from \"./abort-controller/AbortError.js\";\nimport type {\n HttpClient,\n HttpHeaders as PipelineHeaders,\n PipelineRequest,\n PipelineResponse,\n TransferProgressEvent,\n} from \"./interfaces.js\";\nimport { RestError } from \"./restError.js\";\nimport { createHttpHeaders } from \"./httpHeaders.js\";\nimport { isNodeReadableStream, isWebReadableStream } from \"./util/typeGuards.js\";\nimport { arrayBufferViewToArrayBuffer } from \"./util/arrayBuffer.js\";\n\n/**\n * Checks if the body is a Blob or Blob-like\n */\nfunction isBlob(body: unknown): body is Blob {\n // File objects count as a type of Blob, so we want to use instanceof explicitly\n return (typeof Blob === \"function\" || typeof Blob === \"object\") && body instanceof Blob;\n}\n\n/**\n * A HttpClient implementation that uses window.fetch to send HTTP requests.\n * @internal\n */\nclass FetchHttpClient implements HttpClient {\n /**\n * Makes a request over an underlying transport layer and returns the response.\n * @param request - The request to be made.\n */\n public async sendRequest(request: PipelineRequest): Promise<PipelineResponse> {\n const url = new URL(request.url);\n const isInsecure = url.protocol !== \"https:\";\n\n if (isInsecure && !request.allowInsecureConnection) {\n throw new Error(`Cannot connect to ${request.url} while allowInsecureConnection is false.`);\n }\n\n if (request.proxySettings) {\n throw new Error(\"HTTP proxy is not supported in browser environment\");\n }\n\n try {\n return await makeRequest(request);\n } catch (e: any) {\n throw getError(e, request);\n }\n }\n}\n\n/**\n * Sends a request\n */\nasync function makeRequest(request: PipelineRequest): Promise<PipelineResponse> {\n const { abortController, abortControllerCleanup } = setupAbortSignal(request);\n try {\n const headers = buildFetchHeaders(request.headers);\n const { streaming, body: requestBody } = buildRequestBody(request);\n const requestInit: RequestInit = {\n body: requestBody,\n method: request.method,\n headers: headers,\n signal: abortController.signal,\n // Cloudflare doesn't implement the full Fetch API spec\n // because of some of it doesn't make sense in the edge.\n // See https://github.com/cloudflare/workerd/issues/902\n ...(\"credentials\" in Request.prototype\n ? { credentials: request.withCredentials ? \"include\" : \"same-origin\" }\n : {}),\n ...(\"cache\" in Request.prototype ? { cache: \"no-store\" } : {}),\n };\n\n // According to https://fetch.spec.whatwg.org/#fetch-method,\n // init.duplex must be set when body is a ReadableStream object.\n // currently \"half\" is the only valid value.\n if (streaming) {\n (requestInit as any).duplex = \"half\";\n }\n /**\n * Developers of the future:\n * Do not set redirect: \"manual\" as part\n * of request options.\n * It will not work as you expect.\n */\n const response = await fetch(request.url, {\n ...requestInit,\n ...request.requestOverrides,\n });\n // If we're uploading a blob, we need to fire the progress event manually\n if (isBlob(request.body) && request.onUploadProgress) {\n request.onUploadProgress({ loadedBytes: request.body.size });\n }\n return buildPipelineResponse(response, request, abortControllerCleanup);\n } catch (e) {\n abortControllerCleanup?.();\n throw e;\n }\n}\n\n/**\n * Creates a pipeline response from a Fetch response;\n */\nasync function buildPipelineResponse(\n httpResponse: Response,\n request: PipelineRequest,\n abortControllerCleanup?: () => void,\n): Promise<PipelineResponse> {\n const headers = buildPipelineHeaders(httpResponse);\n const response: PipelineResponse = {\n request,\n headers,\n status: httpResponse.status,\n };\n\n const bodyStream = isWebReadableStream(httpResponse.body)\n ? buildBodyStream(httpResponse.body, {\n onProgress: request.onDownloadProgress,\n onEnd: abortControllerCleanup,\n })\n : httpResponse.body;\n\n if (\n // Value of POSITIVE_INFINITY in streamResponseStatusCodes is considered as any status code\n request.streamResponseStatusCodes?.has(Number.POSITIVE_INFINITY) ||\n request.streamResponseStatusCodes?.has(response.status)\n ) {\n if (request.enableBrowserStreams) {\n response.browserStreamBody = bodyStream ?? undefined;\n } else {\n const responseStream = new Response(bodyStream);\n response.blobBody = responseStream.blob();\n abortControllerCleanup?.();\n }\n } else {\n const responseStream = new Response(bodyStream);\n\n response.bodyAsText = await responseStream.text();\n abortControllerCleanup?.();\n }\n\n return response;\n}\n\nfunction setupAbortSignal(request: PipelineRequest): {\n abortController: AbortController;\n abortControllerCleanup: (() => void) | undefined;\n} {\n const abortController = new AbortController();\n\n // Cleanup function\n let abortControllerCleanup: (() => void) | undefined;\n\n /**\n * Attach an abort listener to the request\n */\n let abortListener: ((event: any) => void) | undefined;\n if (request.abortSignal) {\n if (request.abortSignal.aborted) {\n throw new AbortError(\"The operation was aborted. Request has already been canceled.\");\n }\n\n abortListener = (event: Event) => {\n if (event.type === \"abort\") {\n abortController.abort();\n }\n };\n request.abortSignal.addEventListener(\"abort\", abortListener);\n abortControllerCleanup = () => {\n if (abortListener) {\n request.abortSignal?.removeEventListener(\"abort\", abortListener);\n }\n };\n }\n\n // If a timeout was passed, call the abort signal once the time elapses\n if (request.timeout > 0) {\n setTimeout(() => {\n abortController.abort();\n }, request.timeout);\n }\n\n return { abortController, abortControllerCleanup };\n}\n\n/**\n * Gets the specific error\n */\n// eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\nfunction getError(e: RestError, request: PipelineRequest): RestError {\n if (e && e?.name === \"AbortError\") {\n return e;\n } else {\n return new RestError(`Error sending request: ${e.message}`, {\n code: e?.code ?? RestError.REQUEST_SEND_ERROR,\n request,\n });\n }\n}\n\n/**\n * Converts PipelineRequest headers to Fetch headers\n */\nfunction buildFetchHeaders(pipelineHeaders: PipelineHeaders): Headers {\n const headers = new Headers();\n for (const [name, value] of pipelineHeaders) {\n headers.append(name, value);\n }\n\n return headers;\n}\n\nfunction buildPipelineHeaders(httpResponse: Response): PipelineHeaders {\n const responseHeaders = createHttpHeaders();\n for (const [name, value] of httpResponse.headers) {\n responseHeaders.set(name, value);\n }\n\n return responseHeaders;\n}\n\ninterface BuildRequestBodyResponse {\n body?: BodyInit | null;\n streaming: boolean;\n}\n\nfunction buildRequestBody(request: PipelineRequest): BuildRequestBodyResponse {\n const body = typeof request.body === \"function\" ? request.body() : request.body;\n if (isNodeReadableStream(body)) {\n throw new Error(\"Node streams are not supported in browser environment.\");\n }\n\n if (isWebReadableStream(body)) {\n return {\n streaming: true,\n body: buildBodyStream(body, { onProgress: request.onUploadProgress }),\n };\n } else if (typeof body === \"object\" && body && \"buffer\" in body) {\n // ArrayBufferView\n return { streaming: false, body: arrayBufferViewToArrayBuffer(body) };\n } else if (body === undefined) {\n return { streaming: false };\n } else {\n return { streaming: false, body };\n }\n}\n\n/**\n * Reads the request/response original stream and stream it through a new\n * ReadableStream, this is done to be able to report progress in a way that\n * all modern browsers support. TransformStreams would be an alternative,\n * however they are not yet supported by all browsers i.e Firefox\n */\nfunction buildBodyStream(\n readableStream: ReadableStream<Uint8Array>,\n options: { onProgress?: (progress: TransferProgressEvent) => void; onEnd?: () => void } = {},\n): ReadableStream<Uint8Array> {\n let loadedBytes = 0;\n const { onProgress, onEnd } = options;\n\n // If the current browser supports pipeThrough we use a TransformStream\n // to report progress\n if (isTransformStreamSupported(readableStream)) {\n return readableStream.pipeThrough(\n new TransformStream({\n transform(chunk, controller) {\n if (chunk === null) {\n controller.terminate();\n return;\n }\n\n controller.enqueue(chunk);\n loadedBytes += chunk.length;\n if (onProgress) {\n onProgress({ loadedBytes });\n }\n },\n flush() {\n onEnd?.();\n },\n }),\n );\n } else {\n // If we can't use transform streams, wrap the original stream in a new readable stream\n // and use pull to enqueue each chunk and report progress.\n const reader = readableStream.getReader();\n return new ReadableStream({\n async pull(controller) {\n const { done, value } = await reader.read();\n // When no more data needs to be consumed, break the reading\n if (done || !value) {\n onEnd?.();\n // Close the stream\n controller.close();\n reader.releaseLock();\n return;\n }\n\n loadedBytes += value?.length ?? 0;\n\n // Enqueue the next data chunk into our target stream\n controller.enqueue(value);\n\n if (onProgress) {\n onProgress({ loadedBytes });\n }\n },\n cancel(reason?: string) {\n onEnd?.();\n return reader.cancel(reason);\n },\n });\n }\n}\n\n/**\n * Create a new HttpClient instance for the browser environment.\n * @internal\n */\nexport function createFetchHttpClient(): HttpClient {\n return new FetchHttpClient();\n}\n\nfunction isTransformStreamSupported(readableStream: ReadableStream): boolean {\n return readableStream.pipeThrough !== undefined && self.TransformStream !== undefined;\n}\n"]}
1
+ {"version":3,"file":"fetchHttpClient.js","sourceRoot":"","sources":["../../src/fetchHttpClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAQ9D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAUrE;;GAEG;AACH,SAAS,MAAM,CAAC,IAAa;IAC3B,gFAAgF;IAChF,OAAO,CAAC,OAAO,IAAI,KAAK,UAAU,IAAI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AC;oBACrB,OAAO;gBACT,CAAC;gBAED,WAAW,IAAI,KAAK,EAAE,MAAM,IAAI,CAAC,CAAC;gBAElC,qDAAqD;gBACrD,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBAE1B,IAAI,UAAU,EAAE,CAAC;oBACf,UAAU,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;gBAC9B,CAAC;YACH,CAAC;YACD,MAAM,CAAC,MAAe;gBACpB,KAAK,EAAE,EAAE,CAAC;gBACV,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC/B,CAAC;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO,IAAI,eAAe,EAAE,CAAC;AAC/B,CAAC;AAED,SAAS,0BAA0B,CAAC,cAA8B;IAChE,OAAO,cAAc,CAAC,WAAW,KAAK,SAAS,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,CAAC;AACxF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { AbortError } from \"./abort-controller/AbortError.js\";\nimport type {\n HttpClient,\n HttpHeaders as PipelineHeaders,\n PipelineRequest,\n PipelineResponse,\n TransferProgressEvent,\n} from \"./interfaces.js\";\nimport { RestError } from \"./restError.js\";\nimport { createHttpHeaders } from \"./httpHeaders.js\";\nimport { isNodeReadableStream, isWebReadableStream } from \"./util/typeGuards.js\";\nimport { arrayBufferViewToArrayBuffer } from \"./util/arrayBuffer.js\";\n\n// The Fetch spec requires `duplex: \"half\"` when body is a ReadableStream,\n// but TypeScript's lib.dom.d.ts hasn't added it to RequestInit yet.\ndeclare global {\n interface RequestInit {\n duplex?: \"half\";\n }\n}\n\n/**\n * Checks if the body is a Blob or Blob-like\n */\nfunction isBlob(body: unknown): body is Blob {\n // File objects count as a type of Blob, so we want to use instanceof explicitly\n return (typeof Blob === \"function\" || typeof Blob === \"object\") && body instanceof Blob;\n}\n\n/**\n * A HttpClient implementation that uses window.fetch to send HTTP requests.\n * @internal\n */\nclass FetchHttpClient implements HttpClient {\n /**\n * Makes a request over an underlying transport layer and returns the response.\n * @param request - The request to be made.\n */\n public async sendRequest(request: PipelineRequest): Promise<PipelineResponse> {\n const url = new URL(request.url);\n const isInsecure = url.protocol !== \"https:\";\n\n if (isInsecure && !request.allowInsecureConnection) {\n throw new Error(`Cannot connect to ${request.url} while allowInsecureConnection is false.`);\n }\n\n if (request.proxySettings) {\n throw new Error(\"HTTP proxy is not supported in browser environment\");\n }\n\n try {\n return await makeRequest(request);\n } catch (e: any) {\n throw getError(e, request);\n }\n }\n}\n\n/**\n * Sends a request\n */\nasync function makeRequest(request: PipelineRequest): Promise<PipelineResponse> {\n const { abortController, abortControllerCleanup } = setupAbortSignal(request);\n try {\n const headers = buildFetchHeaders(request.headers);\n const { streaming, body: requestBody } = buildRequestBody(request);\n const requestInit: RequestInit = {\n body: requestBody,\n method: request.method,\n headers: headers,\n signal: abortController.signal,\n // Cloudflare doesn't implement the full Fetch API spec\n // because of some of it doesn't make sense in the edge.\n // See https://github.com/cloudflare/workerd/issues/902\n ...(\"credentials\" in Request.prototype\n ? { credentials: request.withCredentials ? \"include\" : \"same-origin\" }\n : {}),\n ...(\"cache\" in Request.prototype ? { cache: \"no-store\" } : {}),\n };\n\n // According to https://fetch.spec.whatwg.org/#fetch-method,\n // init.duplex must be set when body is a ReadableStream object.\n // currently \"half\" is the only valid value.\n if (streaming) {\n requestInit.duplex = \"half\";\n }\n /**\n * Developers of the future:\n * Do not set redirect: \"manual\" as part\n * of request options.\n * It will not work as you expect.\n */\n const response = await fetch(request.url, {\n ...requestInit,\n ...request.requestOverrides,\n });\n // If we're uploading a blob, we need to fire the progress event manually\n if (isBlob(request.body) && request.onUploadProgress) {\n request.onUploadProgress({ loadedBytes: request.body.size });\n }\n return buildPipelineResponse(response, request, abortControllerCleanup);\n } catch (e) {\n abortControllerCleanup?.();\n throw e;\n }\n}\n\n/**\n * Creates a pipeline response from a Fetch response;\n */\nasync function buildPipelineResponse(\n httpResponse: Response,\n request: PipelineRequest,\n abortControllerCleanup?: () => void,\n): Promise<PipelineResponse> {\n const headers = buildPipelineHeaders(httpResponse);\n const response: PipelineResponse = {\n request,\n headers,\n status: httpResponse.status,\n };\n\n const bodyStream = isWebReadableStream(httpResponse.body)\n ? buildBodyStream(httpResponse.body, {\n onProgress: request.onDownloadProgress,\n onEnd: abortControllerCleanup,\n })\n : httpResponse.body;\n\n if (\n // Value of POSITIVE_INFINITY in streamResponseStatusCodes is considered as any status code\n request.streamResponseStatusCodes?.has(Number.POSITIVE_INFINITY) ||\n request.streamResponseStatusCodes?.has(response.status)\n ) {\n if (request.enableBrowserStreams) {\n response.browserStreamBody = bodyStream ?? undefined;\n } else {\n const responseStream = new Response(bodyStream);\n response.blobBody = responseStream.blob();\n abortControllerCleanup?.();\n }\n } else {\n const responseStream = new Response(bodyStream);\n\n response.bodyAsText = await responseStream.text();\n abortControllerCleanup?.();\n }\n\n return response;\n}\n\nfunction setupAbortSignal(request: PipelineRequest): {\n abortController: AbortController;\n abortControllerCleanup: (() => void) | undefined;\n} {\n const abortController = new AbortController();\n\n // Cleanup function\n let abortControllerCleanup: (() => void) | undefined;\n\n /**\n * Attach an abort listener to the request\n */\n let abortListener: ((event: any) => void) | undefined;\n if (request.abortSignal) {\n if (request.abortSignal.aborted) {\n throw new AbortError(\"The operation was aborted. Request has already been canceled.\");\n }\n\n abortListener = (event: Event) => {\n if (event.type === \"abort\") {\n abortController.abort();\n }\n };\n request.abortSignal.addEventListener(\"abort\", abortListener);\n abortControllerCleanup = () => {\n if (abortListener) {\n request.abortSignal?.removeEventListener(\"abort\", abortListener);\n }\n };\n }\n\n // If a timeout was passed, call the abort signal once the time elapses\n if (request.timeout > 0) {\n setTimeout(() => {\n abortController.abort();\n }, request.timeout);\n }\n\n return { abortController, abortControllerCleanup };\n}\n\n/**\n * Gets the specific error\n */\n// eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\nfunction getError(e: RestError, request: PipelineRequest): RestError {\n if (e && e?.name === \"AbortError\") {\n return e;\n } else {\n return new RestError(`Error sending request: ${e.message}`, {\n code: e?.code ?? RestError.REQUEST_SEND_ERROR,\n request,\n });\n }\n}\n\n/**\n * Converts PipelineRequest headers to Fetch headers\n */\nfunction buildFetchHeaders(pipelineHeaders: PipelineHeaders): Headers {\n const headers = new Headers();\n for (const [name, value] of pipelineHeaders) {\n headers.append(name, value);\n }\n\n return headers;\n}\n\nfunction buildPipelineHeaders(httpResponse: Response): PipelineHeaders {\n const responseHeaders = createHttpHeaders();\n for (const [name, value] of httpResponse.headers) {\n responseHeaders.set(name, value);\n }\n\n return responseHeaders;\n}\n\ninterface BuildRequestBodyResponse {\n body?: BodyInit | null;\n streaming: boolean;\n}\n\nfunction buildRequestBody(request: PipelineRequest): BuildRequestBodyResponse {\n const body = typeof request.body === \"function\" ? request.body() : request.body;\n if (isNodeReadableStream(body)) {\n throw new Error(\"Node streams are not supported in browser environment.\");\n }\n\n if (isWebReadableStream(body)) {\n return {\n streaming: true,\n body: buildBodyStream(body, { onProgress: request.onUploadProgress }),\n };\n } else if (typeof body === \"object\" && body && \"buffer\" in body) {\n // ArrayBufferView\n return { streaming: false, body: arrayBufferViewToArrayBuffer(body) };\n } else if (body === undefined) {\n return { streaming: false };\n } else {\n return { streaming: false, body };\n }\n}\n\n/**\n * Reads the request/response original stream and stream it through a new\n * ReadableStream, this is done to be able to report progress in a way that\n * all modern browsers support. TransformStreams would be an alternative,\n * however they are not yet supported by all browsers i.e Firefox\n */\nfunction buildBodyStream(\n readableStream: ReadableStream<Uint8Array>,\n options: { onProgress?: (progress: TransferProgressEvent) => void; onEnd?: () => void } = {},\n): ReadableStream<Uint8Array> {\n let loadedBytes = 0;\n const { onProgress, onEnd } = options;\n\n // If the current browser supports pipeThrough we use a TransformStream\n // to report progress\n if (isTransformStreamSupported(readableStream)) {\n return readableStream.pipeThrough(\n new TransformStream({\n transform(chunk, controller) {\n if (chunk === null) {\n controller.terminate();\n return;\n }\n\n controller.enqueue(chunk);\n loadedBytes += chunk.length;\n if (onProgress) {\n onProgress({ loadedBytes });\n }\n },\n flush() {\n onEnd?.();\n },\n }),\n );\n } else {\n // If we can't use transform streams, wrap the original stream in a new readable stream\n // and use pull to enqueue each chunk and report progress.\n const reader = readableStream.getReader();\n return new ReadableStream({\n async pull(controller) {\n const { done, value } = await reader.read();\n // When no more data needs to be consumed, break the reading\n if (done || !value) {\n onEnd?.();\n // Close the stream\n controller.close();\n reader.releaseLock();\n return;\n }\n\n loadedBytes += value?.length ?? 0;\n\n // Enqueue the next data chunk into our target stream\n controller.enqueue(value);\n\n if (onProgress) {\n onProgress({ loadedBytes });\n }\n },\n cancel(reason?: string) {\n onEnd?.();\n return reader.cancel(reason);\n },\n });\n }\n}\n\n/**\n * Create a new HttpClient instance for the browser environment.\n * @internal\n */\nexport function createFetchHttpClient(): HttpClient {\n return new FetchHttpClient();\n}\n\nfunction isTransformStreamSupported(readableStream: ReadableStream): boolean {\n return readableStream.pipeThrough !== undefined && self.TransformStream !== undefined;\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type { FormDataMap } from "./interfaces.js";
2
+ /**
3
+ * Browser and React Native runtimes handle FormData natively,
4
+ * so no conversion from FormData to FormDataMap is needed.
5
+ *
6
+ * @internal
7
+ */
8
+ export declare function convertBodyToFormDataMap(_body: unknown): FormDataMap | undefined;
9
+ //# sourceMappingURL=formData-web.d.mts.map
@@ -0,0 +1,12 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ /**
4
+ * Browser and React Native runtimes handle FormData natively,
5
+ * so no conversion from FormData to FormDataMap is needed.
6
+ *
7
+ * @internal
8
+ */
9
+ export function convertBodyToFormDataMap(_body) {
10
+ return undefined;
11
+ }
12
+ //# sourceMappingURL=formData-web.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formData-web.mjs","sourceRoot":"","sources":["../../src/formData-web.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACrD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { FormDataMap } from \"./interfaces.js\";\n\n/**\n * Browser and React Native runtimes handle FormData natively,\n * so no conversion from FormData to FormDataMap is needed.\n *\n * @internal\n */\nexport function convertBodyToFormDataMap(_body: unknown): FormDataMap | undefined {\n return undefined;\n}\n"]}
@@ -3,6 +3,16 @@
3
3
  function normalizeName(name) {
4
4
  return name.toLowerCase();
5
5
  }
6
+ /**
7
+ * Removes CR and LF characters from a header value to prevent obs-fold
8
+ * (line folding) sequences, as forbidden by RFC 7230 §3.2.4.
9
+ * @param value - The header value to sanitize.
10
+ */
11
+ function normalizeValue(value) {
12
+ return String(value)
13
+ .trim()
14
+ .replace(/[\r\n]/g, "");
15
+ }
6
16
  function* headerIterator(map) {
7
17
  for (const entry of map.values()) {
8
18
  yield [entry.name, entry.value];
@@ -25,7 +35,7 @@ class HttpHeadersImpl {
25
35
  * @param value - The value of the header to set.
26
36
  */
27
37
  set(name, value) {
28
- this._headersMap.set(normalizeName(name), { name, value: String(value).trim() });
38
+ this._headersMap.set(normalizeName(name), { name, value: normalizeValue(value) });
29
39
  }
30
40
  /**
31
41
  * Get the header value for the provided header name, or undefined if no header exists in this
@@ -1 +1 @@
1
- {"version":3,"file":"httpHeaders.js","sourceRoot":"","sources":["../../src/httpHeaders.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC;AAED,QAAQ,CAAC,CAAC,cAAc,CAAC,GAA6B;IACpD,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC;QACjC,MAAM,C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AE,EAAE,CAAC;gBAC9C,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;YACnC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,KAAK,MAAM,CAAC,cAAc,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;gBACvD,MAAM,CAAC,cAAc,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;YACvC,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC;QACf,OAAO,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAgC;IAChE,OAAO,IAAI,eAAe,CAAC,UAAU,CAAC,CAAC;AACzC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { HttpHeaders, RawHttpHeaders, RawHttpHeadersInput } from \"./interfaces.js\";\n\ninterface HeaderEntry {\n name: string;\n value: string;\n}\n\nfunction normalizeName(name: string): string {\n return name.toLowerCase();\n}\n\nfunction* headerIterator(map: Map<string, HeaderEntry>): IterableIterator<[string, string]> {\n for (const entry of map.values()) {\n yield [entry.name, entry.value];\n }\n}\n\nclass HttpHeadersImpl implements HttpHeaders {\n private readonly _headersMap: Map<string, HeaderEntry>;\n\n constructor(rawHeaders?: RawHttpHeaders | RawHttpHeadersInput) {\n this._headersMap = new Map<string, HeaderEntry>();\n if (rawHeaders) {\n for (const headerName of Object.keys(rawHeaders)) {\n this.set(headerName, rawHeaders[headerName]);\n }\n }\n }\n\n /**\n * Set a header in this collection with the provided name and value. The name is\n * case-insensitive.\n * @param name - The name of the header to set. This value is case-insensitive.\n * @param value - The value of the header to set.\n */\n public set(name: string, value: string | number | boolean): void {\n this._headersMap.set(normalizeName(name), { name, value: String(value).trim() });\n }\n\n /**\n * Get the header value for the provided header name, or undefined if no header exists in this\n * collection with the provided name.\n * @param name - The name of the header. This value is case-insensitive.\n */\n public get(name: string): string | undefined {\n return this._headersMap.get(normalizeName(name))?.value;\n }\n\n /**\n * Get whether or not this header collection contains a header entry for the provided header name.\n * @param name - The name of the header to set. This value is case-insensitive.\n */\n public has(name: string): boolean {\n return this._headersMap.has(normalizeName(name));\n }\n\n /**\n * Remove the header with the provided headerName.\n * @param name - The name of the header to remove.\n */\n public delete(name: string): void {\n this._headersMap.delete(normalizeName(name));\n }\n\n /**\n * Get the JSON object representation of this HTTP header collection.\n */\n public toJSON(options: { preserveCase?: boolean } = {}): RawHttpHeaders {\n const result: RawHttpHeaders = {};\n if (options.preserveCase) {\n for (const entry of this._headersMap.values()) {\n result[entry.name] = entry.value;\n }\n } else {\n for (const [normalizedName, entry] of this._headersMap) {\n result[normalizedName] = entry.value;\n }\n }\n\n return result;\n }\n\n /**\n * Get the string representation of this HTTP header collection.\n */\n public toString(): string {\n return JSON.stringify(this.toJSON({ preserveCase: true }));\n }\n\n /**\n * Iterate over tuples of header [name, value] pairs.\n */\n [Symbol.iterator](): Iterator<[string, string]> {\n return headerIterator(this._headersMap);\n }\n}\n\n/**\n * Creates an object that satisfies the `HttpHeaders` interface.\n * @param rawHeaders - A simple object representing initial headers\n */\nexport function createHttpHeaders(rawHeaders?: RawHttpHeadersInput): HttpHeaders {\n return new HttpHeadersImpl(rawHeaders);\n}\n"]}
1
+ {"version":3,"file":"httpHeaders.js","sourceRoot":"","sources":["../../src/httpHeaders.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AASlC,SAAS,aAAa,CAAC,IAAY;IACjC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC;A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AAC,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,UAAsC,EAAE;QACpD,MAAM,MAAM,GAAmB,EAAE,CAAC;QAClC,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;YACzB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC;gBAC9C,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;YACnC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,KAAK,MAAM,CAAC,cAAc,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;gBACvD,MAAM,CAAC,cAAc,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;YACvC,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC;QACf,OAAO,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC1C,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,UAAgC;IAChE,OAAO,IAAI,eAAe,CAAC,UAAU,CAAC,CAAC;AACzC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { HttpHeaders, RawHttpHeaders, RawHttpHeadersInput } from \"./interfaces.js\";\n\ninterface HeaderEntry {\n name: string;\n value: string;\n}\n\nfunction normalizeName(name: string): string {\n return name.toLowerCase();\n}\n\n/**\n * Removes CR and LF characters from a header value to prevent obs-fold\n * (line folding) sequences, as forbidden by RFC 7230 §3.2.4.\n * @param value - The header value to sanitize.\n */\nfunction normalizeValue(value: string | number | boolean): string {\n return String(value)\n .trim()\n .replace(/[\\r\\n]/g, \"\");\n}\n\nfunction* headerIterator(map: Map<string, HeaderEntry>): IterableIterator<[string, string]> {\n for (const entry of map.values()) {\n yield [entry.name, entry.value];\n }\n}\n\nclass HttpHeadersImpl implements HttpHeaders {\n private readonly _headersMap: Map<string, HeaderEntry>;\n\n constructor(rawHeaders?: RawHttpHeaders | RawHttpHeadersInput) {\n this._headersMap = new Map<string, HeaderEntry>();\n if (rawHeaders) {\n for (const headerName of Object.keys(rawHeaders)) {\n this.set(headerName, rawHeaders[headerName]);\n }\n }\n }\n\n /**\n * Set a header in this collection with the provided name and value. The name is\n * case-insensitive.\n * @param name - The name of the header to set. This value is case-insensitive.\n * @param value - The value of the header to set.\n */\n public set(name: string, value: string | number | boolean): void {\n this._headersMap.set(normalizeName(name), { name, value: normalizeValue(value) });\n }\n\n /**\n * Get the header value for the provided header name, or undefined if no header exists in this\n * collection with the provided name.\n * @param name - The name of the header. This value is case-insensitive.\n */\n public get(name: string): string | undefined {\n return this._headersMap.get(normalizeName(name))?.value;\n }\n\n /**\n * Get whether or not this header collection contains a header entry for the provided header name.\n * @param name - The name of the header to set. This value is case-insensitive.\n */\n public has(name: string): boolean {\n return this._headersMap.has(normalizeName(name));\n }\n\n /**\n * Remove the header with the provided headerName.\n * @param name - The name of the header to remove.\n */\n public delete(name: string): void {\n this._headersMap.delete(normalizeName(name));\n }\n\n /**\n * Get the JSON object representation of this HTTP header collection.\n */\n public toJSON(options: { preserveCase?: boolean } = {}): RawHttpHeaders {\n const result: RawHttpHeaders = {};\n if (options.preserveCase) {\n for (const entry of this._headersMap.values()) {\n result[entry.name] = entry.value;\n }\n } else {\n for (const [normalizedName, entry] of this._headersMap) {\n result[normalizedName] = entry.value;\n }\n }\n\n return result;\n }\n\n /**\n * Get the string representation of this HTTP header collection.\n */\n public toString(): string {\n return JSON.stringify(this.toJSON({ preserveCase: true }));\n }\n\n /**\n * Iterate over tuples of header [name, value] pairs.\n */\n [Symbol.iterator](): Iterator<[string, string]> {\n return headerIterator(this._headersMap);\n }\n}\n\n/**\n * Creates an object that satisfies the `HttpHeaders` interface.\n * @param rawHeaders - A simple object representing initial headers\n */\nexport function createHttpHeaders(rawHeaders?: RawHttpHeadersInput): HttpHeaders {\n return new HttpHeadersImpl(rawHeaders);\n}\n"]}
@@ -1,16 +1,5 @@
1
- declare global {
2
- interface FormData {
3
- }
4
- interface Blob {
5
- }
6
- interface File {
7
- }
8
- interface ReadableStream<R = any> {
9
- }
10
- interface TransformStream<I = any, O = any> {
11
- }
12
- }
13
1
  export { AbortError } from "./abort-controller/AbortError.js";
2
+ export type { NodeReadableStream, NodeBuffer, WebReadableStream } from "./types-browser.mjs";
14
3
  export { createClientLogger, getLogLevel, setLogLevel, TypeSpecRuntimeLogger, type Debugger, type TypeSpecRuntimeClientLogger, type TypeSpecRuntimeLogLevel, } from "./logger/logger.js";
15
4
  export type { BodyPart, FormDataValue, RawHttpHeaders, KeyObject, PxfObject, HttpClient, PipelineRequest, PipelineResponse, SendRequest, TlsSettings, Agent, RequestBodyType, FormDataMap, HttpHeaders, HttpMethods, MultipartRequestBody, TransferProgressEvent, ProxySettings, RawHttpHeadersInput, PipelineRetryOptions, } from "./interfaces.js";
16
5
  export { createHttpHeaders } from "./httpHeaders.js";
@@ -20,8 +9,8 @@ export { type BasicCredential, type BearerTokenCredential, type OAuth2TokenCrede
20
9
  export { createPipelineRequest, type PipelineRequestOptions } from "./pipelineRequest.js";
21
10
  export { type Pipeline, type PipelinePolicy, type AddPolicyOptions, type PipelinePhase, createEmptyPipeline, } from "./pipeline.js";
22
11
  export { RestError, isRestError, type RestErrorOptions } from "./restError.js";
23
- export { stringToUint8Array, uint8ArrayToString, type EncodingType } from "./util/bytesEncoding.js";
24
- export { createDefaultHttpClient } from "./defaultHttpClient.js";
12
+ export { stringToUint8Array, uint8ArrayToString, type EncodingType } from "./util/bytesEncoding-web.mjs";
13
+ export { createDefaultHttpClient } from "./defaultHttpClient-browser.mjs";
25
14
  export { getClient } from "./client/getClient.js";
26
15
  export { operationOptionsToRequestParameters } from "./client/operationOptionHelpers.js";
27
16
  export { createRestError } from "./client/restError.js";
@@ -6,8 +6,8 @@ export { createHttpHeaders } from "./httpHeaders.js";
6
6
  export { createPipelineRequest } from "./pipelineRequest.js";
7
7
  export { createEmptyPipeline, } from "./pipeline.js";
8
8
  export { RestError, isRestError } from "./restError.js";
9
- export { stringToUint8Array, uint8ArrayToString } from "./util/bytesEncoding.js";
10
- export { createDefaultHttpClient } from "./defaultHttpClient.js";
9
+ export { stringToUint8Array, uint8ArrayToString } from "./util/bytesEncoding-web.mjs";
10
+ export { createDefaultHttpClient } from "./defaultHttpClient-browser.mjs";
11
11
  export { getClient } from "./client/getClient.js";
12
12
  export { operationOptionsToRequestParameters } from "./client/operationOptionHelpers.js";
13
13
  export { createRestError } from "./client/restError.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAUlC,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,qBAAqB,GAItB,MAAM,oBAAoB,CAAC;AAwB5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAYrD,OAAO,EAAE,qBAAqB,EAA+B,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAKL,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAqB,MAAM,yBAAyB,CAAC;AACpG,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,mCAAmC,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\ndeclare global {\n interface FormData {}\n interface Blob {}\n interface File {}\n interface ReadableStream<R = any> {}\n interface TransformStream<I = any, O = any> {}\n}\n\nexport { AbortError } from \"./abort-controller/AbortError.js\";\nexport {\n createClientLogger,\n getLogLevel,\n setLogLevel,\n TypeSpecRuntimeLogger,\n type Debugger,\n type TypeSpecRuntimeClientLogger,\n type TypeSpecRuntimeLogLevel,\n} from \"./logger/logger.js\";\n\nexport type {\n BodyPart,\n FormDataValue,\n RawHttpHeaders,\n KeyObject,\n PxfObject,\n HttpClient,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n TlsSettings,\n Agent,\n RequestBodyType,\n FormDataMap,\n HttpHeaders,\n HttpMethods,\n MultipartRequestBody,\n TransferProgressEvent,\n ProxySettings,\n RawHttpHeadersInput,\n PipelineRetryOptions,\n} from \"./interfaces.js\";\nexport { createHttpHeaders } from \"./httpHeaders.js\";\nexport type * from \"./auth/schemes.js\";\nexport type * from \"./auth/oauth2Flows.js\";\nexport {\n type BasicCredential,\n type BearerTokenCredential,\n type OAuth2TokenCredential,\n type GetOAuth2TokenOptions,\n type GetBearerTokenOptions,\n type ApiKeyCredential,\n type ClientCredential,\n} from \"./auth/credentials.js\";\nexport { createPipelineRequest, type PipelineRequestOptions } from \"./pipelineRequest.js\";\nexport {\n type Pipeline,\n type PipelinePolicy,\n type AddPolicyOptions,\n type PipelinePhase,\n createEmptyPipeline,\n} from \"./pipeline.js\";\nexport { RestError, isRestError, type RestErrorOptions } from \"./restError.js\";\nexport { stringToUint8Array, uint8ArrayToString, type EncodingType } from \"./util/bytesEncoding.js\";\nexport { createDefaultHttpClient } from \"./defaultHttpClient.js\";\nexport { getClient } from \"./client/getClient.js\";\nexport { operationOptionsToRequestParameters } from \"./client/operationOptionHelpers.js\";\nexport { createRestError } from \"./client/restError.js\";\nexport type {\n Client,\n ClientOptions,\n OperationOptions,\n AdditionalPolicyConfig,\n PathUnchecked,\n PathUncheckedResponse,\n HttpResponse,\n RawResponseCallback,\n OperationRequestOptions,\n PathParameters,\n ResourceMethods,\n PathParameterWithOptions,\n StreamableMethod,\n RequestParameters,\n HttpNodeStreamResponse,\n HttpBrowserStreamResponse,\n FullOperationResponse,\n} from \"./client/common.js\";\nexport type { PipelineOptions, TelemetryOptions } from \"./createPipelineFromOptions.js\";\nexport type { LogPolicyOptions } from \"./policies/logPolicy.js\";\nexport type { RedirectPolicyOptions } from \"./policies/redirectPolicy.js\";\nexport type { UserAgentPolicyOptions } from \"./policies/userAgentPolicy.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAE9D,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,qBAAqB,GAItB,MAAM,oBAAoB,CAAC;AAwB5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAYrD,OAAO,EAAE,qBAAqB,EAA+B,MAAM,sBAAsB,CAAC;AAC1F,OAAO,EAKL,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,WAAW,EAAyB,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAqB,MAAM,yBAAyB,CAAC;AACpG,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,mCAAmC,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nexport { AbortError } from \"./abort-controller/AbortError.js\";\nexport type { NodeReadableStream, NodeBuffer, WebReadableStream } from \"#platform/types\";\nexport {\n createClientLogger,\n getLogLevel,\n setLogLevel,\n TypeSpecRuntimeLogger,\n type Debugger,\n type TypeSpecRuntimeClientLogger,\n type TypeSpecRuntimeLogLevel,\n} from \"./logger/logger.js\";\n\nexport type {\n BodyPart,\n FormDataValue,\n RawHttpHeaders,\n KeyObject,\n PxfObject,\n HttpClient,\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n TlsSettings,\n Agent,\n RequestBodyType,\n FormDataMap,\n HttpHeaders,\n HttpMethods,\n MultipartRequestBody,\n TransferProgressEvent,\n ProxySettings,\n RawHttpHeadersInput,\n PipelineRetryOptions,\n} from \"./interfaces.js\";\nexport { createHttpHeaders } from \"./httpHeaders.js\";\nexport type * from \"./auth/schemes.js\";\nexport type * from \"./auth/oauth2Flows.js\";\nexport {\n type BasicCredential,\n type BearerTokenCredential,\n type OAuth2TokenCredential,\n type GetOAuth2TokenOptions,\n type GetBearerTokenOptions,\n type ApiKeyCredential,\n type ClientCredential,\n} from \"./auth/credentials.js\";\nexport { createPipelineRequest, type PipelineRequestOptions } from \"./pipelineRequest.js\";\nexport {\n type Pipeline,\n type PipelinePolicy,\n type AddPolicyOptions,\n type PipelinePhase,\n createEmptyPipeline,\n} from \"./pipeline.js\";\nexport { RestError, isRestError, type RestErrorOptions } from \"./restError.js\";\nexport { stringToUint8Array, uint8ArrayToString, type EncodingType } from \"#platform/bytesEncoding\";\nexport { createDefaultHttpClient } from \"#platform/httpClient\";\nexport { getClient } from \"./client/getClient.js\";\nexport { operationOptionsToRequestParameters } from \"./client/operationOptionHelpers.js\";\nexport { createRestError } from \"./client/restError.js\";\nexport type {\n Client,\n ClientOptions,\n OperationOptions,\n AdditionalPolicyConfig,\n PathUnchecked,\n PathUncheckedResponse,\n HttpResponse,\n RawResponseCallback,\n OperationRequestOptions,\n PathParameters,\n ResourceMethods,\n PathParameterWithOptions,\n StreamableMethod,\n RequestParameters,\n HttpNodeStreamResponse,\n HttpBrowserStreamResponse,\n FullOperationResponse,\n} from \"./client/common.js\";\nexport type { PipelineOptions, TelemetryOptions } from \"./createPipelineFromOptions.js\";\nexport type { LogPolicyOptions } from \"./policies/logPolicy.js\";\nexport type { RedirectPolicyOptions } from \"./policies/redirectPolicy.js\";\nexport type { UserAgentPolicyOptions } from \"./policies/userAgentPolicy.js\";\n"]}
@@ -1,4 +1,5 @@
1
1
  import type { AuthScheme } from "./auth/schemes.js";
2
+ import type { NodeBuffer, NodeReadableStream, WebReadableStream } from "./types-browser.mjs";
2
3
  /**
3
4
  * A HttpHeaders collection represented as a simple JSON object.
4
5
  */
@@ -54,7 +55,7 @@ export interface BodyPart {
54
55
  /**
55
56
  * The body of this part of the multipart request.
56
57
  */
57
- body: ((() => ReadableStream<Uint8Array>) | (() => NodeJS.ReadableStream)) | ReadableStream<Uint8Array> | NodeJS.ReadableStream | Uint8Array | Blob;
58
+ body: ((() => WebReadableStream<Uint8Array>) | (() => NodeReadableStream)) | WebReadableStream<Uint8Array> | NodeReadableStream | Uint8Array | Blob;
58
59
  }
59
60
  /**
60
61
  * A request body consisting of multiple parts.
@@ -77,7 +78,7 @@ export interface MultipartRequestBody {
77
78
  * NodeJS.ReadableStream and () =\> NodeJS.ReadableStream is Node only.
78
79
  * Blob, ReadableStream<Uint8Array>, and () =\> ReadableStream<Uint8Array> are browser only.
79
80
  */
80
- export type RequestBodyType = NodeJS.ReadableStream | (() => NodeJS.ReadableStream) | ReadableStream<Uint8Array> | (() => ReadableStream<Uint8Array>) | Blob | ArrayBuffer | ArrayBufferView | FormData | string | null;
81
+ export type RequestBodyType = NodeReadableStream | (() => NodeReadableStream) | WebReadableStream<Uint8Array> | (() => WebReadableStream<Uint8Array>) | Blob | ArrayBuffer | ArrayBufferView | FormData | string | null;
81
82
  /**
82
83
  * An interface compatible with NodeJS's `http.Agent`.
83
84
  * We want to avoid publicly re-exporting the actual interface,
@@ -245,14 +246,14 @@ export interface PipelineResponse {
245
246
  * The response body as a browser ReadableStream.
246
247
  * Always undefined in node.js.
247
248
  */
248
- browserStreamBody?: ReadableStream<Uint8Array>;
249
+ browserStreamBody?: WebReadableStream<Uint8Array>;
249
250
  /**
250
251
  * NODEJS ONLY
251
252
  *
252
253
  * The response body as a node.js Readable stream.
253
254
  * Always undefined in the browser.
254
255
  */
255
- readableStreamBody?: NodeJS.ReadableStream;
256
+ readableStreamBody?: NodeReadableStream;
256
257
  }
257
258
  /**
258
259
  * A simple interface for making a pipeline request and receiving a response.
@@ -343,7 +344,7 @@ export interface CertificateCredential {
343
344
  * the well-known CAs curated by Mozilla. Mozilla's CAs are completely
344
345
  * replaced when CAs are explicitly specified using this option.
345
346
  */
346
- ca?: string | Buffer | Array<string | Buffer> | undefined;
347
+ ca?: string | NodeBuffer | Array<string | NodeBuffer> | undefined;
347
348
  /**
348
349
  * Cert chains in PEM format. One cert chain should be provided per
349
350
  * private key. Each cert chain should consist of the PEM formatted
@@ -355,7 +356,7 @@ export interface CertificateCredential {
355
356
  * intermediate certificates are not provided, the peer will not be
356
357
  * able to validate the certificate, and the handshake will fail.
357
358
  */
358
- cert?: string | Buffer | Array<string | Buffer> | undefined;
359
+ cert?: string | NodeBuffer | Array<string | NodeBuffer> | undefined;
359
360
  /**
360
361
  * Private keys in PEM format. PEM allows the option of private keys
361
362
  * being encrypted. Encrypted keys will be decrypted with
@@ -365,7 +366,7 @@ export interface CertificateCredential {
365
366
  * The object form can only occur in an array.object.passphrase is optional.
366
367
  * Encrypted keys will be decrypted with object.passphrase if provided, or options.passphrase if it is not.
367
368
  */
368
- key?: string | Buffer | Array<Buffer | KeyObject> | undefined;
369
+ key?: string | NodeBuffer | Array<NodeBuffer | KeyObject> | undefined;
369
370
  /**
370
371
  * Shared passphrase used for a single private key and/or a PFX.
371
372
  */
@@ -379,7 +380,7 @@ export interface CertificateCredential {
379
380
  * The object form can only occur in an array.object.passphrase is optional.
380
381
  * Encrypted PFX will be decrypted with object.passphrase if provided, or options.passphrase if it is not.
381
382
  */
382
- pfx?: string | Buffer | Array<string | Buffer | PxfObject> | undefined;
383
+ pfx?: string | NodeBuffer | Array<string | NodeBuffer | PxfObject> | undefined;
383
384
  }
384
385
  /**
385
386
  * Represents a certificate for TLS authentication.
@@ -390,7 +391,7 @@ export interface TlsSettings {
390
391
  * the well-known CAs curated by Mozilla. Mozilla's CAs are completely
391
392
  * replaced when CAs are explicitly specified using this option.
392
393
  */
393
- ca?: string | Buffer | Array<string | Buffer> | undefined;
394
+ ca?: string | NodeBuffer | Array<string | NodeBuffer> | undefined;
394
395
  /**
395
396
  * Cert chains in PEM format. One cert chain should be provided per
396
397
  * private key. Each cert chain should consist of the PEM formatted
@@ -402,7 +403,7 @@ export interface TlsSettings {
402
403
  * intermediate certificates are not provided, the peer will not be
403
404
  * able to validate the certificate, and the handshake will fail.
404
405
  */
405
- cert?: string | Buffer | Array<string | Buffer> | undefined;
406
+ cert?: string | NodeBuffer | Array<string | NodeBuffer> | undefined;
406
407
  /**
407
408
  * Private keys in PEM format. PEM allows the option of private keys
408
409
  * being encrypted. Encrypted keys will be decrypted with
@@ -412,7 +413,7 @@ export interface TlsSettings {
412
413
  * The object form can only occur in an array.object.passphrase is optional.
413
414
  * Encrypted keys will be decrypted with object.passphrase if provided, or options.passphrase if it is not.
414
415
  */
415
- key?: string | Buffer | Array<Buffer | KeyObject> | undefined;
416
+ key?: string | NodeBuffer | Array<NodeBuffer | KeyObject> | undefined;
416
417
  /**
417
418
  * Shared passphrase used for a single private key and/or a PFX.
418
419
  */
@@ -426,7 +427,7 @@ export interface TlsSettings {
426
427
  * The object form can only occur in an array.object.passphrase is optional.
427
428
  * Encrypted PFX will be decrypted with object.passphrase if provided, or options.passphrase if it is not.
428
429
  */
429
- pfx?: string | Buffer | Array<string | Buffer | PxfObject> | undefined;
430
+ pfx?: string | NodeBuffer | Array<string | NodeBuffer | PxfObject> | undefined;
430
431
  }
431
432
  /**
432
433
  * An interface compatible with NodeJS's `tls.KeyObject`.
@@ -437,7 +438,7 @@ export interface KeyObject {
437
438
  /**
438
439
  * Private keys in PEM format.
439
440
  */
440
- pem: string | Buffer;
441
+ pem: string | NodeBuffer;
441
442
  /**
442
443
  * Optional passphrase.
443
444
  */
@@ -452,7 +453,7 @@ export interface PxfObject {
452
453
  /**
453
454
  * PFX or PKCS12 encoded private key and certificate chain.
454
455
  */
455
- buf: string | Buffer;
456
+ buf: string | NodeBuffer;
456
457
  /**
457
458
  * Optional passphrase.
458
459
  */