@dbmx/confy 0.0.77 → 0.0.84

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 (275) hide show
  1. package/esm/_virtual/browser.js +4 -0
  2. package/esm/_virtual/browser.js.map +1 -0
  3. package/esm/_virtual/index15.js +4 -0
  4. package/esm/_virtual/index15.js.map +1 -0
  5. package/esm/_virtual/index16.js +4 -0
  6. package/esm/_virtual/index16.js.map +1 -0
  7. package/esm/_virtual/index17.js +4 -0
  8. package/esm/_virtual/index17.js.map +1 -0
  9. package/esm/_virtual/index18.js +4 -0
  10. package/esm/_virtual/index18.js.map +1 -0
  11. package/esm/_virtual/node.js +4 -0
  12. package/esm/_virtual/node.js.map +1 -0
  13. package/esm/_virtual/serialOrdered.js +4 -0
  14. package/esm/_virtual/serialOrdered.js.map +1 -0
  15. package/esm/components/Confy/index.js +1 -1
  16. package/esm/components/Confy/index.js.map +1 -1
  17. package/esm/node_modules/@dbmx/semver/dist/index.esm.js +4 -2
  18. package/esm/node_modules/@dbmx/semver/dist/index.esm.js.map +1 -1
  19. package/esm/node_modules/@dbmx/users/esm/roles.js +5 -0
  20. package/esm/node_modules/@dbmx/users/esm/roles.js.map +1 -1
  21. package/esm/node_modules/asynckit/index.js +13 -0
  22. package/esm/node_modules/asynckit/index.js.map +1 -0
  23. package/esm/node_modules/asynckit/lib/abort.js +32 -0
  24. package/esm/node_modules/asynckit/lib/abort.js.map +1 -0
  25. package/esm/node_modules/asynckit/lib/async.js +39 -0
  26. package/esm/node_modules/asynckit/lib/async.js.map +1 -0
  27. package/esm/node_modules/asynckit/lib/defer.js +29 -0
  28. package/esm/node_modules/asynckit/lib/defer.js.map +1 -0
  29. package/esm/node_modules/asynckit/lib/iterate.js +81 -0
  30. package/esm/node_modules/asynckit/lib/iterate.js.map +1 -0
  31. package/esm/node_modules/asynckit/lib/state.js +40 -0
  32. package/esm/node_modules/asynckit/lib/state.js.map +1 -0
  33. package/esm/node_modules/asynckit/lib/terminator.js +35 -0
  34. package/esm/node_modules/asynckit/lib/terminator.js.map +1 -0
  35. package/esm/node_modules/asynckit/parallel.js +50 -0
  36. package/esm/node_modules/asynckit/parallel.js.map +1 -0
  37. package/esm/node_modules/asynckit/serial.js +22 -0
  38. package/esm/node_modules/asynckit/serial.js.map +1 -0
  39. package/esm/node_modules/asynckit/serialOrdered.js +85 -0
  40. package/esm/node_modules/asynckit/serialOrdered.js.map +1 -0
  41. package/esm/node_modules/axios/index.js +26 -0
  42. package/esm/node_modules/axios/index.js.map +1 -0
  43. package/esm/node_modules/axios/lib/adapters/adapters.js +133 -0
  44. package/esm/node_modules/axios/lib/adapters/adapters.js.map +1 -0
  45. package/esm/node_modules/axios/lib/adapters/fetch.js +331 -0
  46. package/esm/node_modules/axios/lib/adapters/fetch.js.map +1 -0
  47. package/esm/node_modules/axios/lib/adapters/http.js +945 -0
  48. package/esm/node_modules/axios/lib/adapters/http.js.map +1 -0
  49. package/esm/node_modules/axios/lib/adapters/xhr.js +225 -0
  50. package/esm/node_modules/axios/lib/adapters/xhr.js.map +1 -0
  51. package/esm/node_modules/axios/lib/axios.js +87 -0
  52. package/esm/node_modules/axios/lib/axios.js.map +1 -0
  53. package/esm/node_modules/axios/lib/cancel/CancelToken.js +134 -0
  54. package/esm/node_modules/axios/lib/cancel/CancelToken.js.map +1 -0
  55. package/esm/node_modules/axios/lib/cancel/CanceledError.js +21 -0
  56. package/esm/node_modules/axios/lib/cancel/CanceledError.js.map +1 -0
  57. package/esm/node_modules/axios/lib/cancel/isCancel.js +6 -0
  58. package/esm/node_modules/axios/lib/cancel/isCancel.js.map +1 -0
  59. package/esm/node_modules/axios/lib/core/Axios.js +260 -0
  60. package/esm/node_modules/axios/lib/core/Axios.js.map +1 -0
  61. package/esm/node_modules/axios/lib/core/AxiosError.js +89 -0
  62. package/esm/node_modules/axios/lib/core/AxiosError.js.map +1 -0
  63. package/esm/node_modules/axios/lib/core/AxiosHeaders.js +343 -0
  64. package/esm/node_modules/axios/lib/core/AxiosHeaders.js.map +1 -0
  65. package/esm/node_modules/axios/lib/core/InterceptorManager.js +71 -0
  66. package/esm/node_modules/axios/lib/core/InterceptorManager.js.map +1 -0
  67. package/esm/node_modules/axios/lib/core/buildFullPath.js +23 -0
  68. package/esm/node_modules/axios/lib/core/buildFullPath.js.map +1 -0
  69. package/esm/node_modules/axios/lib/core/dispatchRequest.js +78 -0
  70. package/esm/node_modules/axios/lib/core/dispatchRequest.js.map +1 -0
  71. package/esm/node_modules/axios/lib/core/mergeConfig.js +108 -0
  72. package/esm/node_modules/axios/lib/core/mergeConfig.js.map +1 -0
  73. package/esm/node_modules/axios/lib/core/settle.js +32 -0
  74. package/esm/node_modules/axios/lib/core/settle.js.map +1 -0
  75. package/esm/node_modules/axios/lib/core/transformData.js +29 -0
  76. package/esm/node_modules/axios/lib/core/transformData.js.map +1 -0
  77. package/esm/node_modules/axios/lib/defaults/index.js +171 -0
  78. package/esm/node_modules/axios/lib/defaults/index.js.map +1 -0
  79. package/esm/node_modules/axios/lib/defaults/transitional.js +9 -0
  80. package/esm/node_modules/axios/lib/defaults/transitional.js.map +1 -0
  81. package/esm/node_modules/axios/lib/env/data.js +4 -0
  82. package/esm/node_modules/axios/lib/env/data.js.map +1 -0
  83. package/esm/node_modules/axios/lib/helpers/AxiosTransformStream.js +155 -0
  84. package/esm/node_modules/axios/lib/helpers/AxiosTransformStream.js.map +1 -0
  85. package/esm/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +61 -0
  86. package/esm/node_modules/axios/lib/helpers/AxiosURLSearchParams.js.map +1 -0
  87. package/esm/node_modules/axios/lib/helpers/HttpStatusCode.js +78 -0
  88. package/esm/node_modules/axios/lib/helpers/HttpStatusCode.js.map +1 -0
  89. package/esm/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +28 -0
  90. package/esm/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js.map +1 -0
  91. package/esm/node_modules/axios/lib/helpers/bind.js +15 -0
  92. package/esm/node_modules/axios/lib/helpers/bind.js.map +1 -0
  93. package/esm/node_modules/axios/lib/helpers/buildURL.js +67 -0
  94. package/esm/node_modules/axios/lib/helpers/buildURL.js.map +1 -0
  95. package/esm/node_modules/axios/lib/helpers/callbackify.js +19 -0
  96. package/esm/node_modules/axios/lib/helpers/callbackify.js.map +1 -0
  97. package/esm/node_modules/axios/lib/helpers/combineURLs.js +16 -0
  98. package/esm/node_modules/axios/lib/helpers/combineURLs.js.map +1 -0
  99. package/esm/node_modules/axios/lib/helpers/composeSignals.js +57 -0
  100. package/esm/node_modules/axios/lib/helpers/composeSignals.js.map +1 -0
  101. package/esm/node_modules/axios/lib/helpers/cookies.js +51 -0
  102. package/esm/node_modules/axios/lib/helpers/cookies.js.map +1 -0
  103. package/esm/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +76 -0
  104. package/esm/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js.map +1 -0
  105. package/esm/node_modules/axios/lib/helpers/formDataToJSON.js +94 -0
  106. package/esm/node_modules/axios/lib/helpers/formDataToJSON.js.map +1 -0
  107. package/esm/node_modules/axios/lib/helpers/formDataToStream.js +119 -0
  108. package/esm/node_modules/axios/lib/helpers/formDataToStream.js.map +1 -0
  109. package/esm/node_modules/axios/lib/helpers/fromDataURI.js +54 -0
  110. package/esm/node_modules/axios/lib/helpers/fromDataURI.js.map +1 -0
  111. package/esm/node_modules/axios/lib/helpers/isAbsoluteURL.js +20 -0
  112. package/esm/node_modules/axios/lib/helpers/isAbsoluteURL.js.map +1 -0
  113. package/esm/node_modules/axios/lib/helpers/isAxiosError.js +15 -0
  114. package/esm/node_modules/axios/lib/helpers/isAxiosError.js.map +1 -0
  115. package/esm/node_modules/axios/lib/helpers/isURLSameOrigin.js +19 -0
  116. package/esm/node_modules/axios/lib/helpers/isURLSameOrigin.js.map +1 -0
  117. package/esm/node_modules/axios/lib/helpers/parseHeaders.js +70 -0
  118. package/esm/node_modules/axios/lib/helpers/parseHeaders.js.map +1 -0
  119. package/esm/node_modules/axios/lib/helpers/parseProtocol.js +7 -0
  120. package/esm/node_modules/axios/lib/helpers/parseProtocol.js.map +1 -0
  121. package/esm/node_modules/axios/lib/helpers/progressEventReducer.js +54 -0
  122. package/esm/node_modules/axios/lib/helpers/progressEventReducer.js.map +1 -0
  123. package/esm/node_modules/axios/lib/helpers/readBlob.js +16 -0
  124. package/esm/node_modules/axios/lib/helpers/readBlob.js.map +1 -0
  125. package/esm/node_modules/axios/lib/helpers/resolveConfig.js +73 -0
  126. package/esm/node_modules/axios/lib/helpers/resolveConfig.js.map +1 -0
  127. package/esm/node_modules/axios/lib/helpers/speedometer.js +54 -0
  128. package/esm/node_modules/axios/lib/helpers/speedometer.js.map +1 -0
  129. package/esm/node_modules/axios/lib/helpers/spread.js +29 -0
  130. package/esm/node_modules/axios/lib/helpers/spread.js.map +1 -0
  131. package/esm/node_modules/axios/lib/helpers/throttle.js +45 -0
  132. package/esm/node_modules/axios/lib/helpers/throttle.js.map +1 -0
  133. package/esm/node_modules/axios/lib/helpers/toFormData.js +239 -0
  134. package/esm/node_modules/axios/lib/helpers/toFormData.js.map +1 -0
  135. package/esm/node_modules/axios/lib/helpers/toURLEncodedForm.js +20 -0
  136. package/esm/node_modules/axios/lib/helpers/toURLEncodedForm.js.map +1 -0
  137. package/esm/node_modules/axios/lib/helpers/trackStream.js +92 -0
  138. package/esm/node_modules/axios/lib/helpers/trackStream.js.map +1 -0
  139. package/esm/node_modules/axios/lib/helpers/validator.js +111 -0
  140. package/esm/node_modules/axios/lib/helpers/validator.js.map +1 -0
  141. package/esm/node_modules/axios/lib/platform/common/utils.js +47 -0
  142. package/esm/node_modules/axios/lib/platform/common/utils.js.map +1 -0
  143. package/esm/node_modules/axios/lib/platform/index.js +10 -0
  144. package/esm/node_modules/axios/lib/platform/index.js.map +1 -0
  145. package/esm/node_modules/axios/lib/platform/node/classes/FormData.js +6 -0
  146. package/esm/node_modules/axios/lib/platform/node/classes/FormData.js.map +1 -0
  147. package/esm/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +6 -0
  148. package/esm/node_modules/axios/lib/platform/node/classes/URLSearchParams.js.map +1 -0
  149. package/esm/node_modules/axios/lib/platform/node/index.js +40 -0
  150. package/esm/node_modules/axios/lib/platform/node/index.js.map +1 -0
  151. package/esm/node_modules/axios/lib/utils.js +920 -0
  152. package/esm/node_modules/axios/lib/utils.js.map +1 -0
  153. package/esm/node_modules/call-bind-apply-helpers/node_modules/function-bind/implementation.js +66 -0
  154. package/esm/node_modules/call-bind-apply-helpers/node_modules/function-bind/implementation.js.map +1 -0
  155. package/esm/node_modules/call-bind-apply-helpers/node_modules/function-bind/index.js +7 -0
  156. package/esm/node_modules/call-bind-apply-helpers/node_modules/function-bind/index.js.map +1 -0
  157. package/esm/node_modules/combined-stream/lib/combined_stream.js +215 -0
  158. package/esm/node_modules/combined-stream/lib/combined_stream.js.map +1 -0
  159. package/esm/node_modules/debug/src/browser.js +287 -0
  160. package/esm/node_modules/debug/src/browser.js.map +1 -0
  161. package/esm/node_modules/debug/src/common.js +304 -0
  162. package/esm/node_modules/debug/src/common.js.map +1 -0
  163. package/esm/node_modules/debug/src/index.js +24 -0
  164. package/esm/node_modules/debug/src/index.js.map +1 -0
  165. package/esm/node_modules/debug/src/node.js +281 -0
  166. package/esm/node_modules/debug/src/node.js.map +1 -0
  167. package/esm/node_modules/deep-equal/node_modules/has-symbols/index.js +22 -0
  168. package/esm/node_modules/deep-equal/node_modules/has-symbols/index.js.map +1 -0
  169. package/esm/node_modules/deep-equal/node_modules/has-symbols/shams.js +58 -0
  170. package/esm/node_modules/deep-equal/node_modules/has-symbols/shams.js.map +1 -0
  171. package/esm/node_modules/deep-equal/node_modules/has-tostringtag/shams.js +9 -0
  172. package/esm/node_modules/deep-equal/node_modules/has-tostringtag/shams.js.map +1 -0
  173. package/esm/node_modules/deep-equal/node_modules/is-regex/index.js +53 -0
  174. package/esm/node_modules/deep-equal/node_modules/is-regex/index.js.map +1 -0
  175. package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/call-bind/callBound.js +16 -0
  176. package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/call-bind/callBound.js.map +1 -0
  177. package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/call-bind/index.js +53 -0
  178. package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/call-bind/index.js.map +1 -0
  179. package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/get-intrinsic/index.js +307 -0
  180. package/esm/node_modules/deep-equal/node_modules/is-regex/node_modules/get-intrinsic/index.js.map +1 -0
  181. package/esm/node_modules/delayed-stream/lib/delayed_stream.js +113 -0
  182. package/esm/node_modules/delayed-stream/lib/delayed_stream.js.map +1 -0
  183. package/esm/node_modules/es-set-tostringtag/index.js +41 -0
  184. package/esm/node_modules/es-set-tostringtag/index.js.map +1 -0
  185. package/esm/node_modules/follow-redirects/debug.js +20 -0
  186. package/esm/node_modules/follow-redirects/debug.js.map +1 -0
  187. package/esm/node_modules/follow-redirects/index.js +701 -0
  188. package/esm/node_modules/follow-redirects/index.js.map +1 -0
  189. package/esm/node_modules/form-data/lib/form_data.js +514 -0
  190. package/esm/node_modules/form-data/lib/form_data.js.map +1 -0
  191. package/esm/node_modules/form-data/lib/populate.js +11 -0
  192. package/esm/node_modules/form-data/lib/populate.js.map +1 -0
  193. package/esm/node_modules/get-intrinsic/node_modules/function-bind/implementation.js +75 -0
  194. package/esm/node_modules/get-intrinsic/node_modules/function-bind/implementation.js.map +1 -0
  195. package/esm/node_modules/get-intrinsic/node_modules/function-bind/index.js +16 -0
  196. package/esm/node_modules/get-intrinsic/node_modules/function-bind/index.js.map +1 -0
  197. package/esm/node_modules/has/src/index.js +7 -0
  198. package/esm/node_modules/has/src/index.js.map +1 -0
  199. package/esm/node_modules/has-flag/index.js +18 -0
  200. package/esm/node_modules/has-flag/index.js.map +1 -0
  201. package/esm/node_modules/hasown/node_modules/function-bind/implementation.js +75 -0
  202. package/esm/node_modules/hasown/node_modules/function-bind/implementation.js.map +1 -0
  203. package/esm/node_modules/hasown/node_modules/function-bind/index.js +16 -0
  204. package/esm/node_modules/hasown/node_modules/function-bind/index.js.map +1 -0
  205. package/esm/node_modules/is-boolean-object/node_modules/call-bind/callBound.js +16 -0
  206. package/esm/node_modules/is-boolean-object/node_modules/call-bind/callBound.js.map +1 -0
  207. package/esm/node_modules/is-boolean-object/node_modules/call-bind/index.js +53 -0
  208. package/esm/node_modules/is-boolean-object/node_modules/call-bind/index.js.map +1 -0
  209. package/esm/node_modules/is-boolean-object/node_modules/get-intrinsic/index.js +307 -0
  210. package/esm/node_modules/is-boolean-object/node_modules/get-intrinsic/index.js.map +1 -0
  211. package/esm/node_modules/is-boolean-object/node_modules/has-symbols/index.js +22 -0
  212. package/esm/node_modules/is-boolean-object/node_modules/has-symbols/index.js.map +1 -0
  213. package/esm/node_modules/is-boolean-object/node_modules/has-symbols/shams.js +67 -0
  214. package/esm/node_modules/is-boolean-object/node_modules/has-symbols/shams.js.map +1 -0
  215. package/esm/node_modules/is-boolean-object/node_modules/has-tostringtag/shams.js +18 -0
  216. package/esm/node_modules/is-boolean-object/node_modules/has-tostringtag/shams.js.map +1 -0
  217. package/esm/node_modules/is-number-object/node_modules/has-symbols/shams.js +58 -0
  218. package/esm/node_modules/is-number-object/node_modules/has-symbols/shams.js.map +1 -0
  219. package/esm/node_modules/is-number-object/node_modules/has-tostringtag/shams.js +9 -0
  220. package/esm/node_modules/is-number-object/node_modules/has-tostringtag/shams.js.map +1 -0
  221. package/esm/node_modules/is-string/node_modules/has-symbols/shams.js +58 -0
  222. package/esm/node_modules/is-string/node_modules/has-symbols/shams.js.map +1 -0
  223. package/esm/node_modules/is-string/node_modules/has-tostringtag/shams.js +9 -0
  224. package/esm/node_modules/is-string/node_modules/has-tostringtag/shams.js.map +1 -0
  225. package/esm/node_modules/is-symbol/node_modules/has-symbols/index.js +22 -0
  226. package/esm/node_modules/is-symbol/node_modules/has-symbols/index.js.map +1 -0
  227. package/esm/node_modules/is-symbol/node_modules/has-symbols/shams.js +58 -0
  228. package/esm/node_modules/is-symbol/node_modules/has-symbols/shams.js.map +1 -0
  229. package/esm/node_modules/mime-db/db.json.js +10705 -0
  230. package/esm/node_modules/mime-db/db.json.js.map +1 -0
  231. package/esm/node_modules/mime-db/index.js +17 -0
  232. package/esm/node_modules/mime-db/index.js.map +1 -0
  233. package/esm/node_modules/mime-types/index.js +194 -0
  234. package/esm/node_modules/mime-types/index.js.map +1 -0
  235. package/esm/node_modules/ms/index.js +173 -0
  236. package/esm/node_modules/ms/index.js.map +1 -0
  237. package/esm/node_modules/proxy-from-env/index.js +112 -0
  238. package/esm/node_modules/proxy-from-env/index.js.map +1 -0
  239. package/esm/node_modules/side-channel/node_modules/call-bind/callBound.js +16 -0
  240. package/esm/node_modules/side-channel/node_modules/call-bind/callBound.js.map +1 -0
  241. package/esm/node_modules/side-channel/node_modules/call-bind/index.js +53 -0
  242. package/esm/node_modules/side-channel/node_modules/call-bind/index.js.map +1 -0
  243. package/esm/node_modules/side-channel/node_modules/get-intrinsic/index.js +307 -0
  244. package/esm/node_modules/side-channel/node_modules/get-intrinsic/index.js.map +1 -0
  245. package/esm/node_modules/side-channel/node_modules/has-symbols/index.js +22 -0
  246. package/esm/node_modules/side-channel/node_modules/has-symbols/index.js.map +1 -0
  247. package/esm/node_modules/side-channel/node_modules/has-symbols/shams.js +58 -0
  248. package/esm/node_modules/side-channel/node_modules/has-symbols/shams.js.map +1 -0
  249. package/esm/node_modules/side-channel/node_modules/object-inspect/index.js +469 -0
  250. package/esm/node_modules/side-channel/node_modules/object-inspect/index.js.map +1 -0
  251. package/esm/node_modules/side-channel/node_modules/object-inspect/util.inspect.js +6 -0
  252. package/esm/node_modules/side-channel/node_modules/object-inspect/util.inspect.js.map +1 -0
  253. package/esm/node_modules/supports-color/index.js +149 -0
  254. package/esm/node_modules/supports-color/index.js.map +1 -0
  255. package/package.json +3 -3
  256. package/esm/lib/api/apiKeys.js +0 -51
  257. package/esm/lib/api/apiKeys.js.map +0 -1
  258. package/esm/lib/api/dataBuckets.js +0 -18
  259. package/esm/lib/api/dataBuckets.js.map +0 -1
  260. package/esm/lib/api/jobs.js +0 -56
  261. package/esm/lib/api/jobs.js.map +0 -1
  262. package/esm/lib/api/members.js +0 -33
  263. package/esm/lib/api/members.js.map +0 -1
  264. package/esm/lib/api/people.js +0 -50
  265. package/esm/lib/api/people.js.map +0 -1
  266. package/esm/lib/api/roles.js +0 -17
  267. package/esm/lib/api/roles.js.map +0 -1
  268. package/esm/lib/api/routes.js +0 -43
  269. package/esm/lib/api/routes.js.map +0 -1
  270. package/esm/lib/api/servicesMap.js +0 -17
  271. package/esm/lib/api/servicesMap.js.map +0 -1
  272. package/esm/lib/api/spaces.js +0 -32
  273. package/esm/lib/api/spaces.js.map +0 -1
  274. package/esm/lib/api/storage.js +0 -94
  275. package/esm/lib/api/storage.js.map +0 -1
@@ -0,0 +1,945 @@
1
+ import utils from '../utils.js';
2
+ import settle from '../core/settle.js';
3
+ import buildFullPath from '../core/buildFullPath.js';
4
+ import buildURL from '../helpers/buildURL.js';
5
+ import '../../../proxy-from-env/index.js';
6
+ import require$$3 from 'http';
7
+ import require$$4 from 'https';
8
+ import http2 from 'http2';
9
+ import require$$1 from 'util';
10
+ import followRedirects from '../../../follow-redirects/index.js';
11
+ import zlib from 'zlib';
12
+ import { VERSION } from '../env/data.js';
13
+ import transitionalDefaults from '../defaults/transitional.js';
14
+ import AxiosError from '../core/AxiosError.js';
15
+ import CanceledError from '../cancel/CanceledError.js';
16
+ import platform from '../platform/index.js';
17
+ import fromDataURI from '../helpers/fromDataURI.js';
18
+ import stream from 'stream';
19
+ import AxiosHeaders from '../core/AxiosHeaders.js';
20
+ import AxiosTransformStream from '../helpers/AxiosTransformStream.js';
21
+ import { EventEmitter } from 'events';
22
+ import formDataToStream from '../helpers/formDataToStream.js';
23
+ import readBlob from '../helpers/readBlob.js';
24
+ import ZlibHeaderTransformStream from '../helpers/ZlibHeaderTransformStream.js';
25
+ import callbackify from '../helpers/callbackify.js';
26
+ import { progressEventDecorator, progressEventReducer, asyncDecorator } from '../helpers/progressEventReducer.js';
27
+ import estimateDataURLDecodedBytes from '../helpers/estimateDataURLDecodedBytes.js';
28
+ import { __exports as proxyFromEnv } from '../../../../_virtual/index8.js';
29
+
30
+ const zlibOptions = {
31
+ flush: zlib.constants.Z_SYNC_FLUSH,
32
+ finishFlush: zlib.constants.Z_SYNC_FLUSH,
33
+ };
34
+
35
+ const brotliOptions = {
36
+ flush: zlib.constants.BROTLI_OPERATION_FLUSH,
37
+ finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH,
38
+ };
39
+
40
+ const isBrotliSupported = utils.isFunction(zlib.createBrotliDecompress);
41
+
42
+ const { http: httpFollow, https: httpsFollow } = followRedirects;
43
+
44
+ const isHttps = /https:?/;
45
+
46
+ const supportedProtocols = platform.protocols.map((protocol) => {
47
+ return protocol + ':';
48
+ });
49
+
50
+ const flushOnFinish = (stream, [throttled, flush]) => {
51
+ stream.on('end', flush).on('error', flush);
52
+
53
+ return throttled;
54
+ };
55
+
56
+ class Http2Sessions {
57
+ constructor() {
58
+ this.sessions = Object.create(null);
59
+ }
60
+
61
+ getSession(authority, options) {
62
+ options = Object.assign(
63
+ {
64
+ sessionTimeout: 1000,
65
+ },
66
+ options
67
+ );
68
+
69
+ let authoritySessions = this.sessions[authority];
70
+
71
+ if (authoritySessions) {
72
+ let len = authoritySessions.length;
73
+
74
+ for (let i = 0; i < len; i++) {
75
+ const [sessionHandle, sessionOptions] = authoritySessions[i];
76
+ if (
77
+ !sessionHandle.destroyed &&
78
+ !sessionHandle.closed &&
79
+ require$$1.isDeepStrictEqual(sessionOptions, options)
80
+ ) {
81
+ return sessionHandle;
82
+ }
83
+ }
84
+ }
85
+
86
+ const session = http2.connect(authority, options);
87
+
88
+ let removed;
89
+
90
+ const removeSession = () => {
91
+ if (removed) {
92
+ return;
93
+ }
94
+
95
+ removed = true;
96
+
97
+ let entries = authoritySessions,
98
+ len = entries.length,
99
+ i = len;
100
+
101
+ while (i--) {
102
+ if (entries[i][0] === session) {
103
+ if (len === 1) {
104
+ delete this.sessions[authority];
105
+ } else {
106
+ entries.splice(i, 1);
107
+ }
108
+ return;
109
+ }
110
+ }
111
+ };
112
+
113
+ const originalRequestFn = session.request;
114
+
115
+ const { sessionTimeout } = options;
116
+
117
+ if (sessionTimeout != null) {
118
+ let timer;
119
+ let streamsCount = 0;
120
+
121
+ session.request = function () {
122
+ const stream = originalRequestFn.apply(this, arguments);
123
+
124
+ streamsCount++;
125
+
126
+ if (timer) {
127
+ clearTimeout(timer);
128
+ timer = null;
129
+ }
130
+
131
+ stream.once('close', () => {
132
+ if (!--streamsCount) {
133
+ timer = setTimeout(() => {
134
+ timer = null;
135
+ removeSession();
136
+ }, sessionTimeout);
137
+ }
138
+ });
139
+
140
+ return stream;
141
+ };
142
+ }
143
+
144
+ session.once('close', removeSession);
145
+
146
+ let entry = [session, options];
147
+
148
+ authoritySessions
149
+ ? authoritySessions.push(entry)
150
+ : (authoritySessions = this.sessions[authority] = [entry]);
151
+
152
+ return session;
153
+ }
154
+ }
155
+
156
+ const http2Sessions = new Http2Sessions();
157
+
158
+ /**
159
+ * If the proxy or config beforeRedirects functions are defined, call them with the options
160
+ * object.
161
+ *
162
+ * @param {Object<string, any>} options - The options object that was passed to the request.
163
+ *
164
+ * @returns {Object<string, any>}
165
+ */
166
+ function dispatchBeforeRedirect(options, responseDetails) {
167
+ if (options.beforeRedirects.proxy) {
168
+ options.beforeRedirects.proxy(options);
169
+ }
170
+ if (options.beforeRedirects.config) {
171
+ options.beforeRedirects.config(options, responseDetails);
172
+ }
173
+ }
174
+
175
+ /**
176
+ * If the proxy or config afterRedirects functions are defined, call them with the options
177
+ *
178
+ * @param {http.ClientRequestArgs} options
179
+ * @param {AxiosProxyConfig} configProxy configuration from Axios options object
180
+ * @param {string} location
181
+ *
182
+ * @returns {http.ClientRequestArgs}
183
+ */
184
+ function setProxy(options, configProxy, location) {
185
+ let proxy = configProxy;
186
+ if (!proxy && proxy !== false) {
187
+ const proxyUrl = proxyFromEnv.getProxyForUrl(location);
188
+ if (proxyUrl) {
189
+ proxy = new URL(proxyUrl);
190
+ }
191
+ }
192
+ if (proxy) {
193
+ // Basic proxy authorization
194
+ if (proxy.username) {
195
+ proxy.auth = (proxy.username || '') + ':' + (proxy.password || '');
196
+ }
197
+
198
+ if (proxy.auth) {
199
+ // Support proxy auth object form
200
+ const validProxyAuth = Boolean(proxy.auth.username || proxy.auth.password);
201
+
202
+ if (validProxyAuth) {
203
+ proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || '');
204
+ } else if (typeof proxy.auth === 'object') {
205
+ throw new AxiosError('Invalid proxy authorization', AxiosError.ERR_BAD_OPTION, { proxy });
206
+ }
207
+
208
+ const base64 = Buffer.from(proxy.auth, 'utf8').toString('base64');
209
+
210
+ options.headers['Proxy-Authorization'] = 'Basic ' + base64;
211
+ }
212
+
213
+ options.headers.host = options.hostname + (options.port ? ':' + options.port : '');
214
+ const proxyHost = proxy.hostname || proxy.host;
215
+ options.hostname = proxyHost;
216
+ // Replace 'host' since options is not a URL object
217
+ options.host = proxyHost;
218
+ options.port = proxy.port;
219
+ options.path = location;
220
+ if (proxy.protocol) {
221
+ options.protocol = proxy.protocol.includes(':') ? proxy.protocol : `${proxy.protocol}:`;
222
+ }
223
+ }
224
+
225
+ options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
226
+ // Configure proxy for redirected request, passing the original config proxy to apply
227
+ // the exact same logic as if the redirected request was performed by axios directly.
228
+ setProxy(redirectOptions, configProxy, redirectOptions.href);
229
+ };
230
+ }
231
+
232
+ const isHttpAdapterSupported =
233
+ typeof process !== 'undefined' && utils.kindOf(process) === 'process';
234
+
235
+ // temporary hotfix
236
+
237
+ const wrapAsync = (asyncExecutor) => {
238
+ return new Promise((resolve, reject) => {
239
+ let onDone;
240
+ let isDone;
241
+
242
+ const done = (value, isRejected) => {
243
+ if (isDone) return;
244
+ isDone = true;
245
+ onDone && onDone(value, isRejected);
246
+ };
247
+
248
+ const _resolve = (value) => {
249
+ done(value);
250
+ resolve(value);
251
+ };
252
+
253
+ const _reject = (reason) => {
254
+ done(reason, true);
255
+ reject(reason);
256
+ };
257
+
258
+ asyncExecutor(_resolve, _reject, (onDoneHandler) => (onDone = onDoneHandler)).catch(_reject);
259
+ });
260
+ };
261
+
262
+ const resolveFamily = ({ address, family }) => {
263
+ if (!utils.isString(address)) {
264
+ throw TypeError('address must be a string');
265
+ }
266
+ return {
267
+ address,
268
+ family: family || (address.indexOf('.') < 0 ? 6 : 4),
269
+ };
270
+ };
271
+
272
+ const buildAddressEntry = (address, family) =>
273
+ resolveFamily(utils.isObject(address) ? address : { address, family });
274
+
275
+ const http2Transport = {
276
+ request(options, cb) {
277
+ const authority =
278
+ options.protocol +
279
+ '//' +
280
+ options.hostname +
281
+ ':' +
282
+ (options.port || (options.protocol === 'https:' ? 443 : 80));
283
+
284
+ const { http2Options, headers } = options;
285
+
286
+ const session = http2Sessions.getSession(authority, http2Options);
287
+
288
+ const { HTTP2_HEADER_SCHEME, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, HTTP2_HEADER_STATUS } =
289
+ http2.constants;
290
+
291
+ const http2Headers = {
292
+ [HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
293
+ [HTTP2_HEADER_METHOD]: options.method,
294
+ [HTTP2_HEADER_PATH]: options.path,
295
+ };
296
+
297
+ utils.forEach(headers, (header, name) => {
298
+ name.charAt(0) !== ':' && (http2Headers[name] = header);
299
+ });
300
+
301
+ const req = session.request(http2Headers);
302
+
303
+ req.once('response', (responseHeaders) => {
304
+ const response = req; //duplex
305
+
306
+ responseHeaders = Object.assign({}, responseHeaders);
307
+
308
+ const status = responseHeaders[HTTP2_HEADER_STATUS];
309
+
310
+ delete responseHeaders[HTTP2_HEADER_STATUS];
311
+
312
+ response.headers = responseHeaders;
313
+
314
+ response.statusCode = +status;
315
+
316
+ cb(response);
317
+ });
318
+
319
+ return req;
320
+ },
321
+ };
322
+
323
+ /*eslint consistent-return:0*/
324
+ var httpAdapter = isHttpAdapterSupported &&
325
+ function httpAdapter(config) {
326
+ return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
327
+ let { data, lookup, family, httpVersion = 1, http2Options } = config;
328
+ const { responseType, responseEncoding } = config;
329
+ const method = config.method.toUpperCase();
330
+ let isDone;
331
+ let rejected = false;
332
+ let req;
333
+
334
+ httpVersion = +httpVersion;
335
+
336
+ if (Number.isNaN(httpVersion)) {
337
+ throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
338
+ }
339
+
340
+ if (httpVersion !== 1 && httpVersion !== 2) {
341
+ throw TypeError(`Unsupported protocol version '${httpVersion}'`);
342
+ }
343
+
344
+ const isHttp2 = httpVersion === 2;
345
+
346
+ if (lookup) {
347
+ const _lookup = callbackify(lookup, (value) => (utils.isArray(value) ? value : [value]));
348
+ // hotfix to support opt.all option which is required for node 20.x
349
+ lookup = (hostname, opt, cb) => {
350
+ _lookup(hostname, opt, (err, arg0, arg1) => {
351
+ if (err) {
352
+ return cb(err);
353
+ }
354
+
355
+ const addresses = utils.isArray(arg0)
356
+ ? arg0.map((addr) => buildAddressEntry(addr))
357
+ : [buildAddressEntry(arg0, arg1)];
358
+
359
+ opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
360
+ });
361
+ };
362
+ }
363
+
364
+ const abortEmitter = new EventEmitter();
365
+
366
+ function abort(reason) {
367
+ try {
368
+ abortEmitter.emit(
369
+ 'abort',
370
+ !reason || reason.type ? new CanceledError(null, config, req) : reason
371
+ );
372
+ } catch (err) {
373
+ console.warn('emit error', err);
374
+ }
375
+ }
376
+
377
+ abortEmitter.once('abort', reject);
378
+
379
+ const onFinished = () => {
380
+ if (config.cancelToken) {
381
+ config.cancelToken.unsubscribe(abort);
382
+ }
383
+
384
+ if (config.signal) {
385
+ config.signal.removeEventListener('abort', abort);
386
+ }
387
+
388
+ abortEmitter.removeAllListeners();
389
+ };
390
+
391
+ if (config.cancelToken || config.signal) {
392
+ config.cancelToken && config.cancelToken.subscribe(abort);
393
+ if (config.signal) {
394
+ config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);
395
+ }
396
+ }
397
+
398
+ onDone((response, isRejected) => {
399
+ isDone = true;
400
+
401
+ if (isRejected) {
402
+ rejected = true;
403
+ onFinished();
404
+ return;
405
+ }
406
+
407
+ const { data } = response;
408
+
409
+ if (data instanceof stream.Readable || data instanceof stream.Duplex) {
410
+ const offListeners = stream.finished(data, () => {
411
+ offListeners();
412
+ onFinished();
413
+ });
414
+ } else {
415
+ onFinished();
416
+ }
417
+ });
418
+
419
+ // Parse url
420
+ const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
421
+ const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
422
+ const protocol = parsed.protocol || supportedProtocols[0];
423
+
424
+ if (protocol === 'data:') {
425
+ // Apply the same semantics as HTTP: only enforce if a finite, non-negative cap is set.
426
+ if (config.maxContentLength > -1) {
427
+ // Use the exact string passed to fromDataURI (config.url); fall back to fullPath if needed.
428
+ const dataUrl = String(config.url || fullPath || '');
429
+ const estimated = estimateDataURLDecodedBytes(dataUrl);
430
+
431
+ if (estimated > config.maxContentLength) {
432
+ return reject(
433
+ new AxiosError(
434
+ 'maxContentLength size of ' + config.maxContentLength + ' exceeded',
435
+ AxiosError.ERR_BAD_RESPONSE,
436
+ config
437
+ )
438
+ );
439
+ }
440
+ }
441
+
442
+ let convertedData;
443
+
444
+ if (method !== 'GET') {
445
+ return settle(resolve, reject, {
446
+ status: 405,
447
+ statusText: 'method not allowed',
448
+ headers: {},
449
+ config,
450
+ });
451
+ }
452
+
453
+ try {
454
+ convertedData = fromDataURI(config.url, responseType === 'blob', {
455
+ Blob: config.env && config.env.Blob,
456
+ });
457
+ } catch (err) {
458
+ throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
459
+ }
460
+
461
+ if (responseType === 'text') {
462
+ convertedData = convertedData.toString(responseEncoding);
463
+
464
+ if (!responseEncoding || responseEncoding === 'utf8') {
465
+ convertedData = utils.stripBOM(convertedData);
466
+ }
467
+ } else if (responseType === 'stream') {
468
+ convertedData = stream.Readable.from(convertedData);
469
+ }
470
+
471
+ return settle(resolve, reject, {
472
+ data: convertedData,
473
+ status: 200,
474
+ statusText: 'OK',
475
+ headers: new AxiosHeaders(),
476
+ config,
477
+ });
478
+ }
479
+
480
+ if (supportedProtocols.indexOf(protocol) === -1) {
481
+ return reject(
482
+ new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_BAD_REQUEST, config)
483
+ );
484
+ }
485
+
486
+ const headers = AxiosHeaders.from(config.headers).normalize();
487
+
488
+ // Set User-Agent (required by some servers)
489
+ // See https://github.com/axios/axios/issues/69
490
+ // User-Agent is specified; handle case where no UA header is desired
491
+ // Only set header if it hasn't been set in config
492
+ headers.set('User-Agent', 'axios/' + VERSION, false);
493
+
494
+ const { onUploadProgress, onDownloadProgress } = config;
495
+ const maxRate = config.maxRate;
496
+ let maxUploadRate = undefined;
497
+ let maxDownloadRate = undefined;
498
+
499
+ // support for spec compliant FormData objects
500
+ if (utils.isSpecCompliantForm(data)) {
501
+ const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
502
+
503
+ data = formDataToStream(
504
+ data,
505
+ (formHeaders) => {
506
+ headers.set(formHeaders);
507
+ },
508
+ {
509
+ tag: `axios-${VERSION}-boundary`,
510
+ boundary: (userBoundary && userBoundary[1]) || undefined,
511
+ }
512
+ );
513
+ // support for https://www.npmjs.com/package/form-data api
514
+ } else if (utils.isFormData(data) && utils.isFunction(data.getHeaders)) {
515
+ headers.set(data.getHeaders());
516
+
517
+ if (!headers.hasContentLength()) {
518
+ try {
519
+ const knownLength = await require$$1.promisify(data.getLength).call(data);
520
+ Number.isFinite(knownLength) &&
521
+ knownLength >= 0 &&
522
+ headers.setContentLength(knownLength);
523
+ /*eslint no-empty:0*/
524
+ } catch (e) {}
525
+ }
526
+ } else if (utils.isBlob(data) || utils.isFile(data)) {
527
+ data.size && headers.setContentType(data.type || 'application/octet-stream');
528
+ headers.setContentLength(data.size || 0);
529
+ data = stream.Readable.from(readBlob(data));
530
+ } else if (data && !utils.isStream(data)) {
531
+ if (Buffer.isBuffer(data)) ; else if (utils.isArrayBuffer(data)) {
532
+ data = Buffer.from(new Uint8Array(data));
533
+ } else if (utils.isString(data)) {
534
+ data = Buffer.from(data, 'utf-8');
535
+ } else {
536
+ return reject(
537
+ new AxiosError(
538
+ 'Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream',
539
+ AxiosError.ERR_BAD_REQUEST,
540
+ config
541
+ )
542
+ );
543
+ }
544
+
545
+ // Add Content-Length header if data exists
546
+ headers.setContentLength(data.length, false);
547
+
548
+ if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
549
+ return reject(
550
+ new AxiosError(
551
+ 'Request body larger than maxBodyLength limit',
552
+ AxiosError.ERR_BAD_REQUEST,
553
+ config
554
+ )
555
+ );
556
+ }
557
+ }
558
+
559
+ const contentLength = utils.toFiniteNumber(headers.getContentLength());
560
+
561
+ if (utils.isArray(maxRate)) {
562
+ maxUploadRate = maxRate[0];
563
+ maxDownloadRate = maxRate[1];
564
+ } else {
565
+ maxUploadRate = maxDownloadRate = maxRate;
566
+ }
567
+
568
+ if (data && (onUploadProgress || maxUploadRate)) {
569
+ if (!utils.isStream(data)) {
570
+ data = stream.Readable.from(data, { objectMode: false });
571
+ }
572
+
573
+ data = stream.pipeline(
574
+ [
575
+ data,
576
+ new AxiosTransformStream({
577
+ maxRate: utils.toFiniteNumber(maxUploadRate),
578
+ }),
579
+ ],
580
+ utils.noop
581
+ );
582
+
583
+ onUploadProgress &&
584
+ data.on(
585
+ 'progress',
586
+ flushOnFinish(
587
+ data,
588
+ progressEventDecorator(
589
+ contentLength,
590
+ progressEventReducer(asyncDecorator(onUploadProgress), false, 3)
591
+ )
592
+ )
593
+ );
594
+ }
595
+
596
+ // HTTP basic authentication
597
+ let auth = undefined;
598
+ if (config.auth) {
599
+ const username = config.auth.username || '';
600
+ const password = config.auth.password || '';
601
+ auth = username + ':' + password;
602
+ }
603
+
604
+ if (!auth && parsed.username) {
605
+ const urlUsername = parsed.username;
606
+ const urlPassword = parsed.password;
607
+ auth = urlUsername + ':' + urlPassword;
608
+ }
609
+
610
+ auth && headers.delete('authorization');
611
+
612
+ let path;
613
+
614
+ try {
615
+ path = buildURL(
616
+ parsed.pathname + parsed.search,
617
+ config.params,
618
+ config.paramsSerializer
619
+ ).replace(/^\?/, '');
620
+ } catch (err) {
621
+ const customErr = new Error(err.message);
622
+ customErr.config = config;
623
+ customErr.url = config.url;
624
+ customErr.exists = true;
625
+ return reject(customErr);
626
+ }
627
+
628
+ headers.set(
629
+ 'Accept-Encoding',
630
+ 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''),
631
+ false
632
+ );
633
+
634
+ const options = {
635
+ path,
636
+ method: method,
637
+ headers: headers.toJSON(),
638
+ agents: { http: config.httpAgent, https: config.httpsAgent },
639
+ auth,
640
+ protocol,
641
+ family,
642
+ beforeRedirect: dispatchBeforeRedirect,
643
+ beforeRedirects: {},
644
+ http2Options,
645
+ };
646
+
647
+ // cacheable-lookup integration hotfix
648
+ !utils.isUndefined(lookup) && (options.lookup = lookup);
649
+
650
+ if (config.socketPath) {
651
+ options.socketPath = config.socketPath;
652
+ } else {
653
+ options.hostname = parsed.hostname.startsWith('[')
654
+ ? parsed.hostname.slice(1, -1)
655
+ : parsed.hostname;
656
+ options.port = parsed.port;
657
+ setProxy(
658
+ options,
659
+ config.proxy,
660
+ protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path
661
+ );
662
+ }
663
+
664
+ let transport;
665
+ const isHttpsRequest = isHttps.test(options.protocol);
666
+ options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
667
+
668
+ if (isHttp2) {
669
+ transport = http2Transport;
670
+ } else {
671
+ if (config.transport) {
672
+ transport = config.transport;
673
+ } else if (config.maxRedirects === 0) {
674
+ transport = isHttpsRequest ? require$$4 : require$$3;
675
+ } else {
676
+ if (config.maxRedirects) {
677
+ options.maxRedirects = config.maxRedirects;
678
+ }
679
+ if (config.beforeRedirect) {
680
+ options.beforeRedirects.config = config.beforeRedirect;
681
+ }
682
+ transport = isHttpsRequest ? httpsFollow : httpFollow;
683
+ }
684
+ }
685
+
686
+ if (config.maxBodyLength > -1) {
687
+ options.maxBodyLength = config.maxBodyLength;
688
+ } else {
689
+ // follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited
690
+ options.maxBodyLength = Infinity;
691
+ }
692
+
693
+ if (config.insecureHTTPParser) {
694
+ options.insecureHTTPParser = config.insecureHTTPParser;
695
+ }
696
+
697
+ // Create the request
698
+ req = transport.request(options, function handleResponse(res) {
699
+ if (req.destroyed) return;
700
+
701
+ const streams = [res];
702
+
703
+ const responseLength = utils.toFiniteNumber(res.headers['content-length']);
704
+
705
+ if (onDownloadProgress || maxDownloadRate) {
706
+ const transformStream = new AxiosTransformStream({
707
+ maxRate: utils.toFiniteNumber(maxDownloadRate),
708
+ });
709
+
710
+ onDownloadProgress &&
711
+ transformStream.on(
712
+ 'progress',
713
+ flushOnFinish(
714
+ transformStream,
715
+ progressEventDecorator(
716
+ responseLength,
717
+ progressEventReducer(asyncDecorator(onDownloadProgress), true, 3)
718
+ )
719
+ )
720
+ );
721
+
722
+ streams.push(transformStream);
723
+ }
724
+
725
+ // decompress the response body transparently if required
726
+ let responseStream = res;
727
+
728
+ // return the last request in case of redirects
729
+ const lastRequest = res.req || req;
730
+
731
+ // if decompress disabled we should not decompress
732
+ if (config.decompress !== false && res.headers['content-encoding']) {
733
+ // if no content, but headers still say that it is encoded,
734
+ // remove the header not confuse downstream operations
735
+ if (method === 'HEAD' || res.statusCode === 204) {
736
+ delete res.headers['content-encoding'];
737
+ }
738
+
739
+ switch ((res.headers['content-encoding'] || '').toLowerCase()) {
740
+ /*eslint default-case:0*/
741
+ case 'gzip':
742
+ case 'x-gzip':
743
+ case 'compress':
744
+ case 'x-compress':
745
+ // add the unzipper to the body stream processing pipeline
746
+ streams.push(zlib.createUnzip(zlibOptions));
747
+
748
+ // remove the content-encoding in order to not confuse downstream operations
749
+ delete res.headers['content-encoding'];
750
+ break;
751
+ case 'deflate':
752
+ streams.push(new ZlibHeaderTransformStream());
753
+
754
+ // add the unzipper to the body stream processing pipeline
755
+ streams.push(zlib.createUnzip(zlibOptions));
756
+
757
+ // remove the content-encoding in order to not confuse downstream operations
758
+ delete res.headers['content-encoding'];
759
+ break;
760
+ case 'br':
761
+ if (isBrotliSupported) {
762
+ streams.push(zlib.createBrotliDecompress(brotliOptions));
763
+ delete res.headers['content-encoding'];
764
+ }
765
+ }
766
+ }
767
+
768
+ responseStream = streams.length > 1 ? stream.pipeline(streams, utils.noop) : streams[0];
769
+
770
+ const response = {
771
+ status: res.statusCode,
772
+ statusText: res.statusMessage,
773
+ headers: new AxiosHeaders(res.headers),
774
+ config,
775
+ request: lastRequest,
776
+ };
777
+
778
+ if (responseType === 'stream') {
779
+ response.data = responseStream;
780
+ settle(resolve, reject, response);
781
+ } else {
782
+ const responseBuffer = [];
783
+ let totalResponseBytes = 0;
784
+
785
+ responseStream.on('data', function handleStreamData(chunk) {
786
+ responseBuffer.push(chunk);
787
+ totalResponseBytes += chunk.length;
788
+
789
+ // make sure the content length is not over the maxContentLength if specified
790
+ if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
791
+ // stream.destroy() emit aborted event before calling reject() on Node.js v16
792
+ rejected = true;
793
+ responseStream.destroy();
794
+ abort(
795
+ new AxiosError(
796
+ 'maxContentLength size of ' + config.maxContentLength + ' exceeded',
797
+ AxiosError.ERR_BAD_RESPONSE,
798
+ config,
799
+ lastRequest
800
+ )
801
+ );
802
+ }
803
+ });
804
+
805
+ responseStream.on('aborted', function handlerStreamAborted() {
806
+ if (rejected) {
807
+ return;
808
+ }
809
+
810
+ const err = new AxiosError(
811
+ 'stream has been aborted',
812
+ AxiosError.ERR_BAD_RESPONSE,
813
+ config,
814
+ lastRequest
815
+ );
816
+ responseStream.destroy(err);
817
+ reject(err);
818
+ });
819
+
820
+ responseStream.on('error', function handleStreamError(err) {
821
+ if (req.destroyed) return;
822
+ reject(AxiosError.from(err, null, config, lastRequest));
823
+ });
824
+
825
+ responseStream.on('end', function handleStreamEnd() {
826
+ try {
827
+ let responseData =
828
+ responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
829
+ if (responseType !== 'arraybuffer') {
830
+ responseData = responseData.toString(responseEncoding);
831
+ if (!responseEncoding || responseEncoding === 'utf8') {
832
+ responseData = utils.stripBOM(responseData);
833
+ }
834
+ }
835
+ response.data = responseData;
836
+ } catch (err) {
837
+ return reject(AxiosError.from(err, null, config, response.request, response));
838
+ }
839
+ settle(resolve, reject, response);
840
+ });
841
+ }
842
+
843
+ abortEmitter.once('abort', (err) => {
844
+ if (!responseStream.destroyed) {
845
+ responseStream.emit('error', err);
846
+ responseStream.destroy();
847
+ }
848
+ });
849
+ });
850
+
851
+ abortEmitter.once('abort', (err) => {
852
+ if (req.close) {
853
+ req.close();
854
+ } else {
855
+ req.destroy(err);
856
+ }
857
+ });
858
+
859
+ // Handle errors
860
+ req.on('error', function handleRequestError(err) {
861
+ reject(AxiosError.from(err, null, config, req));
862
+ });
863
+
864
+ // set tcp keep alive to prevent drop connection by peer
865
+ req.on('socket', function handleRequestSocket(socket) {
866
+ // default interval of sending ack packet is 1 minute
867
+ socket.setKeepAlive(true, 1000 * 60);
868
+ });
869
+
870
+ // Handle request timeout
871
+ if (config.timeout) {
872
+ // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
873
+ const timeout = parseInt(config.timeout, 10);
874
+
875
+ if (Number.isNaN(timeout)) {
876
+ abort(
877
+ new AxiosError(
878
+ 'error trying to parse `config.timeout` to int',
879
+ AxiosError.ERR_BAD_OPTION_VALUE,
880
+ config,
881
+ req
882
+ )
883
+ );
884
+
885
+ return;
886
+ }
887
+
888
+ // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
889
+ // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
890
+ // At this time, if we have a large number of request, nodejs will hang up some socket on background. and the number will up and up.
891
+ // And then these socket which be hang up will devouring CPU little by little.
892
+ // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
893
+ req.setTimeout(timeout, function handleRequestTimeout() {
894
+ if (isDone) return;
895
+ let timeoutErrorMessage = config.timeout
896
+ ? 'timeout of ' + config.timeout + 'ms exceeded'
897
+ : 'timeout exceeded';
898
+ const transitional = config.transitional || transitionalDefaults;
899
+ if (config.timeoutErrorMessage) {
900
+ timeoutErrorMessage = config.timeoutErrorMessage;
901
+ }
902
+ abort(
903
+ new AxiosError(
904
+ timeoutErrorMessage,
905
+ transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED,
906
+ config,
907
+ req
908
+ )
909
+ );
910
+ });
911
+ } else {
912
+ // explicitly reset the socket timeout value for a possible `keep-alive` request
913
+ req.setTimeout(0);
914
+ }
915
+
916
+ // Send the request
917
+ if (utils.isStream(data)) {
918
+ let ended = false;
919
+ let errored = false;
920
+
921
+ data.on('end', () => {
922
+ ended = true;
923
+ });
924
+
925
+ data.once('error', (err) => {
926
+ errored = true;
927
+ req.destroy(err);
928
+ });
929
+
930
+ data.on('close', () => {
931
+ if (!ended && !errored) {
932
+ abort(new CanceledError('Request stream has been aborted', config, req));
933
+ }
934
+ });
935
+
936
+ data.pipe(req);
937
+ } else {
938
+ data && req.write(data);
939
+ req.end();
940
+ }
941
+ });
942
+ };
943
+
944
+ export { httpAdapter as default };
945
+ //# sourceMappingURL=http.js.map