@mavogel/awscdk-rootmail 0.0.334 → 0.0.335

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 (393) hide show
  1. package/.jsii +2 -4
  2. package/CLAUDE.md +14 -30
  3. package/cdk.json +0 -1
  4. package/lib/rootmail.js +1 -1
  5. package/lib/ses-receive.js +1 -1
  6. package/package.json +1 -10
  7. package/lib/index-cli-synth.d.ts +0 -1
  8. package/lib/index-cli-synth.js +0 -68
  9. package/lib/scripts/publish-assets.d.ts +0 -1
  10. package/lib/scripts/publish-assets.js +0 -39
  11. package/node_modules/async-retry/LICENSE.md +0 -21
  12. package/node_modules/async-retry/README.md +0 -53
  13. package/node_modules/async-retry/lib/index.js +0 -61
  14. package/node_modules/async-retry/package.json +0 -55
  15. package/node_modules/asynckit/LICENSE +0 -21
  16. package/node_modules/asynckit/README.md +0 -233
  17. package/node_modules/asynckit/bench.js +0 -76
  18. package/node_modules/asynckit/index.js +0 -6
  19. package/node_modules/asynckit/lib/abort.js +0 -29
  20. package/node_modules/asynckit/lib/async.js +0 -34
  21. package/node_modules/asynckit/lib/defer.js +0 -26
  22. package/node_modules/asynckit/lib/iterate.js +0 -75
  23. package/node_modules/asynckit/lib/readable_asynckit.js +0 -91
  24. package/node_modules/asynckit/lib/readable_parallel.js +0 -25
  25. package/node_modules/asynckit/lib/readable_serial.js +0 -25
  26. package/node_modules/asynckit/lib/readable_serial_ordered.js +0 -29
  27. package/node_modules/asynckit/lib/state.js +0 -37
  28. package/node_modules/asynckit/lib/streamify.js +0 -141
  29. package/node_modules/asynckit/lib/terminator.js +0 -29
  30. package/node_modules/asynckit/package.json +0 -63
  31. package/node_modules/asynckit/parallel.js +0 -43
  32. package/node_modules/asynckit/serial.js +0 -17
  33. package/node_modules/asynckit/serialOrdered.js +0 -75
  34. package/node_modules/asynckit/stream.js +0 -21
  35. package/node_modules/axios/CHANGELOG.md +0 -1416
  36. package/node_modules/axios/LICENSE +0 -7
  37. package/node_modules/axios/MIGRATION_GUIDE.md +0 -877
  38. package/node_modules/axios/README.md +0 -2019
  39. package/node_modules/axios/dist/axios.js +0 -4494
  40. package/node_modules/axios/dist/axios.js.map +0 -1
  41. package/node_modules/axios/dist/axios.min.js +0 -5
  42. package/node_modules/axios/dist/axios.min.js.map +0 -1
  43. package/node_modules/axios/dist/browser/axios.cjs +0 -4273
  44. package/node_modules/axios/dist/browser/axios.cjs.map +0 -1
  45. package/node_modules/axios/dist/esm/axios.js +0 -4293
  46. package/node_modules/axios/dist/esm/axios.js.map +0 -1
  47. package/node_modules/axios/dist/esm/axios.min.js +0 -3
  48. package/node_modules/axios/dist/esm/axios.min.js.map +0 -1
  49. package/node_modules/axios/dist/node/axios.cjs +0 -4811
  50. package/node_modules/axios/dist/node/axios.cjs.map +0 -1
  51. package/node_modules/axios/index.d.cts +0 -716
  52. package/node_modules/axios/index.d.ts +0 -810
  53. package/node_modules/axios/index.js +0 -43
  54. package/node_modules/axios/lib/adapters/README.md +0 -36
  55. package/node_modules/axios/lib/adapters/adapters.js +0 -130
  56. package/node_modules/axios/lib/adapters/fetch.js +0 -338
  57. package/node_modules/axios/lib/adapters/http.js +0 -954
  58. package/node_modules/axios/lib/adapters/xhr.js +0 -222
  59. package/node_modules/axios/lib/axios.js +0 -89
  60. package/node_modules/axios/lib/cancel/CancelToken.js +0 -135
  61. package/node_modules/axios/lib/cancel/CanceledError.js +0 -22
  62. package/node_modules/axios/lib/cancel/isCancel.js +0 -5
  63. package/node_modules/axios/lib/core/Axios.js +0 -277
  64. package/node_modules/axios/lib/core/AxiosError.js +0 -90
  65. package/node_modules/axios/lib/core/AxiosHeaders.js +0 -378
  66. package/node_modules/axios/lib/core/InterceptorManager.js +0 -72
  67. package/node_modules/axios/lib/core/README.md +0 -8
  68. package/node_modules/axios/lib/core/buildFullPath.js +0 -22
  69. package/node_modules/axios/lib/core/dispatchRequest.js +0 -77
  70. package/node_modules/axios/lib/core/mergeConfig.js +0 -107
  71. package/node_modules/axios/lib/core/settle.js +0 -31
  72. package/node_modules/axios/lib/core/transformData.js +0 -28
  73. package/node_modules/axios/lib/defaults/index.js +0 -172
  74. package/node_modules/axios/lib/defaults/transitional.js +0 -8
  75. package/node_modules/axios/lib/env/README.md +0 -3
  76. package/node_modules/axios/lib/env/classes/FormData.js +0 -2
  77. package/node_modules/axios/lib/env/data.js +0 -1
  78. package/node_modules/axios/lib/helpers/AxiosTransformStream.js +0 -156
  79. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -62
  80. package/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -77
  81. package/node_modules/axios/lib/helpers/README.md +0 -7
  82. package/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +0 -29
  83. package/node_modules/axios/lib/helpers/bind.js +0 -14
  84. package/node_modules/axios/lib/helpers/buildURL.js +0 -66
  85. package/node_modules/axios/lib/helpers/callbackify.js +0 -18
  86. package/node_modules/axios/lib/helpers/combineURLs.js +0 -15
  87. package/node_modules/axios/lib/helpers/composeSignals.js +0 -56
  88. package/node_modules/axios/lib/helpers/cookies.js +0 -48
  89. package/node_modules/axios/lib/helpers/deprecatedMethod.js +0 -31
  90. package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +0 -73
  91. package/node_modules/axios/lib/helpers/formDataToJSON.js +0 -95
  92. package/node_modules/axios/lib/helpers/formDataToStream.js +0 -118
  93. package/node_modules/axios/lib/helpers/fromDataURI.js +0 -53
  94. package/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -19
  95. package/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
  96. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -16
  97. package/node_modules/axios/lib/helpers/null.js +0 -2
  98. package/node_modules/axios/lib/helpers/parseHeaders.js +0 -69
  99. package/node_modules/axios/lib/helpers/parseProtocol.js +0 -6
  100. package/node_modules/axios/lib/helpers/progressEventReducer.js +0 -51
  101. package/node_modules/axios/lib/helpers/readBlob.js +0 -15
  102. package/node_modules/axios/lib/helpers/resolveConfig.js +0 -70
  103. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +0 -106
  104. package/node_modules/axios/lib/helpers/speedometer.js +0 -55
  105. package/node_modules/axios/lib/helpers/spread.js +0 -28
  106. package/node_modules/axios/lib/helpers/throttle.js +0 -44
  107. package/node_modules/axios/lib/helpers/toFormData.js +0 -241
  108. package/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -19
  109. package/node_modules/axios/lib/helpers/trackStream.js +0 -89
  110. package/node_modules/axios/lib/helpers/validator.js +0 -110
  111. package/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -3
  112. package/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -3
  113. package/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -4
  114. package/node_modules/axios/lib/platform/browser/index.js +0 -13
  115. package/node_modules/axios/lib/platform/common/utils.js +0 -52
  116. package/node_modules/axios/lib/platform/index.js +0 -7
  117. package/node_modules/axios/lib/platform/node/classes/FormData.js +0 -3
  118. package/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +0 -4
  119. package/node_modules/axios/lib/platform/node/index.js +0 -37
  120. package/node_modules/axios/lib/utils.js +0 -919
  121. package/node_modules/axios/package.json +0 -190
  122. package/node_modules/call-bind-apply-helpers/.eslintrc +0 -17
  123. package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +0 -12
  124. package/node_modules/call-bind-apply-helpers/.nycrc +0 -9
  125. package/node_modules/call-bind-apply-helpers/CHANGELOG.md +0 -30
  126. package/node_modules/call-bind-apply-helpers/LICENSE +0 -21
  127. package/node_modules/call-bind-apply-helpers/README.md +0 -62
  128. package/node_modules/call-bind-apply-helpers/actualApply.d.ts +0 -1
  129. package/node_modules/call-bind-apply-helpers/actualApply.js +0 -10
  130. package/node_modules/call-bind-apply-helpers/applyBind.d.ts +0 -19
  131. package/node_modules/call-bind-apply-helpers/applyBind.js +0 -10
  132. package/node_modules/call-bind-apply-helpers/functionApply.d.ts +0 -1
  133. package/node_modules/call-bind-apply-helpers/functionApply.js +0 -4
  134. package/node_modules/call-bind-apply-helpers/functionCall.d.ts +0 -1
  135. package/node_modules/call-bind-apply-helpers/functionCall.js +0 -4
  136. package/node_modules/call-bind-apply-helpers/index.d.ts +0 -64
  137. package/node_modules/call-bind-apply-helpers/index.js +0 -15
  138. package/node_modules/call-bind-apply-helpers/package.json +0 -85
  139. package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +0 -3
  140. package/node_modules/call-bind-apply-helpers/reflectApply.js +0 -4
  141. package/node_modules/call-bind-apply-helpers/test/index.js +0 -63
  142. package/node_modules/call-bind-apply-helpers/tsconfig.json +0 -9
  143. package/node_modules/combined-stream/License +0 -19
  144. package/node_modules/combined-stream/Readme.md +0 -138
  145. package/node_modules/combined-stream/lib/combined_stream.js +0 -208
  146. package/node_modules/combined-stream/package.json +0 -25
  147. package/node_modules/delayed-stream/.npmignore +0 -1
  148. package/node_modules/delayed-stream/License +0 -19
  149. package/node_modules/delayed-stream/Makefile +0 -7
  150. package/node_modules/delayed-stream/Readme.md +0 -141
  151. package/node_modules/delayed-stream/lib/delayed_stream.js +0 -107
  152. package/node_modules/delayed-stream/package.json +0 -27
  153. package/node_modules/dunder-proto/.eslintrc +0 -5
  154. package/node_modules/dunder-proto/.github/FUNDING.yml +0 -12
  155. package/node_modules/dunder-proto/.nycrc +0 -13
  156. package/node_modules/dunder-proto/CHANGELOG.md +0 -24
  157. package/node_modules/dunder-proto/LICENSE +0 -21
  158. package/node_modules/dunder-proto/README.md +0 -54
  159. package/node_modules/dunder-proto/get.d.ts +0 -5
  160. package/node_modules/dunder-proto/get.js +0 -30
  161. package/node_modules/dunder-proto/package.json +0 -76
  162. package/node_modules/dunder-proto/set.d.ts +0 -5
  163. package/node_modules/dunder-proto/set.js +0 -35
  164. package/node_modules/dunder-proto/test/get.js +0 -34
  165. package/node_modules/dunder-proto/test/index.js +0 -4
  166. package/node_modules/dunder-proto/test/set.js +0 -50
  167. package/node_modules/dunder-proto/tsconfig.json +0 -9
  168. package/node_modules/es-define-property/.eslintrc +0 -13
  169. package/node_modules/es-define-property/.github/FUNDING.yml +0 -12
  170. package/node_modules/es-define-property/.nycrc +0 -9
  171. package/node_modules/es-define-property/CHANGELOG.md +0 -29
  172. package/node_modules/es-define-property/LICENSE +0 -21
  173. package/node_modules/es-define-property/README.md +0 -49
  174. package/node_modules/es-define-property/index.d.ts +0 -3
  175. package/node_modules/es-define-property/index.js +0 -14
  176. package/node_modules/es-define-property/package.json +0 -81
  177. package/node_modules/es-define-property/test/index.js +0 -56
  178. package/node_modules/es-define-property/tsconfig.json +0 -10
  179. package/node_modules/es-errors/.eslintrc +0 -5
  180. package/node_modules/es-errors/.github/FUNDING.yml +0 -12
  181. package/node_modules/es-errors/CHANGELOG.md +0 -40
  182. package/node_modules/es-errors/LICENSE +0 -21
  183. package/node_modules/es-errors/README.md +0 -55
  184. package/node_modules/es-errors/eval.d.ts +0 -3
  185. package/node_modules/es-errors/eval.js +0 -4
  186. package/node_modules/es-errors/index.d.ts +0 -3
  187. package/node_modules/es-errors/index.js +0 -4
  188. package/node_modules/es-errors/package.json +0 -80
  189. package/node_modules/es-errors/range.d.ts +0 -3
  190. package/node_modules/es-errors/range.js +0 -4
  191. package/node_modules/es-errors/ref.d.ts +0 -3
  192. package/node_modules/es-errors/ref.js +0 -4
  193. package/node_modules/es-errors/syntax.d.ts +0 -3
  194. package/node_modules/es-errors/syntax.js +0 -4
  195. package/node_modules/es-errors/test/index.js +0 -19
  196. package/node_modules/es-errors/tsconfig.json +0 -49
  197. package/node_modules/es-errors/type.d.ts +0 -3
  198. package/node_modules/es-errors/type.js +0 -4
  199. package/node_modules/es-errors/uri.d.ts +0 -3
  200. package/node_modules/es-errors/uri.js +0 -4
  201. package/node_modules/es-object-atoms/.eslintrc +0 -16
  202. package/node_modules/es-object-atoms/.github/FUNDING.yml +0 -12
  203. package/node_modules/es-object-atoms/CHANGELOG.md +0 -37
  204. package/node_modules/es-object-atoms/LICENSE +0 -21
  205. package/node_modules/es-object-atoms/README.md +0 -63
  206. package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +0 -3
  207. package/node_modules/es-object-atoms/RequireObjectCoercible.js +0 -11
  208. package/node_modules/es-object-atoms/ToObject.d.ts +0 -7
  209. package/node_modules/es-object-atoms/ToObject.js +0 -10
  210. package/node_modules/es-object-atoms/index.d.ts +0 -3
  211. package/node_modules/es-object-atoms/index.js +0 -4
  212. package/node_modules/es-object-atoms/isObject.d.ts +0 -3
  213. package/node_modules/es-object-atoms/isObject.js +0 -6
  214. package/node_modules/es-object-atoms/package.json +0 -80
  215. package/node_modules/es-object-atoms/test/index.js +0 -38
  216. package/node_modules/es-object-atoms/tsconfig.json +0 -6
  217. package/node_modules/es-set-tostringtag/.eslintrc +0 -13
  218. package/node_modules/es-set-tostringtag/.nycrc +0 -9
  219. package/node_modules/es-set-tostringtag/CHANGELOG.md +0 -67
  220. package/node_modules/es-set-tostringtag/LICENSE +0 -21
  221. package/node_modules/es-set-tostringtag/README.md +0 -53
  222. package/node_modules/es-set-tostringtag/index.d.ts +0 -10
  223. package/node_modules/es-set-tostringtag/index.js +0 -35
  224. package/node_modules/es-set-tostringtag/package.json +0 -78
  225. package/node_modules/es-set-tostringtag/test/index.js +0 -85
  226. package/node_modules/es-set-tostringtag/tsconfig.json +0 -9
  227. package/node_modules/follow-redirects/LICENSE +0 -18
  228. package/node_modules/follow-redirects/README.md +0 -155
  229. package/node_modules/follow-redirects/debug.js +0 -15
  230. package/node_modules/follow-redirects/http.js +0 -1
  231. package/node_modules/follow-redirects/https.js +0 -1
  232. package/node_modules/follow-redirects/index.js +0 -686
  233. package/node_modules/follow-redirects/package.json +0 -58
  234. package/node_modules/form-data/CHANGELOG.md +0 -659
  235. package/node_modules/form-data/License +0 -19
  236. package/node_modules/form-data/README.md +0 -355
  237. package/node_modules/form-data/index.d.ts +0 -62
  238. package/node_modules/form-data/lib/browser.js +0 -4
  239. package/node_modules/form-data/lib/form_data.js +0 -494
  240. package/node_modules/form-data/lib/populate.js +0 -10
  241. package/node_modules/form-data/package.json +0 -82
  242. package/node_modules/function-bind/.eslintrc +0 -21
  243. package/node_modules/function-bind/.github/FUNDING.yml +0 -12
  244. package/node_modules/function-bind/.github/SECURITY.md +0 -3
  245. package/node_modules/function-bind/.nycrc +0 -13
  246. package/node_modules/function-bind/CHANGELOG.md +0 -136
  247. package/node_modules/function-bind/LICENSE +0 -20
  248. package/node_modules/function-bind/README.md +0 -46
  249. package/node_modules/function-bind/implementation.js +0 -84
  250. package/node_modules/function-bind/index.js +0 -5
  251. package/node_modules/function-bind/package.json +0 -87
  252. package/node_modules/function-bind/test/.eslintrc +0 -9
  253. package/node_modules/function-bind/test/index.js +0 -252
  254. package/node_modules/get-intrinsic/.eslintrc +0 -42
  255. package/node_modules/get-intrinsic/.github/FUNDING.yml +0 -12
  256. package/node_modules/get-intrinsic/.nycrc +0 -9
  257. package/node_modules/get-intrinsic/CHANGELOG.md +0 -186
  258. package/node_modules/get-intrinsic/LICENSE +0 -21
  259. package/node_modules/get-intrinsic/README.md +0 -71
  260. package/node_modules/get-intrinsic/index.js +0 -378
  261. package/node_modules/get-intrinsic/package.json +0 -97
  262. package/node_modules/get-intrinsic/test/GetIntrinsic.js +0 -274
  263. package/node_modules/get-proto/.eslintrc +0 -10
  264. package/node_modules/get-proto/.github/FUNDING.yml +0 -12
  265. package/node_modules/get-proto/.nycrc +0 -9
  266. package/node_modules/get-proto/CHANGELOG.md +0 -21
  267. package/node_modules/get-proto/LICENSE +0 -21
  268. package/node_modules/get-proto/Object.getPrototypeOf.d.ts +0 -5
  269. package/node_modules/get-proto/Object.getPrototypeOf.js +0 -6
  270. package/node_modules/get-proto/README.md +0 -50
  271. package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +0 -3
  272. package/node_modules/get-proto/Reflect.getPrototypeOf.js +0 -4
  273. package/node_modules/get-proto/index.d.ts +0 -5
  274. package/node_modules/get-proto/index.js +0 -27
  275. package/node_modules/get-proto/package.json +0 -81
  276. package/node_modules/get-proto/test/index.js +0 -68
  277. package/node_modules/get-proto/tsconfig.json +0 -9
  278. package/node_modules/gopd/.eslintrc +0 -16
  279. package/node_modules/gopd/.github/FUNDING.yml +0 -12
  280. package/node_modules/gopd/CHANGELOG.md +0 -45
  281. package/node_modules/gopd/LICENSE +0 -21
  282. package/node_modules/gopd/README.md +0 -40
  283. package/node_modules/gopd/gOPD.d.ts +0 -1
  284. package/node_modules/gopd/gOPD.js +0 -4
  285. package/node_modules/gopd/index.d.ts +0 -5
  286. package/node_modules/gopd/index.js +0 -15
  287. package/node_modules/gopd/package.json +0 -77
  288. package/node_modules/gopd/test/index.js +0 -36
  289. package/node_modules/gopd/tsconfig.json +0 -9
  290. package/node_modules/has-symbols/.eslintrc +0 -11
  291. package/node_modules/has-symbols/.github/FUNDING.yml +0 -12
  292. package/node_modules/has-symbols/.nycrc +0 -9
  293. package/node_modules/has-symbols/CHANGELOG.md +0 -91
  294. package/node_modules/has-symbols/LICENSE +0 -21
  295. package/node_modules/has-symbols/README.md +0 -46
  296. package/node_modules/has-symbols/index.d.ts +0 -3
  297. package/node_modules/has-symbols/index.js +0 -14
  298. package/node_modules/has-symbols/package.json +0 -111
  299. package/node_modules/has-symbols/shams.d.ts +0 -3
  300. package/node_modules/has-symbols/shams.js +0 -45
  301. package/node_modules/has-symbols/test/index.js +0 -22
  302. package/node_modules/has-symbols/test/shams/core-js.js +0 -29
  303. package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +0 -29
  304. package/node_modules/has-symbols/test/tests.js +0 -58
  305. package/node_modules/has-symbols/tsconfig.json +0 -10
  306. package/node_modules/has-tostringtag/.eslintrc +0 -5
  307. package/node_modules/has-tostringtag/.github/FUNDING.yml +0 -12
  308. package/node_modules/has-tostringtag/.nycrc +0 -13
  309. package/node_modules/has-tostringtag/CHANGELOG.md +0 -42
  310. package/node_modules/has-tostringtag/LICENSE +0 -21
  311. package/node_modules/has-tostringtag/README.md +0 -46
  312. package/node_modules/has-tostringtag/index.d.ts +0 -3
  313. package/node_modules/has-tostringtag/index.js +0 -8
  314. package/node_modules/has-tostringtag/package.json +0 -108
  315. package/node_modules/has-tostringtag/shams.d.ts +0 -3
  316. package/node_modules/has-tostringtag/shams.js +0 -8
  317. package/node_modules/has-tostringtag/test/index.js +0 -21
  318. package/node_modules/has-tostringtag/test/shams/core-js.js +0 -31
  319. package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +0 -30
  320. package/node_modules/has-tostringtag/test/tests.js +0 -15
  321. package/node_modules/has-tostringtag/tsconfig.json +0 -49
  322. package/node_modules/hasown/.eslintrc +0 -5
  323. package/node_modules/hasown/.github/FUNDING.yml +0 -12
  324. package/node_modules/hasown/.nycrc +0 -13
  325. package/node_modules/hasown/CHANGELOG.md +0 -40
  326. package/node_modules/hasown/LICENSE +0 -21
  327. package/node_modules/hasown/README.md +0 -40
  328. package/node_modules/hasown/index.d.ts +0 -3
  329. package/node_modules/hasown/index.js +0 -8
  330. package/node_modules/hasown/package.json +0 -92
  331. package/node_modules/hasown/tsconfig.json +0 -6
  332. package/node_modules/math-intrinsics/.eslintrc +0 -16
  333. package/node_modules/math-intrinsics/.github/FUNDING.yml +0 -12
  334. package/node_modules/math-intrinsics/CHANGELOG.md +0 -24
  335. package/node_modules/math-intrinsics/LICENSE +0 -21
  336. package/node_modules/math-intrinsics/README.md +0 -50
  337. package/node_modules/math-intrinsics/abs.d.ts +0 -1
  338. package/node_modules/math-intrinsics/abs.js +0 -4
  339. package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +0 -3
  340. package/node_modules/math-intrinsics/constants/maxArrayLength.js +0 -4
  341. package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +0 -3
  342. package/node_modules/math-intrinsics/constants/maxSafeInteger.js +0 -5
  343. package/node_modules/math-intrinsics/constants/maxValue.d.ts +0 -3
  344. package/node_modules/math-intrinsics/constants/maxValue.js +0 -5
  345. package/node_modules/math-intrinsics/floor.d.ts +0 -1
  346. package/node_modules/math-intrinsics/floor.js +0 -4
  347. package/node_modules/math-intrinsics/isFinite.d.ts +0 -3
  348. package/node_modules/math-intrinsics/isFinite.js +0 -12
  349. package/node_modules/math-intrinsics/isInteger.d.ts +0 -3
  350. package/node_modules/math-intrinsics/isInteger.js +0 -16
  351. package/node_modules/math-intrinsics/isNaN.d.ts +0 -1
  352. package/node_modules/math-intrinsics/isNaN.js +0 -6
  353. package/node_modules/math-intrinsics/isNegativeZero.d.ts +0 -3
  354. package/node_modules/math-intrinsics/isNegativeZero.js +0 -6
  355. package/node_modules/math-intrinsics/max.d.ts +0 -1
  356. package/node_modules/math-intrinsics/max.js +0 -4
  357. package/node_modules/math-intrinsics/min.d.ts +0 -1
  358. package/node_modules/math-intrinsics/min.js +0 -4
  359. package/node_modules/math-intrinsics/mod.d.ts +0 -3
  360. package/node_modules/math-intrinsics/mod.js +0 -9
  361. package/node_modules/math-intrinsics/package.json +0 -86
  362. package/node_modules/math-intrinsics/pow.d.ts +0 -1
  363. package/node_modules/math-intrinsics/pow.js +0 -4
  364. package/node_modules/math-intrinsics/round.d.ts +0 -1
  365. package/node_modules/math-intrinsics/round.js +0 -4
  366. package/node_modules/math-intrinsics/sign.d.ts +0 -3
  367. package/node_modules/math-intrinsics/sign.js +0 -11
  368. package/node_modules/math-intrinsics/test/index.js +0 -192
  369. package/node_modules/math-intrinsics/tsconfig.json +0 -3
  370. package/node_modules/mime-db/HISTORY.md +0 -507
  371. package/node_modules/mime-db/LICENSE +0 -23
  372. package/node_modules/mime-db/README.md +0 -100
  373. package/node_modules/mime-db/db.json +0 -8519
  374. package/node_modules/mime-db/index.js +0 -12
  375. package/node_modules/mime-db/package.json +0 -60
  376. package/node_modules/mime-types/HISTORY.md +0 -397
  377. package/node_modules/mime-types/LICENSE +0 -23
  378. package/node_modules/mime-types/README.md +0 -113
  379. package/node_modules/mime-types/index.js +0 -188
  380. package/node_modules/mime-types/package.json +0 -44
  381. package/node_modules/proxy-from-env/LICENSE +0 -20
  382. package/node_modules/proxy-from-env/README.md +0 -163
  383. package/node_modules/proxy-from-env/index.cjs +0 -105
  384. package/node_modules/proxy-from-env/index.js +0 -103
  385. package/node_modules/proxy-from-env/package.json +0 -43
  386. package/node_modules/retry/License +0 -21
  387. package/node_modules/retry/README.md +0 -227
  388. package/node_modules/retry/example/dns.js +0 -31
  389. package/node_modules/retry/example/stop.js +0 -40
  390. package/node_modules/retry/index.js +0 -1
  391. package/node_modules/retry/lib/retry.js +0 -100
  392. package/node_modules/retry/lib/retry_operation.js +0 -162
  393. package/node_modules/retry/package.json +0 -36
@@ -1,4811 +0,0 @@
1
- /*! Axios v1.15.0 Copyright (c) 2026 Matt Zabriskie and contributors */
2
- 'use strict';
3
-
4
- var FormData$1 = require('form-data');
5
- var crypto = require('crypto');
6
- var url = require('url');
7
- var http = require('http');
8
- var https = require('https');
9
- var http2 = require('http2');
10
- var util = require('util');
11
- var followRedirects = require('follow-redirects');
12
- var zlib = require('zlib');
13
- var stream = require('stream');
14
- var events = require('events');
15
-
16
- /**
17
- * Create a bound version of a function with a specified `this` context
18
- *
19
- * @param {Function} fn - The function to bind
20
- * @param {*} thisArg - The value to be passed as the `this` parameter
21
- * @returns {Function} A new function that will call the original function with the specified `this` context
22
- */
23
- function bind(fn, thisArg) {
24
- return function wrap() {
25
- return fn.apply(thisArg, arguments);
26
- };
27
- }
28
-
29
- // utils is a library of generic helper functions non-specific to axios
30
-
31
- const {
32
- toString
33
- } = Object.prototype;
34
- const {
35
- getPrototypeOf
36
- } = Object;
37
- const {
38
- iterator,
39
- toStringTag
40
- } = Symbol;
41
- const kindOf = (cache => thing => {
42
- const str = toString.call(thing);
43
- return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
44
- })(Object.create(null));
45
- const kindOfTest = type => {
46
- type = type.toLowerCase();
47
- return thing => kindOf(thing) === type;
48
- };
49
- const typeOfTest = type => thing => typeof thing === type;
50
-
51
- /**
52
- * Determine if a value is a non-null object
53
- *
54
- * @param {Object} val The value to test
55
- *
56
- * @returns {boolean} True if value is an Array, otherwise false
57
- */
58
- const {
59
- isArray
60
- } = Array;
61
-
62
- /**
63
- * Determine if a value is undefined
64
- *
65
- * @param {*} val The value to test
66
- *
67
- * @returns {boolean} True if the value is undefined, otherwise false
68
- */
69
- const isUndefined = typeOfTest('undefined');
70
-
71
- /**
72
- * Determine if a value is a Buffer
73
- *
74
- * @param {*} val The value to test
75
- *
76
- * @returns {boolean} True if value is a Buffer, otherwise false
77
- */
78
- function isBuffer(val) {
79
- return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);
80
- }
81
-
82
- /**
83
- * Determine if a value is an ArrayBuffer
84
- *
85
- * @param {*} val The value to test
86
- *
87
- * @returns {boolean} True if value is an ArrayBuffer, otherwise false
88
- */
89
- const isArrayBuffer = kindOfTest('ArrayBuffer');
90
-
91
- /**
92
- * Determine if a value is a view on an ArrayBuffer
93
- *
94
- * @param {*} val The value to test
95
- *
96
- * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
97
- */
98
- function isArrayBufferView(val) {
99
- let result;
100
- if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
101
- result = ArrayBuffer.isView(val);
102
- } else {
103
- result = val && val.buffer && isArrayBuffer(val.buffer);
104
- }
105
- return result;
106
- }
107
-
108
- /**
109
- * Determine if a value is a String
110
- *
111
- * @param {*} val The value to test
112
- *
113
- * @returns {boolean} True if value is a String, otherwise false
114
- */
115
- const isString = typeOfTest('string');
116
-
117
- /**
118
- * Determine if a value is a Function
119
- *
120
- * @param {*} val The value to test
121
- * @returns {boolean} True if value is a Function, otherwise false
122
- */
123
- const isFunction$1 = typeOfTest('function');
124
-
125
- /**
126
- * Determine if a value is a Number
127
- *
128
- * @param {*} val The value to test
129
- *
130
- * @returns {boolean} True if value is a Number, otherwise false
131
- */
132
- const isNumber = typeOfTest('number');
133
-
134
- /**
135
- * Determine if a value is an Object
136
- *
137
- * @param {*} thing The value to test
138
- *
139
- * @returns {boolean} True if value is an Object, otherwise false
140
- */
141
- const isObject = thing => thing !== null && typeof thing === 'object';
142
-
143
- /**
144
- * Determine if a value is a Boolean
145
- *
146
- * @param {*} thing The value to test
147
- * @returns {boolean} True if value is a Boolean, otherwise false
148
- */
149
- const isBoolean = thing => thing === true || thing === false;
150
-
151
- /**
152
- * Determine if a value is a plain Object
153
- *
154
- * @param {*} val The value to test
155
- *
156
- * @returns {boolean} True if value is a plain Object, otherwise false
157
- */
158
- const isPlainObject = val => {
159
- if (kindOf(val) !== 'object') {
160
- return false;
161
- }
162
- const prototype = getPrototypeOf(val);
163
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);
164
- };
165
-
166
- /**
167
- * Determine if a value is an empty object (safely handles Buffers)
168
- *
169
- * @param {*} val The value to test
170
- *
171
- * @returns {boolean} True if value is an empty object, otherwise false
172
- */
173
- const isEmptyObject = val => {
174
- // Early return for non-objects or Buffers to prevent RangeError
175
- if (!isObject(val) || isBuffer(val)) {
176
- return false;
177
- }
178
- try {
179
- return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;
180
- } catch (e) {
181
- // Fallback for any other objects that might cause RangeError with Object.keys()
182
- return false;
183
- }
184
- };
185
-
186
- /**
187
- * Determine if a value is a Date
188
- *
189
- * @param {*} val The value to test
190
- *
191
- * @returns {boolean} True if value is a Date, otherwise false
192
- */
193
- const isDate = kindOfTest('Date');
194
-
195
- /**
196
- * Determine if a value is a File
197
- *
198
- * @param {*} val The value to test
199
- *
200
- * @returns {boolean} True if value is a File, otherwise false
201
- */
202
- const isFile = kindOfTest('File');
203
-
204
- /**
205
- * Determine if a value is a React Native Blob
206
- * React Native "blob": an object with a `uri` attribute. Optionally, it can
207
- * also have a `name` and `type` attribute to specify filename and content type
208
- *
209
- * @see https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/Libraries/Network/FormData.js#L68-L71
210
- *
211
- * @param {*} value The value to test
212
- *
213
- * @returns {boolean} True if value is a React Native Blob, otherwise false
214
- */
215
- const isReactNativeBlob = value => {
216
- return !!(value && typeof value.uri !== 'undefined');
217
- };
218
-
219
- /**
220
- * Determine if environment is React Native
221
- * ReactNative `FormData` has a non-standard `getParts()` method
222
- *
223
- * @param {*} formData The formData to test
224
- *
225
- * @returns {boolean} True if environment is React Native, otherwise false
226
- */
227
- const isReactNative = formData => formData && typeof formData.getParts !== 'undefined';
228
-
229
- /**
230
- * Determine if a value is a Blob
231
- *
232
- * @param {*} val The value to test
233
- *
234
- * @returns {boolean} True if value is a Blob, otherwise false
235
- */
236
- const isBlob = kindOfTest('Blob');
237
-
238
- /**
239
- * Determine if a value is a FileList
240
- *
241
- * @param {*} val The value to test
242
- *
243
- * @returns {boolean} True if value is a File, otherwise false
244
- */
245
- const isFileList = kindOfTest('FileList');
246
-
247
- /**
248
- * Determine if a value is a Stream
249
- *
250
- * @param {*} val The value to test
251
- *
252
- * @returns {boolean} True if value is a Stream, otherwise false
253
- */
254
- const isStream = val => isObject(val) && isFunction$1(val.pipe);
255
-
256
- /**
257
- * Determine if a value is a FormData
258
- *
259
- * @param {*} thing The value to test
260
- *
261
- * @returns {boolean} True if value is an FormData, otherwise false
262
- */
263
- function getGlobal() {
264
- if (typeof globalThis !== 'undefined') return globalThis;
265
- if (typeof self !== 'undefined') return self;
266
- if (typeof window !== 'undefined') return window;
267
- if (typeof global !== 'undefined') return global;
268
- return {};
269
- }
270
- const G = getGlobal();
271
- const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
272
- const isFormData = thing => {
273
- let kind;
274
- return thing && (FormDataCtor && thing instanceof FormDataCtor || isFunction$1(thing.append) && ((kind = kindOf(thing)) === 'formdata' ||
275
- // detect form-data instance
276
- kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]'));
277
- };
278
-
279
- /**
280
- * Determine if a value is a URLSearchParams object
281
- *
282
- * @param {*} val The value to test
283
- *
284
- * @returns {boolean} True if value is a URLSearchParams object, otherwise false
285
- */
286
- const isURLSearchParams = kindOfTest('URLSearchParams');
287
- const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
288
-
289
- /**
290
- * Trim excess whitespace off the beginning and end of a string
291
- *
292
- * @param {String} str The String to trim
293
- *
294
- * @returns {String} The String freed of excess whitespace
295
- */
296
- const trim = str => {
297
- return str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
298
- };
299
- /**
300
- * Iterate over an Array or an Object invoking a function for each item.
301
- *
302
- * If `obj` is an Array callback will be called passing
303
- * the value, index, and complete array for each item.
304
- *
305
- * If 'obj' is an Object callback will be called passing
306
- * the value, key, and complete object for each property.
307
- *
308
- * @param {Object|Array<unknown>} obj The object to iterate
309
- * @param {Function} fn The callback to invoke for each item
310
- *
311
- * @param {Object} [options]
312
- * @param {Boolean} [options.allOwnKeys = false]
313
- * @returns {any}
314
- */
315
- function forEach(obj, fn, {
316
- allOwnKeys = false
317
- } = {}) {
318
- // Don't bother if no value provided
319
- if (obj === null || typeof obj === 'undefined') {
320
- return;
321
- }
322
- let i;
323
- let l;
324
-
325
- // Force an array if not already something iterable
326
- if (typeof obj !== 'object') {
327
- /*eslint no-param-reassign:0*/
328
- obj = [obj];
329
- }
330
- if (isArray(obj)) {
331
- // Iterate over array values
332
- for (i = 0, l = obj.length; i < l; i++) {
333
- fn.call(null, obj[i], i, obj);
334
- }
335
- } else {
336
- // Buffer check
337
- if (isBuffer(obj)) {
338
- return;
339
- }
340
-
341
- // Iterate over object keys
342
- const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
343
- const len = keys.length;
344
- let key;
345
- for (i = 0; i < len; i++) {
346
- key = keys[i];
347
- fn.call(null, obj[key], key, obj);
348
- }
349
- }
350
- }
351
-
352
- /**
353
- * Finds a key in an object, case-insensitive, returning the actual key name.
354
- * Returns null if the object is a Buffer or if no match is found.
355
- *
356
- * @param {Object} obj - The object to search.
357
- * @param {string} key - The key to find (case-insensitive).
358
- * @returns {?string} The actual key name if found, otherwise null.
359
- */
360
- function findKey(obj, key) {
361
- if (isBuffer(obj)) {
362
- return null;
363
- }
364
- key = key.toLowerCase();
365
- const keys = Object.keys(obj);
366
- let i = keys.length;
367
- let _key;
368
- while (i-- > 0) {
369
- _key = keys[i];
370
- if (key === _key.toLowerCase()) {
371
- return _key;
372
- }
373
- }
374
- return null;
375
- }
376
- const _global = (() => {
377
- /*eslint no-undef:0*/
378
- if (typeof globalThis !== 'undefined') return globalThis;
379
- return typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : global;
380
- })();
381
- const isContextDefined = context => !isUndefined(context) && context !== _global;
382
-
383
- /**
384
- * Accepts varargs expecting each argument to be an object, then
385
- * immutably merges the properties of each object and returns result.
386
- *
387
- * When multiple objects contain the same key the later object in
388
- * the arguments list will take precedence.
389
- *
390
- * Example:
391
- *
392
- * ```js
393
- * const result = merge({foo: 123}, {foo: 456});
394
- * console.log(result.foo); // outputs 456
395
- * ```
396
- *
397
- * @param {Object} obj1 Object to merge
398
- *
399
- * @returns {Object} Result of all merge properties
400
- */
401
- function merge(/* obj1, obj2, obj3, ... */
402
- ) {
403
- const {
404
- caseless,
405
- skipUndefined
406
- } = isContextDefined(this) && this || {};
407
- const result = {};
408
- const assignValue = (val, key) => {
409
- // Skip dangerous property names to prevent prototype pollution
410
- if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
411
- return;
412
- }
413
- const targetKey = caseless && findKey(result, key) || key;
414
- if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
415
- result[targetKey] = merge(result[targetKey], val);
416
- } else if (isPlainObject(val)) {
417
- result[targetKey] = merge({}, val);
418
- } else if (isArray(val)) {
419
- result[targetKey] = val.slice();
420
- } else if (!skipUndefined || !isUndefined(val)) {
421
- result[targetKey] = val;
422
- }
423
- };
424
- for (let i = 0, l = arguments.length; i < l; i++) {
425
- arguments[i] && forEach(arguments[i], assignValue);
426
- }
427
- return result;
428
- }
429
-
430
- /**
431
- * Extends object a by mutably adding to it the properties of object b.
432
- *
433
- * @param {Object} a The object to be extended
434
- * @param {Object} b The object to copy properties from
435
- * @param {Object} thisArg The object to bind function to
436
- *
437
- * @param {Object} [options]
438
- * @param {Boolean} [options.allOwnKeys]
439
- * @returns {Object} The resulting value of object a
440
- */
441
- const extend = (a, b, thisArg, {
442
- allOwnKeys
443
- } = {}) => {
444
- forEach(b, (val, key) => {
445
- if (thisArg && isFunction$1(val)) {
446
- Object.defineProperty(a, key, {
447
- value: bind(val, thisArg),
448
- writable: true,
449
- enumerable: true,
450
- configurable: true
451
- });
452
- } else {
453
- Object.defineProperty(a, key, {
454
- value: val,
455
- writable: true,
456
- enumerable: true,
457
- configurable: true
458
- });
459
- }
460
- }, {
461
- allOwnKeys
462
- });
463
- return a;
464
- };
465
-
466
- /**
467
- * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
468
- *
469
- * @param {string} content with BOM
470
- *
471
- * @returns {string} content value without BOM
472
- */
473
- const stripBOM = content => {
474
- if (content.charCodeAt(0) === 0xfeff) {
475
- content = content.slice(1);
476
- }
477
- return content;
478
- };
479
-
480
- /**
481
- * Inherit the prototype methods from one constructor into another
482
- * @param {function} constructor
483
- * @param {function} superConstructor
484
- * @param {object} [props]
485
- * @param {object} [descriptors]
486
- *
487
- * @returns {void}
488
- */
489
- const inherits = (constructor, superConstructor, props, descriptors) => {
490
- constructor.prototype = Object.create(superConstructor.prototype, descriptors);
491
- Object.defineProperty(constructor.prototype, 'constructor', {
492
- value: constructor,
493
- writable: true,
494
- enumerable: false,
495
- configurable: true
496
- });
497
- Object.defineProperty(constructor, 'super', {
498
- value: superConstructor.prototype
499
- });
500
- props && Object.assign(constructor.prototype, props);
501
- };
502
-
503
- /**
504
- * Resolve object with deep prototype chain to a flat object
505
- * @param {Object} sourceObj source object
506
- * @param {Object} [destObj]
507
- * @param {Function|Boolean} [filter]
508
- * @param {Function} [propFilter]
509
- *
510
- * @returns {Object}
511
- */
512
- const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
513
- let props;
514
- let i;
515
- let prop;
516
- const merged = {};
517
- destObj = destObj || {};
518
- // eslint-disable-next-line no-eq-null,eqeqeq
519
- if (sourceObj == null) return destObj;
520
- do {
521
- props = Object.getOwnPropertyNames(sourceObj);
522
- i = props.length;
523
- while (i-- > 0) {
524
- prop = props[i];
525
- if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
526
- destObj[prop] = sourceObj[prop];
527
- merged[prop] = true;
528
- }
529
- }
530
- sourceObj = filter !== false && getPrototypeOf(sourceObj);
531
- } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);
532
- return destObj;
533
- };
534
-
535
- /**
536
- * Determines whether a string ends with the characters of a specified string
537
- *
538
- * @param {String} str
539
- * @param {String} searchString
540
- * @param {Number} [position= 0]
541
- *
542
- * @returns {boolean}
543
- */
544
- const endsWith = (str, searchString, position) => {
545
- str = String(str);
546
- if (position === undefined || position > str.length) {
547
- position = str.length;
548
- }
549
- position -= searchString.length;
550
- const lastIndex = str.indexOf(searchString, position);
551
- return lastIndex !== -1 && lastIndex === position;
552
- };
553
-
554
- /**
555
- * Returns new array from array like object or null if failed
556
- *
557
- * @param {*} [thing]
558
- *
559
- * @returns {?Array}
560
- */
561
- const toArray = thing => {
562
- if (!thing) return null;
563
- if (isArray(thing)) return thing;
564
- let i = thing.length;
565
- if (!isNumber(i)) return null;
566
- const arr = new Array(i);
567
- while (i-- > 0) {
568
- arr[i] = thing[i];
569
- }
570
- return arr;
571
- };
572
-
573
- /**
574
- * Checking if the Uint8Array exists and if it does, it returns a function that checks if the
575
- * thing passed in is an instance of Uint8Array
576
- *
577
- * @param {TypedArray}
578
- *
579
- * @returns {Array}
580
- */
581
- // eslint-disable-next-line func-names
582
- const isTypedArray = (TypedArray => {
583
- // eslint-disable-next-line func-names
584
- return thing => {
585
- return TypedArray && thing instanceof TypedArray;
586
- };
587
- })(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));
588
-
589
- /**
590
- * For each entry in the object, call the function with the key and value.
591
- *
592
- * @param {Object<any, any>} obj - The object to iterate over.
593
- * @param {Function} fn - The function to call for each entry.
594
- *
595
- * @returns {void}
596
- */
597
- const forEachEntry = (obj, fn) => {
598
- const generator = obj && obj[iterator];
599
- const _iterator = generator.call(obj);
600
- let result;
601
- while ((result = _iterator.next()) && !result.done) {
602
- const pair = result.value;
603
- fn.call(obj, pair[0], pair[1]);
604
- }
605
- };
606
-
607
- /**
608
- * It takes a regular expression and a string, and returns an array of all the matches
609
- *
610
- * @param {string} regExp - The regular expression to match against.
611
- * @param {string} str - The string to search.
612
- *
613
- * @returns {Array<boolean>}
614
- */
615
- const matchAll = (regExp, str) => {
616
- let matches;
617
- const arr = [];
618
- while ((matches = regExp.exec(str)) !== null) {
619
- arr.push(matches);
620
- }
621
- return arr;
622
- };
623
-
624
- /* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
625
- const isHTMLForm = kindOfTest('HTMLFormElement');
626
- const toCamelCase = str => {
627
- return str.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
628
- return p1.toUpperCase() + p2;
629
- });
630
- };
631
-
632
- /* Creating a function that will check if an object has a property. */
633
- const hasOwnProperty = (({
634
- hasOwnProperty
635
- }) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);
636
-
637
- /**
638
- * Determine if a value is a RegExp object
639
- *
640
- * @param {*} val The value to test
641
- *
642
- * @returns {boolean} True if value is a RegExp object, otherwise false
643
- */
644
- const isRegExp = kindOfTest('RegExp');
645
- const reduceDescriptors = (obj, reducer) => {
646
- const descriptors = Object.getOwnPropertyDescriptors(obj);
647
- const reducedDescriptors = {};
648
- forEach(descriptors, (descriptor, name) => {
649
- let ret;
650
- if ((ret = reducer(descriptor, name, obj)) !== false) {
651
- reducedDescriptors[name] = ret || descriptor;
652
- }
653
- });
654
- Object.defineProperties(obj, reducedDescriptors);
655
- };
656
-
657
- /**
658
- * Makes all methods read-only
659
- * @param {Object} obj
660
- */
661
-
662
- const freezeMethods = obj => {
663
- reduceDescriptors(obj, (descriptor, name) => {
664
- // skip restricted props in strict mode
665
- if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {
666
- return false;
667
- }
668
- const value = obj[name];
669
- if (!isFunction$1(value)) return;
670
- descriptor.enumerable = false;
671
- if ('writable' in descriptor) {
672
- descriptor.writable = false;
673
- return;
674
- }
675
- if (!descriptor.set) {
676
- descriptor.set = () => {
677
- throw Error("Can not rewrite read-only method '" + name + "'");
678
- };
679
- }
680
- });
681
- };
682
-
683
- /**
684
- * Converts an array or a delimited string into an object set with values as keys and true as values.
685
- * Useful for fast membership checks.
686
- *
687
- * @param {Array|string} arrayOrString - The array or string to convert.
688
- * @param {string} delimiter - The delimiter to use if input is a string.
689
- * @returns {Object} An object with keys from the array or string, values set to true.
690
- */
691
- const toObjectSet = (arrayOrString, delimiter) => {
692
- const obj = {};
693
- const define = arr => {
694
- arr.forEach(value => {
695
- obj[value] = true;
696
- });
697
- };
698
- isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));
699
- return obj;
700
- };
701
- const noop = () => {};
702
- const toFiniteNumber = (value, defaultValue) => {
703
- return value != null && Number.isFinite(value = +value) ? value : defaultValue;
704
- };
705
-
706
- /**
707
- * If the thing is a FormData object, return true, otherwise return false.
708
- *
709
- * @param {unknown} thing - The thing to check.
710
- *
711
- * @returns {boolean}
712
- */
713
- function isSpecCompliantForm(thing) {
714
- return !!(thing && isFunction$1(thing.append) && thing[toStringTag] === 'FormData' && thing[iterator]);
715
- }
716
-
717
- /**
718
- * Recursively converts an object to a JSON-compatible object, handling circular references and Buffers.
719
- *
720
- * @param {Object} obj - The object to convert.
721
- * @returns {Object} The JSON-compatible object.
722
- */
723
- const toJSONObject = obj => {
724
- const stack = new Array(10);
725
- const visit = (source, i) => {
726
- if (isObject(source)) {
727
- if (stack.indexOf(source) >= 0) {
728
- return;
729
- }
730
-
731
- //Buffer check
732
- if (isBuffer(source)) {
733
- return source;
734
- }
735
- if (!('toJSON' in source)) {
736
- stack[i] = source;
737
- const target = isArray(source) ? [] : {};
738
- forEach(source, (value, key) => {
739
- const reducedValue = visit(value, i + 1);
740
- !isUndefined(reducedValue) && (target[key] = reducedValue);
741
- });
742
- stack[i] = undefined;
743
- return target;
744
- }
745
- }
746
- return source;
747
- };
748
- return visit(obj, 0);
749
- };
750
-
751
- /**
752
- * Determines if a value is an async function.
753
- *
754
- * @param {*} thing - The value to test.
755
- * @returns {boolean} True if value is an async function, otherwise false.
756
- */
757
- const isAsyncFn = kindOfTest('AsyncFunction');
758
-
759
- /**
760
- * Determines if a value is thenable (has then and catch methods).
761
- *
762
- * @param {*} thing - The value to test.
763
- * @returns {boolean} True if value is thenable, otherwise false.
764
- */
765
- const isThenable = thing => thing && (isObject(thing) || isFunction$1(thing)) && isFunction$1(thing.then) && isFunction$1(thing.catch);
766
-
767
- // original code
768
- // https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
769
-
770
- /**
771
- * Provides a cross-platform setImmediate implementation.
772
- * Uses native setImmediate if available, otherwise falls back to postMessage or setTimeout.
773
- *
774
- * @param {boolean} setImmediateSupported - Whether setImmediate is supported.
775
- * @param {boolean} postMessageSupported - Whether postMessage is supported.
776
- * @returns {Function} A function to schedule a callback asynchronously.
777
- */
778
- const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
779
- if (setImmediateSupported) {
780
- return setImmediate;
781
- }
782
- return postMessageSupported ? ((token, callbacks) => {
783
- _global.addEventListener('message', ({
784
- source,
785
- data
786
- }) => {
787
- if (source === _global && data === token) {
788
- callbacks.length && callbacks.shift()();
789
- }
790
- }, false);
791
- return cb => {
792
- callbacks.push(cb);
793
- _global.postMessage(token, '*');
794
- };
795
- })(`axios@${Math.random()}`, []) : cb => setTimeout(cb);
796
- })(typeof setImmediate === 'function', isFunction$1(_global.postMessage));
797
-
798
- /**
799
- * Schedules a microtask or asynchronous callback as soon as possible.
800
- * Uses queueMicrotask if available, otherwise falls back to process.nextTick or _setImmediate.
801
- *
802
- * @type {Function}
803
- */
804
- const asap = typeof queueMicrotask !== 'undefined' ? queueMicrotask.bind(_global) : typeof process !== 'undefined' && process.nextTick || _setImmediate;
805
-
806
- // *********************
807
-
808
- const isIterable = thing => thing != null && isFunction$1(thing[iterator]);
809
- var utils$1 = {
810
- isArray,
811
- isArrayBuffer,
812
- isBuffer,
813
- isFormData,
814
- isArrayBufferView,
815
- isString,
816
- isNumber,
817
- isBoolean,
818
- isObject,
819
- isPlainObject,
820
- isEmptyObject,
821
- isReadableStream,
822
- isRequest,
823
- isResponse,
824
- isHeaders,
825
- isUndefined,
826
- isDate,
827
- isFile,
828
- isReactNativeBlob,
829
- isReactNative,
830
- isBlob,
831
- isRegExp,
832
- isFunction: isFunction$1,
833
- isStream,
834
- isURLSearchParams,
835
- isTypedArray,
836
- isFileList,
837
- forEach,
838
- merge,
839
- extend,
840
- trim,
841
- stripBOM,
842
- inherits,
843
- toFlatObject,
844
- kindOf,
845
- kindOfTest,
846
- endsWith,
847
- toArray,
848
- forEachEntry,
849
- matchAll,
850
- isHTMLForm,
851
- hasOwnProperty,
852
- hasOwnProp: hasOwnProperty,
853
- // an alias to avoid ESLint no-prototype-builtins detection
854
- reduceDescriptors,
855
- freezeMethods,
856
- toObjectSet,
857
- toCamelCase,
858
- noop,
859
- toFiniteNumber,
860
- findKey,
861
- global: _global,
862
- isContextDefined,
863
- isSpecCompliantForm,
864
- toJSONObject,
865
- isAsyncFn,
866
- isThenable,
867
- setImmediate: _setImmediate,
868
- asap,
869
- isIterable
870
- };
871
-
872
- class AxiosError extends Error {
873
- static from(error, code, config, request, response, customProps) {
874
- const axiosError = new AxiosError(error.message, code || error.code, config, request, response);
875
- axiosError.cause = error;
876
- axiosError.name = error.name;
877
-
878
- // Preserve status from the original error if not already set from response
879
- if (error.status != null && axiosError.status == null) {
880
- axiosError.status = error.status;
881
- }
882
- customProps && Object.assign(axiosError, customProps);
883
- return axiosError;
884
- }
885
-
886
- /**
887
- * Create an Error with the specified message, config, error code, request and response.
888
- *
889
- * @param {string} message The error message.
890
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
891
- * @param {Object} [config] The config.
892
- * @param {Object} [request] The request.
893
- * @param {Object} [response] The response.
894
- *
895
- * @returns {Error} The created error.
896
- */
897
- constructor(message, code, config, request, response) {
898
- super(message);
899
-
900
- // Make message enumerable to maintain backward compatibility
901
- // The native Error constructor sets message as non-enumerable,
902
- // but axios < v1.13.3 had it as enumerable
903
- Object.defineProperty(this, 'message', {
904
- value: message,
905
- enumerable: true,
906
- writable: true,
907
- configurable: true
908
- });
909
- this.name = 'AxiosError';
910
- this.isAxiosError = true;
911
- code && (this.code = code);
912
- config && (this.config = config);
913
- request && (this.request = request);
914
- if (response) {
915
- this.response = response;
916
- this.status = response.status;
917
- }
918
- }
919
- toJSON() {
920
- return {
921
- // Standard
922
- message: this.message,
923
- name: this.name,
924
- // Microsoft
925
- description: this.description,
926
- number: this.number,
927
- // Mozilla
928
- fileName: this.fileName,
929
- lineNumber: this.lineNumber,
930
- columnNumber: this.columnNumber,
931
- stack: this.stack,
932
- // Axios
933
- config: utils$1.toJSONObject(this.config),
934
- code: this.code,
935
- status: this.status
936
- };
937
- }
938
- }
939
-
940
- // This can be changed to static properties as soon as the parser options in .eslint.cjs are updated.
941
- AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE';
942
- AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION';
943
- AxiosError.ECONNABORTED = 'ECONNABORTED';
944
- AxiosError.ETIMEDOUT = 'ETIMEDOUT';
945
- AxiosError.ERR_NETWORK = 'ERR_NETWORK';
946
- AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS';
947
- AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED';
948
- AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE';
949
- AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
950
- AxiosError.ERR_CANCELED = 'ERR_CANCELED';
951
- AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
952
- AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
953
-
954
- /**
955
- * Determines if the given thing is a array or js object.
956
- *
957
- * @param {string} thing - The object or array to be visited.
958
- *
959
- * @returns {boolean}
960
- */
961
- function isVisitable(thing) {
962
- return utils$1.isPlainObject(thing) || utils$1.isArray(thing);
963
- }
964
-
965
- /**
966
- * It removes the brackets from the end of a string
967
- *
968
- * @param {string} key - The key of the parameter.
969
- *
970
- * @returns {string} the key without the brackets.
971
- */
972
- function removeBrackets(key) {
973
- return utils$1.endsWith(key, '[]') ? key.slice(0, -2) : key;
974
- }
975
-
976
- /**
977
- * It takes a path, a key, and a boolean, and returns a string
978
- *
979
- * @param {string} path - The path to the current key.
980
- * @param {string} key - The key of the current object being iterated over.
981
- * @param {string} dots - If true, the key will be rendered with dots instead of brackets.
982
- *
983
- * @returns {string} The path to the current key.
984
- */
985
- function renderKey(path, key, dots) {
986
- if (!path) return key;
987
- return path.concat(key).map(function each(token, i) {
988
- // eslint-disable-next-line no-param-reassign
989
- token = removeBrackets(token);
990
- return !dots && i ? '[' + token + ']' : token;
991
- }).join(dots ? '.' : '');
992
- }
993
-
994
- /**
995
- * If the array is an array and none of its elements are visitable, then it's a flat array.
996
- *
997
- * @param {Array<any>} arr - The array to check
998
- *
999
- * @returns {boolean}
1000
- */
1001
- function isFlatArray(arr) {
1002
- return utils$1.isArray(arr) && !arr.some(isVisitable);
1003
- }
1004
- const predicates = utils$1.toFlatObject(utils$1, {}, null, function filter(prop) {
1005
- return /^is[A-Z]/.test(prop);
1006
- });
1007
-
1008
- /**
1009
- * Convert a data object to FormData
1010
- *
1011
- * @param {Object} obj
1012
- * @param {?Object} [formData]
1013
- * @param {?Object} [options]
1014
- * @param {Function} [options.visitor]
1015
- * @param {Boolean} [options.metaTokens = true]
1016
- * @param {Boolean} [options.dots = false]
1017
- * @param {?Boolean} [options.indexes = false]
1018
- *
1019
- * @returns {Object}
1020
- **/
1021
-
1022
- /**
1023
- * It converts an object into a FormData object
1024
- *
1025
- * @param {Object<any, any>} obj - The object to convert to form data.
1026
- * @param {string} formData - The FormData object to append to.
1027
- * @param {Object<string, any>} options
1028
- *
1029
- * @returns
1030
- */
1031
- function toFormData(obj, formData, options) {
1032
- if (!utils$1.isObject(obj)) {
1033
- throw new TypeError('target must be an object');
1034
- }
1035
-
1036
- // eslint-disable-next-line no-param-reassign
1037
- formData = formData || new (FormData$1 || FormData)();
1038
-
1039
- // eslint-disable-next-line no-param-reassign
1040
- options = utils$1.toFlatObject(options, {
1041
- metaTokens: true,
1042
- dots: false,
1043
- indexes: false
1044
- }, false, function defined(option, source) {
1045
- // eslint-disable-next-line no-eq-null,eqeqeq
1046
- return !utils$1.isUndefined(source[option]);
1047
- });
1048
- const metaTokens = options.metaTokens;
1049
- // eslint-disable-next-line no-use-before-define
1050
- const visitor = options.visitor || defaultVisitor;
1051
- const dots = options.dots;
1052
- const indexes = options.indexes;
1053
- const _Blob = options.Blob || typeof Blob !== 'undefined' && Blob;
1054
- const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1055
- if (!utils$1.isFunction(visitor)) {
1056
- throw new TypeError('visitor must be a function');
1057
- }
1058
- function convertValue(value) {
1059
- if (value === null) return '';
1060
- if (utils$1.isDate(value)) {
1061
- return value.toISOString();
1062
- }
1063
- if (utils$1.isBoolean(value)) {
1064
- return value.toString();
1065
- }
1066
- if (!useBlob && utils$1.isBlob(value)) {
1067
- throw new AxiosError('Blob is not supported. Use a Buffer instead.');
1068
- }
1069
- if (utils$1.isArrayBuffer(value) || utils$1.isTypedArray(value)) {
1070
- return useBlob && typeof Blob === 'function' ? new Blob([value]) : Buffer.from(value);
1071
- }
1072
- return value;
1073
- }
1074
-
1075
- /**
1076
- * Default visitor.
1077
- *
1078
- * @param {*} value
1079
- * @param {String|Number} key
1080
- * @param {Array<String|Number>} path
1081
- * @this {FormData}
1082
- *
1083
- * @returns {boolean} return true to visit the each prop of the value recursively
1084
- */
1085
- function defaultVisitor(value, key, path) {
1086
- let arr = value;
1087
- if (utils$1.isReactNative(formData) && utils$1.isReactNativeBlob(value)) {
1088
- formData.append(renderKey(path, key, dots), convertValue(value));
1089
- return false;
1090
- }
1091
- if (value && !path && typeof value === 'object') {
1092
- if (utils$1.endsWith(key, '{}')) {
1093
- // eslint-disable-next-line no-param-reassign
1094
- key = metaTokens ? key : key.slice(0, -2);
1095
- // eslint-disable-next-line no-param-reassign
1096
- value = JSON.stringify(value);
1097
- } else if (utils$1.isArray(value) && isFlatArray(value) || (utils$1.isFileList(value) || utils$1.endsWith(key, '[]')) && (arr = utils$1.toArray(value))) {
1098
- // eslint-disable-next-line no-param-reassign
1099
- key = removeBrackets(key);
1100
- arr.forEach(function each(el, index) {
1101
- !(utils$1.isUndefined(el) || el === null) && formData.append(
1102
- // eslint-disable-next-line no-nested-ternary
1103
- indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + '[]', convertValue(el));
1104
- });
1105
- return false;
1106
- }
1107
- }
1108
- if (isVisitable(value)) {
1109
- return true;
1110
- }
1111
- formData.append(renderKey(path, key, dots), convertValue(value));
1112
- return false;
1113
- }
1114
- const stack = [];
1115
- const exposedHelpers = Object.assign(predicates, {
1116
- defaultVisitor,
1117
- convertValue,
1118
- isVisitable
1119
- });
1120
- function build(value, path) {
1121
- if (utils$1.isUndefined(value)) return;
1122
- if (stack.indexOf(value) !== -1) {
1123
- throw Error('Circular reference detected in ' + path.join('.'));
1124
- }
1125
- stack.push(value);
1126
- utils$1.forEach(value, function each(el, key) {
1127
- const result = !(utils$1.isUndefined(el) || el === null) && visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
1128
- if (result === true) {
1129
- build(el, path ? path.concat(key) : [key]);
1130
- }
1131
- });
1132
- stack.pop();
1133
- }
1134
- if (!utils$1.isObject(obj)) {
1135
- throw new TypeError('data must be an object');
1136
- }
1137
- build(obj);
1138
- return formData;
1139
- }
1140
-
1141
- /**
1142
- * It encodes a string by replacing all characters that are not in the unreserved set with
1143
- * their percent-encoded equivalents
1144
- *
1145
- * @param {string} str - The string to encode.
1146
- *
1147
- * @returns {string} The encoded string.
1148
- */
1149
- function encode$1(str) {
1150
- const charMap = {
1151
- '!': '%21',
1152
- "'": '%27',
1153
- '(': '%28',
1154
- ')': '%29',
1155
- '~': '%7E',
1156
- '%20': '+',
1157
- '%00': '\x00'
1158
- };
1159
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1160
- return charMap[match];
1161
- });
1162
- }
1163
-
1164
- /**
1165
- * It takes a params object and converts it to a FormData object
1166
- *
1167
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
1168
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
1169
- *
1170
- * @returns {void}
1171
- */
1172
- function AxiosURLSearchParams(params, options) {
1173
- this._pairs = [];
1174
- params && toFormData(params, this, options);
1175
- }
1176
- const prototype = AxiosURLSearchParams.prototype;
1177
- prototype.append = function append(name, value) {
1178
- this._pairs.push([name, value]);
1179
- };
1180
- prototype.toString = function toString(encoder) {
1181
- const _encode = encoder ? function (value) {
1182
- return encoder.call(this, value, encode$1);
1183
- } : encode$1;
1184
- return this._pairs.map(function each(pair) {
1185
- return _encode(pair[0]) + '=' + _encode(pair[1]);
1186
- }, '').join('&');
1187
- };
1188
-
1189
- /**
1190
- * It replaces URL-encoded forms of `:`, `$`, `,`, and spaces with
1191
- * their plain counterparts (`:`, `$`, `,`, `+`).
1192
- *
1193
- * @param {string} val The value to be encoded.
1194
- *
1195
- * @returns {string} The encoded value.
1196
- */
1197
- function encode(val) {
1198
- return encodeURIComponent(val).replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+');
1199
- }
1200
-
1201
- /**
1202
- * Build a URL by appending params to the end
1203
- *
1204
- * @param {string} url The base of the url (e.g., http://www.google.com)
1205
- * @param {object} [params] The params to be appended
1206
- * @param {?(object|Function)} options
1207
- *
1208
- * @returns {string} The formatted url
1209
- */
1210
- function buildURL(url, params, options) {
1211
- if (!params) {
1212
- return url;
1213
- }
1214
- const _encode = options && options.encode || encode;
1215
- const _options = utils$1.isFunction(options) ? {
1216
- serialize: options
1217
- } : options;
1218
- const serializeFn = _options && _options.serialize;
1219
- let serializedParams;
1220
- if (serializeFn) {
1221
- serializedParams = serializeFn(params, _options);
1222
- } else {
1223
- serializedParams = utils$1.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams(params, _options).toString(_encode);
1224
- }
1225
- if (serializedParams) {
1226
- const hashmarkIndex = url.indexOf('#');
1227
- if (hashmarkIndex !== -1) {
1228
- url = url.slice(0, hashmarkIndex);
1229
- }
1230
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
1231
- }
1232
- return url;
1233
- }
1234
-
1235
- class InterceptorManager {
1236
- constructor() {
1237
- this.handlers = [];
1238
- }
1239
-
1240
- /**
1241
- * Add a new interceptor to the stack
1242
- *
1243
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
1244
- * @param {Function} rejected The function to handle `reject` for a `Promise`
1245
- * @param {Object} options The options for the interceptor, synchronous and runWhen
1246
- *
1247
- * @return {Number} An ID used to remove interceptor later
1248
- */
1249
- use(fulfilled, rejected, options) {
1250
- this.handlers.push({
1251
- fulfilled,
1252
- rejected,
1253
- synchronous: options ? options.synchronous : false,
1254
- runWhen: options ? options.runWhen : null
1255
- });
1256
- return this.handlers.length - 1;
1257
- }
1258
-
1259
- /**
1260
- * Remove an interceptor from the stack
1261
- *
1262
- * @param {Number} id The ID that was returned by `use`
1263
- *
1264
- * @returns {void}
1265
- */
1266
- eject(id) {
1267
- if (this.handlers[id]) {
1268
- this.handlers[id] = null;
1269
- }
1270
- }
1271
-
1272
- /**
1273
- * Clear all interceptors from the stack
1274
- *
1275
- * @returns {void}
1276
- */
1277
- clear() {
1278
- if (this.handlers) {
1279
- this.handlers = [];
1280
- }
1281
- }
1282
-
1283
- /**
1284
- * Iterate over all the registered interceptors
1285
- *
1286
- * This method is particularly useful for skipping over any
1287
- * interceptors that may have become `null` calling `eject`.
1288
- *
1289
- * @param {Function} fn The function to call for each interceptor
1290
- *
1291
- * @returns {void}
1292
- */
1293
- forEach(fn) {
1294
- utils$1.forEach(this.handlers, function forEachHandler(h) {
1295
- if (h !== null) {
1296
- fn(h);
1297
- }
1298
- });
1299
- }
1300
- }
1301
-
1302
- var transitionalDefaults = {
1303
- silentJSONParsing: true,
1304
- forcedJSONParsing: true,
1305
- clarifyTimeoutError: false,
1306
- legacyInterceptorReqResOrdering: true
1307
- };
1308
-
1309
- var URLSearchParams = url.URLSearchParams;
1310
-
1311
- const ALPHA = 'abcdefghijklmnopqrstuvwxyz';
1312
- const DIGIT = '0123456789';
1313
- const ALPHABET = {
1314
- DIGIT,
1315
- ALPHA,
1316
- ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
1317
- };
1318
- const generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
1319
- let str = '';
1320
- const {
1321
- length
1322
- } = alphabet;
1323
- const randomValues = new Uint32Array(size);
1324
- crypto.randomFillSync(randomValues);
1325
- for (let i = 0; i < size; i++) {
1326
- str += alphabet[randomValues[i] % length];
1327
- }
1328
- return str;
1329
- };
1330
- var platform$1 = {
1331
- isNode: true,
1332
- classes: {
1333
- URLSearchParams,
1334
- FormData: FormData$1,
1335
- Blob: typeof Blob !== 'undefined' && Blob || null
1336
- },
1337
- ALPHABET,
1338
- generateString,
1339
- protocols: ['http', 'https', 'file', 'data']
1340
- };
1341
-
1342
- const hasBrowserEnv = typeof window !== 'undefined' && typeof document !== 'undefined';
1343
- const _navigator = typeof navigator === 'object' && navigator || undefined;
1344
-
1345
- /**
1346
- * Determine if we're running in a standard browser environment
1347
- *
1348
- * This allows axios to run in a web worker, and react-native.
1349
- * Both environments support XMLHttpRequest, but not fully standard globals.
1350
- *
1351
- * web workers:
1352
- * typeof window -> undefined
1353
- * typeof document -> undefined
1354
- *
1355
- * react-native:
1356
- * navigator.product -> 'ReactNative'
1357
- * nativescript
1358
- * navigator.product -> 'NativeScript' or 'NS'
1359
- *
1360
- * @returns {boolean}
1361
- */
1362
- const hasStandardBrowserEnv = hasBrowserEnv && (!_navigator || ['ReactNative', 'NativeScript', 'NS'].indexOf(_navigator.product) < 0);
1363
-
1364
- /**
1365
- * Determine if we're running in a standard browser webWorker environment
1366
- *
1367
- * Although the `isStandardBrowserEnv` method indicates that
1368
- * `allows axios to run in a web worker`, the WebWorker will still be
1369
- * filtered out due to its judgment standard
1370
- * `typeof window !== 'undefined' && typeof document !== 'undefined'`.
1371
- * This leads to a problem when axios post `FormData` in webWorker
1372
- */
1373
- const hasStandardBrowserWebWorkerEnv = (() => {
1374
- return typeof WorkerGlobalScope !== 'undefined' &&
1375
- // eslint-disable-next-line no-undef
1376
- self instanceof WorkerGlobalScope && typeof self.importScripts === 'function';
1377
- })();
1378
- const origin = hasBrowserEnv && window.location.href || 'http://localhost';
1379
-
1380
- var utils = /*#__PURE__*/Object.freeze({
1381
- __proto__: null,
1382
- hasBrowserEnv: hasBrowserEnv,
1383
- hasStandardBrowserEnv: hasStandardBrowserEnv,
1384
- hasStandardBrowserWebWorkerEnv: hasStandardBrowserWebWorkerEnv,
1385
- navigator: _navigator,
1386
- origin: origin
1387
- });
1388
-
1389
- var platform = {
1390
- ...utils,
1391
- ...platform$1
1392
- };
1393
-
1394
- function toURLEncodedForm(data, options) {
1395
- return toFormData(data, new platform.classes.URLSearchParams(), {
1396
- visitor: function (value, key, path, helpers) {
1397
- if (platform.isNode && utils$1.isBuffer(value)) {
1398
- this.append(key, value.toString('base64'));
1399
- return false;
1400
- }
1401
- return helpers.defaultVisitor.apply(this, arguments);
1402
- },
1403
- ...options
1404
- });
1405
- }
1406
-
1407
- /**
1408
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
1409
- *
1410
- * @param {string} name - The name of the property to get.
1411
- *
1412
- * @returns An array of strings.
1413
- */
1414
- function parsePropPath(name) {
1415
- // foo[x][y][z]
1416
- // foo.x.y.z
1417
- // foo-x-y-z
1418
- // foo x y z
1419
- return utils$1.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
1420
- return match[0] === '[]' ? '' : match[1] || match[0];
1421
- });
1422
- }
1423
-
1424
- /**
1425
- * Convert an array to an object.
1426
- *
1427
- * @param {Array<any>} arr - The array to convert to an object.
1428
- *
1429
- * @returns An object with the same keys and values as the array.
1430
- */
1431
- function arrayToObject(arr) {
1432
- const obj = {};
1433
- const keys = Object.keys(arr);
1434
- let i;
1435
- const len = keys.length;
1436
- let key;
1437
- for (i = 0; i < len; i++) {
1438
- key = keys[i];
1439
- obj[key] = arr[key];
1440
- }
1441
- return obj;
1442
- }
1443
-
1444
- /**
1445
- * It takes a FormData object and returns a JavaScript object
1446
- *
1447
- * @param {string} formData The FormData object to convert to JSON.
1448
- *
1449
- * @returns {Object<string, any> | null} The converted object.
1450
- */
1451
- function formDataToJSON(formData) {
1452
- function buildPath(path, value, target, index) {
1453
- let name = path[index++];
1454
- if (name === '__proto__') return true;
1455
- const isNumericKey = Number.isFinite(+name);
1456
- const isLast = index >= path.length;
1457
- name = !name && utils$1.isArray(target) ? target.length : name;
1458
- if (isLast) {
1459
- if (utils$1.hasOwnProp(target, name)) {
1460
- target[name] = [target[name], value];
1461
- } else {
1462
- target[name] = value;
1463
- }
1464
- return !isNumericKey;
1465
- }
1466
- if (!target[name] || !utils$1.isObject(target[name])) {
1467
- target[name] = [];
1468
- }
1469
- const result = buildPath(path, value, target[name], index);
1470
- if (result && utils$1.isArray(target[name])) {
1471
- target[name] = arrayToObject(target[name]);
1472
- }
1473
- return !isNumericKey;
1474
- }
1475
- if (utils$1.isFormData(formData) && utils$1.isFunction(formData.entries)) {
1476
- const obj = {};
1477
- utils$1.forEachEntry(formData, (name, value) => {
1478
- buildPath(parsePropPath(name), value, obj, 0);
1479
- });
1480
- return obj;
1481
- }
1482
- return null;
1483
- }
1484
-
1485
- /**
1486
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1487
- * of the input
1488
- *
1489
- * @param {any} rawValue - The value to be stringified.
1490
- * @param {Function} parser - A function that parses a string into a JavaScript object.
1491
- * @param {Function} encoder - A function that takes a value and returns a string.
1492
- *
1493
- * @returns {string} A stringified version of the rawValue.
1494
- */
1495
- function stringifySafely(rawValue, parser, encoder) {
1496
- if (utils$1.isString(rawValue)) {
1497
- try {
1498
- (parser || JSON.parse)(rawValue);
1499
- return utils$1.trim(rawValue);
1500
- } catch (e) {
1501
- if (e.name !== 'SyntaxError') {
1502
- throw e;
1503
- }
1504
- }
1505
- }
1506
- return (encoder || JSON.stringify)(rawValue);
1507
- }
1508
- const defaults = {
1509
- transitional: transitionalDefaults,
1510
- adapter: ['xhr', 'http', 'fetch'],
1511
- transformRequest: [function transformRequest(data, headers) {
1512
- const contentType = headers.getContentType() || '';
1513
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
1514
- const isObjectPayload = utils$1.isObject(data);
1515
- if (isObjectPayload && utils$1.isHTMLForm(data)) {
1516
- data = new FormData(data);
1517
- }
1518
- const isFormData = utils$1.isFormData(data);
1519
- if (isFormData) {
1520
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
1521
- }
1522
- if (utils$1.isArrayBuffer(data) || utils$1.isBuffer(data) || utils$1.isStream(data) || utils$1.isFile(data) || utils$1.isBlob(data) || utils$1.isReadableStream(data)) {
1523
- return data;
1524
- }
1525
- if (utils$1.isArrayBufferView(data)) {
1526
- return data.buffer;
1527
- }
1528
- if (utils$1.isURLSearchParams(data)) {
1529
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
1530
- return data.toString();
1531
- }
1532
- let isFileList;
1533
- if (isObjectPayload) {
1534
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1535
- return toURLEncodedForm(data, this.formSerializer).toString();
1536
- }
1537
- if ((isFileList = utils$1.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
1538
- const _FormData = this.env && this.env.FormData;
1539
- return toFormData(isFileList ? {
1540
- 'files[]': data
1541
- } : data, _FormData && new _FormData(), this.formSerializer);
1542
- }
1543
- }
1544
- if (isObjectPayload || hasJSONContentType) {
1545
- headers.setContentType('application/json', false);
1546
- return stringifySafely(data);
1547
- }
1548
- return data;
1549
- }],
1550
- transformResponse: [function transformResponse(data) {
1551
- const transitional = this.transitional || defaults.transitional;
1552
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1553
- const JSONRequested = this.responseType === 'json';
1554
- if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
1555
- return data;
1556
- }
1557
- if (data && utils$1.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
1558
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
1559
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
1560
- try {
1561
- return JSON.parse(data, this.parseReviver);
1562
- } catch (e) {
1563
- if (strictJSONParsing) {
1564
- if (e.name === 'SyntaxError') {
1565
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
1566
- }
1567
- throw e;
1568
- }
1569
- }
1570
- }
1571
- return data;
1572
- }],
1573
- /**
1574
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
1575
- * timeout is not created.
1576
- */
1577
- timeout: 0,
1578
- xsrfCookieName: 'XSRF-TOKEN',
1579
- xsrfHeaderName: 'X-XSRF-TOKEN',
1580
- maxContentLength: -1,
1581
- maxBodyLength: -1,
1582
- env: {
1583
- FormData: platform.classes.FormData,
1584
- Blob: platform.classes.Blob
1585
- },
1586
- validateStatus: function validateStatus(status) {
1587
- return status >= 200 && status < 300;
1588
- },
1589
- headers: {
1590
- common: {
1591
- Accept: 'application/json, text/plain, */*',
1592
- 'Content-Type': undefined
1593
- }
1594
- }
1595
- };
1596
- utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], method => {
1597
- defaults.headers[method] = {};
1598
- });
1599
-
1600
- // RawAxiosHeaders whose duplicates are ignored by node
1601
- // c.f. https://nodejs.org/api/http.html#http_message_headers
1602
- const ignoreDuplicateOf = utils$1.toObjectSet(['age', 'authorization', 'content-length', 'content-type', 'etag', 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since', 'last-modified', 'location', 'max-forwards', 'proxy-authorization', 'referer', 'retry-after', 'user-agent']);
1603
-
1604
- /**
1605
- * Parse headers into an object
1606
- *
1607
- * ```
1608
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
1609
- * Content-Type: application/json
1610
- * Connection: keep-alive
1611
- * Transfer-Encoding: chunked
1612
- * ```
1613
- *
1614
- * @param {String} rawHeaders Headers needing to be parsed
1615
- *
1616
- * @returns {Object} Headers parsed into an object
1617
- */
1618
- var parseHeaders = rawHeaders => {
1619
- const parsed = {};
1620
- let key;
1621
- let val;
1622
- let i;
1623
- rawHeaders && rawHeaders.split('\n').forEach(function parser(line) {
1624
- i = line.indexOf(':');
1625
- key = line.substring(0, i).trim().toLowerCase();
1626
- val = line.substring(i + 1).trim();
1627
- if (!key || parsed[key] && ignoreDuplicateOf[key]) {
1628
- return;
1629
- }
1630
- if (key === 'set-cookie') {
1631
- if (parsed[key]) {
1632
- parsed[key].push(val);
1633
- } else {
1634
- parsed[key] = [val];
1635
- }
1636
- } else {
1637
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
1638
- }
1639
- });
1640
- return parsed;
1641
- };
1642
-
1643
- const $internals = Symbol('internals');
1644
- const isValidHeaderValue = value => !/[\r\n]/.test(value);
1645
- function assertValidHeaderValue(value, header) {
1646
- if (value === false || value == null) {
1647
- return;
1648
- }
1649
- if (utils$1.isArray(value)) {
1650
- value.forEach(v => assertValidHeaderValue(v, header));
1651
- return;
1652
- }
1653
- if (!isValidHeaderValue(String(value))) {
1654
- throw new Error(`Invalid character in header content ["${header}"]`);
1655
- }
1656
- }
1657
- function normalizeHeader(header) {
1658
- return header && String(header).trim().toLowerCase();
1659
- }
1660
- function stripTrailingCRLF(str) {
1661
- let end = str.length;
1662
- while (end > 0) {
1663
- const charCode = str.charCodeAt(end - 1);
1664
- if (charCode !== 10 && charCode !== 13) {
1665
- break;
1666
- }
1667
- end -= 1;
1668
- }
1669
- return end === str.length ? str : str.slice(0, end);
1670
- }
1671
- function normalizeValue(value) {
1672
- if (value === false || value == null) {
1673
- return value;
1674
- }
1675
- return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
1676
- }
1677
- function parseTokens(str) {
1678
- const tokens = Object.create(null);
1679
- const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
1680
- let match;
1681
- while (match = tokensRE.exec(str)) {
1682
- tokens[match[1]] = match[2];
1683
- }
1684
- return tokens;
1685
- }
1686
- const isValidHeaderName = str => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
1687
- function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
1688
- if (utils$1.isFunction(filter)) {
1689
- return filter.call(this, value, header);
1690
- }
1691
- if (isHeaderNameFilter) {
1692
- value = header;
1693
- }
1694
- if (!utils$1.isString(value)) return;
1695
- if (utils$1.isString(filter)) {
1696
- return value.indexOf(filter) !== -1;
1697
- }
1698
- if (utils$1.isRegExp(filter)) {
1699
- return filter.test(value);
1700
- }
1701
- }
1702
- function formatHeader(header) {
1703
- return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
1704
- return char.toUpperCase() + str;
1705
- });
1706
- }
1707
- function buildAccessors(obj, header) {
1708
- const accessorName = utils$1.toCamelCase(' ' + header);
1709
- ['get', 'set', 'has'].forEach(methodName => {
1710
- Object.defineProperty(obj, methodName + accessorName, {
1711
- value: function (arg1, arg2, arg3) {
1712
- return this[methodName].call(this, header, arg1, arg2, arg3);
1713
- },
1714
- configurable: true
1715
- });
1716
- });
1717
- }
1718
- class AxiosHeaders {
1719
- constructor(headers) {
1720
- headers && this.set(headers);
1721
- }
1722
- set(header, valueOrRewrite, rewrite) {
1723
- const self = this;
1724
- function setHeader(_value, _header, _rewrite) {
1725
- const lHeader = normalizeHeader(_header);
1726
- if (!lHeader) {
1727
- throw new Error('header name must be a non-empty string');
1728
- }
1729
- const key = utils$1.findKey(self, lHeader);
1730
- if (!key || self[key] === undefined || _rewrite === true || _rewrite === undefined && self[key] !== false) {
1731
- assertValidHeaderValue(_value, _header);
1732
- self[key || _header] = normalizeValue(_value);
1733
- }
1734
- }
1735
- const setHeaders = (headers, _rewrite) => utils$1.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
1736
- if (utils$1.isPlainObject(header) || header instanceof this.constructor) {
1737
- setHeaders(header, valueOrRewrite);
1738
- } else if (utils$1.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
1739
- setHeaders(parseHeaders(header), valueOrRewrite);
1740
- } else if (utils$1.isObject(header) && utils$1.isIterable(header)) {
1741
- let obj = {},
1742
- dest,
1743
- key;
1744
- for (const entry of header) {
1745
- if (!utils$1.isArray(entry)) {
1746
- throw TypeError('Object iterator must return a key-value pair');
1747
- }
1748
- obj[key = entry[0]] = (dest = obj[key]) ? utils$1.isArray(dest) ? [...dest, entry[1]] : [dest, entry[1]] : entry[1];
1749
- }
1750
- setHeaders(obj, valueOrRewrite);
1751
- } else {
1752
- header != null && setHeader(valueOrRewrite, header, rewrite);
1753
- }
1754
- return this;
1755
- }
1756
- get(header, parser) {
1757
- header = normalizeHeader(header);
1758
- if (header) {
1759
- const key = utils$1.findKey(this, header);
1760
- if (key) {
1761
- const value = this[key];
1762
- if (!parser) {
1763
- return value;
1764
- }
1765
- if (parser === true) {
1766
- return parseTokens(value);
1767
- }
1768
- if (utils$1.isFunction(parser)) {
1769
- return parser.call(this, value, key);
1770
- }
1771
- if (utils$1.isRegExp(parser)) {
1772
- return parser.exec(value);
1773
- }
1774
- throw new TypeError('parser must be boolean|regexp|function');
1775
- }
1776
- }
1777
- }
1778
- has(header, matcher) {
1779
- header = normalizeHeader(header);
1780
- if (header) {
1781
- const key = utils$1.findKey(this, header);
1782
- return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
1783
- }
1784
- return false;
1785
- }
1786
- delete(header, matcher) {
1787
- const self = this;
1788
- let deleted = false;
1789
- function deleteHeader(_header) {
1790
- _header = normalizeHeader(_header);
1791
- if (_header) {
1792
- const key = utils$1.findKey(self, _header);
1793
- if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
1794
- delete self[key];
1795
- deleted = true;
1796
- }
1797
- }
1798
- }
1799
- if (utils$1.isArray(header)) {
1800
- header.forEach(deleteHeader);
1801
- } else {
1802
- deleteHeader(header);
1803
- }
1804
- return deleted;
1805
- }
1806
- clear(matcher) {
1807
- const keys = Object.keys(this);
1808
- let i = keys.length;
1809
- let deleted = false;
1810
- while (i--) {
1811
- const key = keys[i];
1812
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
1813
- delete this[key];
1814
- deleted = true;
1815
- }
1816
- }
1817
- return deleted;
1818
- }
1819
- normalize(format) {
1820
- const self = this;
1821
- const headers = {};
1822
- utils$1.forEach(this, (value, header) => {
1823
- const key = utils$1.findKey(headers, header);
1824
- if (key) {
1825
- self[key] = normalizeValue(value);
1826
- delete self[header];
1827
- return;
1828
- }
1829
- const normalized = format ? formatHeader(header) : String(header).trim();
1830
- if (normalized !== header) {
1831
- delete self[header];
1832
- }
1833
- self[normalized] = normalizeValue(value);
1834
- headers[normalized] = true;
1835
- });
1836
- return this;
1837
- }
1838
- concat(...targets) {
1839
- return this.constructor.concat(this, ...targets);
1840
- }
1841
- toJSON(asStrings) {
1842
- const obj = Object.create(null);
1843
- utils$1.forEach(this, (value, header) => {
1844
- value != null && value !== false && (obj[header] = asStrings && utils$1.isArray(value) ? value.join(', ') : value);
1845
- });
1846
- return obj;
1847
- }
1848
- [Symbol.iterator]() {
1849
- return Object.entries(this.toJSON())[Symbol.iterator]();
1850
- }
1851
- toString() {
1852
- return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\n');
1853
- }
1854
- getSetCookie() {
1855
- return this.get('set-cookie') || [];
1856
- }
1857
- get [Symbol.toStringTag]() {
1858
- return 'AxiosHeaders';
1859
- }
1860
- static from(thing) {
1861
- return thing instanceof this ? thing : new this(thing);
1862
- }
1863
- static concat(first, ...targets) {
1864
- const computed = new this(first);
1865
- targets.forEach(target => computed.set(target));
1866
- return computed;
1867
- }
1868
- static accessor(header) {
1869
- const internals = this[$internals] = this[$internals] = {
1870
- accessors: {}
1871
- };
1872
- const accessors = internals.accessors;
1873
- const prototype = this.prototype;
1874
- function defineAccessor(_header) {
1875
- const lHeader = normalizeHeader(_header);
1876
- if (!accessors[lHeader]) {
1877
- buildAccessors(prototype, _header);
1878
- accessors[lHeader] = true;
1879
- }
1880
- }
1881
- utils$1.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
1882
- return this;
1883
- }
1884
- }
1885
- AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
1886
-
1887
- // reserved names hotfix
1888
- utils$1.reduceDescriptors(AxiosHeaders.prototype, ({
1889
- value
1890
- }, key) => {
1891
- let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
1892
- return {
1893
- get: () => value,
1894
- set(headerValue) {
1895
- this[mapped] = headerValue;
1896
- }
1897
- };
1898
- });
1899
- utils$1.freezeMethods(AxiosHeaders);
1900
-
1901
- /**
1902
- * Transform the data for a request or a response
1903
- *
1904
- * @param {Array|Function} fns A single function or Array of functions
1905
- * @param {?Object} response The response object
1906
- *
1907
- * @returns {*} The resulting transformed data
1908
- */
1909
- function transformData(fns, response) {
1910
- const config = this || defaults;
1911
- const context = response || config;
1912
- const headers = AxiosHeaders.from(context.headers);
1913
- let data = context.data;
1914
- utils$1.forEach(fns, function transform(fn) {
1915
- data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
1916
- });
1917
- headers.normalize();
1918
- return data;
1919
- }
1920
-
1921
- function isCancel(value) {
1922
- return !!(value && value.__CANCEL__);
1923
- }
1924
-
1925
- class CanceledError extends AxiosError {
1926
- /**
1927
- * A `CanceledError` is an object that is thrown when an operation is canceled.
1928
- *
1929
- * @param {string=} message The message.
1930
- * @param {Object=} config The config.
1931
- * @param {Object=} request The request.
1932
- *
1933
- * @returns {CanceledError} The created error.
1934
- */
1935
- constructor(message, config, request) {
1936
- super(message == null ? 'canceled' : message, AxiosError.ERR_CANCELED, config, request);
1937
- this.name = 'CanceledError';
1938
- this.__CANCEL__ = true;
1939
- }
1940
- }
1941
-
1942
- /**
1943
- * Resolve or reject a Promise based on response status.
1944
- *
1945
- * @param {Function} resolve A function that resolves the promise.
1946
- * @param {Function} reject A function that rejects the promise.
1947
- * @param {object} response The response.
1948
- *
1949
- * @returns {object} The response.
1950
- */
1951
- function settle(resolve, reject, response) {
1952
- const validateStatus = response.config.validateStatus;
1953
- if (!response.status || !validateStatus || validateStatus(response.status)) {
1954
- resolve(response);
1955
- } else {
1956
- reject(new AxiosError('Request failed with status code ' + response.status, [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4], response.config, response.request, response));
1957
- }
1958
- }
1959
-
1960
- /**
1961
- * Determines whether the specified URL is absolute
1962
- *
1963
- * @param {string} url The URL to test
1964
- *
1965
- * @returns {boolean} True if the specified URL is absolute, otherwise false
1966
- */
1967
- function isAbsoluteURL(url) {
1968
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
1969
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
1970
- // by any combination of letters, digits, plus, period, or hyphen.
1971
- if (typeof url !== 'string') {
1972
- return false;
1973
- }
1974
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
1975
- }
1976
-
1977
- /**
1978
- * Creates a new URL by combining the specified URLs
1979
- *
1980
- * @param {string} baseURL The base URL
1981
- * @param {string} relativeURL The relative URL
1982
- *
1983
- * @returns {string} The combined URL
1984
- */
1985
- function combineURLs(baseURL, relativeURL) {
1986
- return relativeURL ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '') : baseURL;
1987
- }
1988
-
1989
- /**
1990
- * Creates a new URL by combining the baseURL with the requestedURL,
1991
- * only when the requestedURL is not already an absolute URL.
1992
- * If the requestURL is absolute, this function returns the requestedURL untouched.
1993
- *
1994
- * @param {string} baseURL The base URL
1995
- * @param {string} requestedURL Absolute or relative URL to combine
1996
- *
1997
- * @returns {string} The combined full path
1998
- */
1999
- function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2000
- let isRelativeUrl = !isAbsoluteURL(requestedURL);
2001
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
2002
- return combineURLs(baseURL, requestedURL);
2003
- }
2004
- return requestedURL;
2005
- }
2006
-
2007
- var DEFAULT_PORTS$1 = {
2008
- ftp: 21,
2009
- gopher: 70,
2010
- http: 80,
2011
- https: 443,
2012
- ws: 80,
2013
- wss: 443
2014
- };
2015
- function parseUrl(urlString) {
2016
- try {
2017
- return new URL(urlString);
2018
- } catch {
2019
- return null;
2020
- }
2021
- }
2022
-
2023
- /**
2024
- * @param {string|object|URL} url - The URL as a string or URL instance, or a
2025
- * compatible object (such as the result from legacy url.parse).
2026
- * @return {string} The URL of the proxy that should handle the request to the
2027
- * given URL. If no proxy is set, this will be an empty string.
2028
- */
2029
- function getProxyForUrl(url) {
2030
- var parsedUrl = (typeof url === 'string' ? parseUrl(url) : url) || {};
2031
- var proto = parsedUrl.protocol;
2032
- var hostname = parsedUrl.host;
2033
- var port = parsedUrl.port;
2034
- if (typeof hostname !== 'string' || !hostname || typeof proto !== 'string') {
2035
- return ''; // Don't proxy URLs without a valid scheme or host.
2036
- }
2037
- proto = proto.split(':', 1)[0];
2038
- // Stripping ports in this way instead of using parsedUrl.hostname to make
2039
- // sure that the brackets around IPv6 addresses are kept.
2040
- hostname = hostname.replace(/:\d*$/, '');
2041
- port = parseInt(port) || DEFAULT_PORTS$1[proto] || 0;
2042
- if (!shouldProxy(hostname, port)) {
2043
- return ''; // Don't proxy URLs that match NO_PROXY.
2044
- }
2045
- var proxy = getEnv(proto + '_proxy') || getEnv('all_proxy');
2046
- if (proxy && proxy.indexOf('://') === -1) {
2047
- // Missing scheme in proxy, default to the requested URL's scheme.
2048
- proxy = proto + '://' + proxy;
2049
- }
2050
- return proxy;
2051
- }
2052
-
2053
- /**
2054
- * Determines whether a given URL should be proxied.
2055
- *
2056
- * @param {string} hostname - The host name of the URL.
2057
- * @param {number} port - The effective port of the URL.
2058
- * @returns {boolean} Whether the given URL should be proxied.
2059
- * @private
2060
- */
2061
- function shouldProxy(hostname, port) {
2062
- var NO_PROXY = getEnv('no_proxy').toLowerCase();
2063
- if (!NO_PROXY) {
2064
- return true; // Always proxy if NO_PROXY is not set.
2065
- }
2066
- if (NO_PROXY === '*') {
2067
- return false; // Never proxy if wildcard is set.
2068
- }
2069
- return NO_PROXY.split(/[,\s]/).every(function (proxy) {
2070
- if (!proxy) {
2071
- return true; // Skip zero-length hosts.
2072
- }
2073
- var parsedProxy = proxy.match(/^(.+):(\d+)$/);
2074
- var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy;
2075
- var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0;
2076
- if (parsedProxyPort && parsedProxyPort !== port) {
2077
- return true; // Skip if ports don't match.
2078
- }
2079
- if (!/^[.*]/.test(parsedProxyHostname)) {
2080
- // No wildcards, so stop proxying if there is an exact match.
2081
- return hostname !== parsedProxyHostname;
2082
- }
2083
- if (parsedProxyHostname.charAt(0) === '*') {
2084
- // Remove leading wildcard.
2085
- parsedProxyHostname = parsedProxyHostname.slice(1);
2086
- }
2087
- // Stop proxying if the hostname ends with the no_proxy host.
2088
- return !hostname.endsWith(parsedProxyHostname);
2089
- });
2090
- }
2091
-
2092
- /**
2093
- * Get the value for an environment variable.
2094
- *
2095
- * @param {string} key - The name of the environment variable.
2096
- * @return {string} The value of the environment variable.
2097
- * @private
2098
- */
2099
- function getEnv(key) {
2100
- return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || '';
2101
- }
2102
-
2103
- const VERSION = "1.15.0";
2104
-
2105
- function parseProtocol(url) {
2106
- const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
2107
- return match && match[1] || '';
2108
- }
2109
-
2110
- const DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
2111
-
2112
- /**
2113
- * Parse data uri to a Buffer or Blob
2114
- *
2115
- * @param {String} uri
2116
- * @param {?Boolean} asBlob
2117
- * @param {?Object} options
2118
- * @param {?Function} options.Blob
2119
- *
2120
- * @returns {Buffer|Blob}
2121
- */
2122
- function fromDataURI(uri, asBlob, options) {
2123
- const _Blob = options && options.Blob || platform.classes.Blob;
2124
- const protocol = parseProtocol(uri);
2125
- if (asBlob === undefined && _Blob) {
2126
- asBlob = true;
2127
- }
2128
- if (protocol === 'data') {
2129
- uri = protocol.length ? uri.slice(protocol.length + 1) : uri;
2130
- const match = DATA_URL_PATTERN.exec(uri);
2131
- if (!match) {
2132
- throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL);
2133
- }
2134
- const mime = match[1];
2135
- const isBase64 = match[2];
2136
- const body = match[3];
2137
- const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? 'base64' : 'utf8');
2138
- if (asBlob) {
2139
- if (!_Blob) {
2140
- throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);
2141
- }
2142
- return new _Blob([buffer], {
2143
- type: mime
2144
- });
2145
- }
2146
- return buffer;
2147
- }
2148
- throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
2149
- }
2150
-
2151
- const kInternals = Symbol('internals');
2152
- class AxiosTransformStream extends stream.Transform {
2153
- constructor(options) {
2154
- options = utils$1.toFlatObject(options, {
2155
- maxRate: 0,
2156
- chunkSize: 64 * 1024,
2157
- minChunkSize: 100,
2158
- timeWindow: 500,
2159
- ticksRate: 2,
2160
- samplesCount: 15
2161
- }, null, (prop, source) => {
2162
- return !utils$1.isUndefined(source[prop]);
2163
- });
2164
- super({
2165
- readableHighWaterMark: options.chunkSize
2166
- });
2167
- const internals = this[kInternals] = {
2168
- timeWindow: options.timeWindow,
2169
- chunkSize: options.chunkSize,
2170
- maxRate: options.maxRate,
2171
- minChunkSize: options.minChunkSize,
2172
- bytesSeen: 0,
2173
- isCaptured: false,
2174
- notifiedBytesLoaded: 0,
2175
- ts: Date.now(),
2176
- bytes: 0,
2177
- onReadCallback: null
2178
- };
2179
- this.on('newListener', event => {
2180
- if (event === 'progress') {
2181
- if (!internals.isCaptured) {
2182
- internals.isCaptured = true;
2183
- }
2184
- }
2185
- });
2186
- }
2187
- _read(size) {
2188
- const internals = this[kInternals];
2189
- if (internals.onReadCallback) {
2190
- internals.onReadCallback();
2191
- }
2192
- return super._read(size);
2193
- }
2194
- _transform(chunk, encoding, callback) {
2195
- const internals = this[kInternals];
2196
- const maxRate = internals.maxRate;
2197
- const readableHighWaterMark = this.readableHighWaterMark;
2198
- const timeWindow = internals.timeWindow;
2199
- const divider = 1000 / timeWindow;
2200
- const bytesThreshold = maxRate / divider;
2201
- const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
2202
- const pushChunk = (_chunk, _callback) => {
2203
- const bytes = Buffer.byteLength(_chunk);
2204
- internals.bytesSeen += bytes;
2205
- internals.bytes += bytes;
2206
- internals.isCaptured && this.emit('progress', internals.bytesSeen);
2207
- if (this.push(_chunk)) {
2208
- process.nextTick(_callback);
2209
- } else {
2210
- internals.onReadCallback = () => {
2211
- internals.onReadCallback = null;
2212
- process.nextTick(_callback);
2213
- };
2214
- }
2215
- };
2216
- const transformChunk = (_chunk, _callback) => {
2217
- const chunkSize = Buffer.byteLength(_chunk);
2218
- let chunkRemainder = null;
2219
- let maxChunkSize = readableHighWaterMark;
2220
- let bytesLeft;
2221
- let passed = 0;
2222
- if (maxRate) {
2223
- const now = Date.now();
2224
- if (!internals.ts || (passed = now - internals.ts) >= timeWindow) {
2225
- internals.ts = now;
2226
- bytesLeft = bytesThreshold - internals.bytes;
2227
- internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;
2228
- passed = 0;
2229
- }
2230
- bytesLeft = bytesThreshold - internals.bytes;
2231
- }
2232
- if (maxRate) {
2233
- if (bytesLeft <= 0) {
2234
- // next time window
2235
- return setTimeout(() => {
2236
- _callback(null, _chunk);
2237
- }, timeWindow - passed);
2238
- }
2239
- if (bytesLeft < maxChunkSize) {
2240
- maxChunkSize = bytesLeft;
2241
- }
2242
- }
2243
- if (maxChunkSize && chunkSize > maxChunkSize && chunkSize - maxChunkSize > minChunkSize) {
2244
- chunkRemainder = _chunk.subarray(maxChunkSize);
2245
- _chunk = _chunk.subarray(0, maxChunkSize);
2246
- }
2247
- pushChunk(_chunk, chunkRemainder ? () => {
2248
- process.nextTick(_callback, null, chunkRemainder);
2249
- } : _callback);
2250
- };
2251
- transformChunk(chunk, function transformNextChunk(err, _chunk) {
2252
- if (err) {
2253
- return callback(err);
2254
- }
2255
- if (_chunk) {
2256
- transformChunk(_chunk, transformNextChunk);
2257
- } else {
2258
- callback(null);
2259
- }
2260
- });
2261
- }
2262
- }
2263
-
2264
- const {
2265
- asyncIterator
2266
- } = Symbol;
2267
- const readBlob = async function* (blob) {
2268
- if (blob.stream) {
2269
- yield* blob.stream();
2270
- } else if (blob.arrayBuffer) {
2271
- yield await blob.arrayBuffer();
2272
- } else if (blob[asyncIterator]) {
2273
- yield* blob[asyncIterator]();
2274
- } else {
2275
- yield blob;
2276
- }
2277
- };
2278
-
2279
- const BOUNDARY_ALPHABET = platform.ALPHABET.ALPHA_DIGIT + '-_';
2280
- const textEncoder = typeof TextEncoder === 'function' ? new TextEncoder() : new util.TextEncoder();
2281
- const CRLF = '\r\n';
2282
- const CRLF_BYTES = textEncoder.encode(CRLF);
2283
- const CRLF_BYTES_COUNT = 2;
2284
- class FormDataPart {
2285
- constructor(name, value) {
2286
- const {
2287
- escapeName
2288
- } = this.constructor;
2289
- const isStringValue = utils$1.isString(value);
2290
- let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${!isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ''}${CRLF}`;
2291
- if (isStringValue) {
2292
- value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF));
2293
- } else {
2294
- headers += `Content-Type: ${value.type || 'application/octet-stream'}${CRLF}`;
2295
- }
2296
- this.headers = textEncoder.encode(headers + CRLF);
2297
- this.contentLength = isStringValue ? value.byteLength : value.size;
2298
- this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT;
2299
- this.name = name;
2300
- this.value = value;
2301
- }
2302
- async *encode() {
2303
- yield this.headers;
2304
- const {
2305
- value
2306
- } = this;
2307
- if (utils$1.isTypedArray(value)) {
2308
- yield value;
2309
- } else {
2310
- yield* readBlob(value);
2311
- }
2312
- yield CRLF_BYTES;
2313
- }
2314
- static escapeName(name) {
2315
- return String(name).replace(/[\r\n"]/g, match => ({
2316
- '\r': '%0D',
2317
- '\n': '%0A',
2318
- '"': '%22'
2319
- })[match]);
2320
- }
2321
- }
2322
- const formDataToStream = (form, headersHandler, options) => {
2323
- const {
2324
- tag = 'form-data-boundary',
2325
- size = 25,
2326
- boundary = tag + '-' + platform.generateString(size, BOUNDARY_ALPHABET)
2327
- } = options || {};
2328
- if (!utils$1.isFormData(form)) {
2329
- throw TypeError('FormData instance required');
2330
- }
2331
- if (boundary.length < 1 || boundary.length > 70) {
2332
- throw Error('boundary must be 10-70 characters long');
2333
- }
2334
- const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
2335
- const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF);
2336
- let contentLength = footerBytes.byteLength;
2337
- const parts = Array.from(form.entries()).map(([name, value]) => {
2338
- const part = new FormDataPart(name, value);
2339
- contentLength += part.size;
2340
- return part;
2341
- });
2342
- contentLength += boundaryBytes.byteLength * parts.length;
2343
- contentLength = utils$1.toFiniteNumber(contentLength);
2344
- const computedHeaders = {
2345
- 'Content-Type': `multipart/form-data; boundary=${boundary}`
2346
- };
2347
- if (Number.isFinite(contentLength)) {
2348
- computedHeaders['Content-Length'] = contentLength;
2349
- }
2350
- headersHandler && headersHandler(computedHeaders);
2351
- return stream.Readable.from(async function* () {
2352
- for (const part of parts) {
2353
- yield boundaryBytes;
2354
- yield* part.encode();
2355
- }
2356
- yield footerBytes;
2357
- }());
2358
- };
2359
-
2360
- class ZlibHeaderTransformStream extends stream.Transform {
2361
- __transform(chunk, encoding, callback) {
2362
- this.push(chunk);
2363
- callback();
2364
- }
2365
- _transform(chunk, encoding, callback) {
2366
- if (chunk.length !== 0) {
2367
- this._transform = this.__transform;
2368
-
2369
- // Add Default Compression headers if no zlib headers are present
2370
- if (chunk[0] !== 120) {
2371
- // Hex: 78
2372
- const header = Buffer.alloc(2);
2373
- header[0] = 120; // Hex: 78
2374
- header[1] = 156; // Hex: 9C
2375
- this.push(header, encoding);
2376
- }
2377
- }
2378
- this.__transform(chunk, encoding, callback);
2379
- }
2380
- }
2381
-
2382
- const callbackify = (fn, reducer) => {
2383
- return utils$1.isAsyncFn(fn) ? function (...args) {
2384
- const cb = args.pop();
2385
- fn.apply(this, args).then(value => {
2386
- try {
2387
- reducer ? cb(null, ...reducer(value)) : cb(null, value);
2388
- } catch (err) {
2389
- cb(err);
2390
- }
2391
- }, cb);
2392
- } : fn;
2393
- };
2394
-
2395
- const DEFAULT_PORTS = {
2396
- http: 80,
2397
- https: 443,
2398
- ws: 80,
2399
- wss: 443,
2400
- ftp: 21
2401
- };
2402
- const parseNoProxyEntry = entry => {
2403
- let entryHost = entry;
2404
- let entryPort = 0;
2405
- if (entryHost.charAt(0) === '[') {
2406
- const bracketIndex = entryHost.indexOf(']');
2407
- if (bracketIndex !== -1) {
2408
- const host = entryHost.slice(1, bracketIndex);
2409
- const rest = entryHost.slice(bracketIndex + 1);
2410
- if (rest.charAt(0) === ':' && /^\d+$/.test(rest.slice(1))) {
2411
- entryPort = Number.parseInt(rest.slice(1), 10);
2412
- }
2413
- return [host, entryPort];
2414
- }
2415
- }
2416
- const firstColon = entryHost.indexOf(':');
2417
- const lastColon = entryHost.lastIndexOf(':');
2418
- if (firstColon !== -1 && firstColon === lastColon && /^\d+$/.test(entryHost.slice(lastColon + 1))) {
2419
- entryPort = Number.parseInt(entryHost.slice(lastColon + 1), 10);
2420
- entryHost = entryHost.slice(0, lastColon);
2421
- }
2422
- return [entryHost, entryPort];
2423
- };
2424
- const normalizeNoProxyHost = hostname => {
2425
- if (!hostname) {
2426
- return hostname;
2427
- }
2428
- if (hostname.charAt(0) === '[' && hostname.charAt(hostname.length - 1) === ']') {
2429
- hostname = hostname.slice(1, -1);
2430
- }
2431
- return hostname.replace(/\.+$/, '');
2432
- };
2433
- function shouldBypassProxy(location) {
2434
- let parsed;
2435
- try {
2436
- parsed = new URL(location);
2437
- } catch (_err) {
2438
- return false;
2439
- }
2440
- const noProxy = (process.env.no_proxy || process.env.NO_PROXY || '').toLowerCase();
2441
- if (!noProxy) {
2442
- return false;
2443
- }
2444
- if (noProxy === '*') {
2445
- return true;
2446
- }
2447
- const port = Number.parseInt(parsed.port, 10) || DEFAULT_PORTS[parsed.protocol.split(':', 1)[0]] || 0;
2448
- const hostname = normalizeNoProxyHost(parsed.hostname.toLowerCase());
2449
- return noProxy.split(/[\s,]+/).some(entry => {
2450
- if (!entry) {
2451
- return false;
2452
- }
2453
- let [entryHost, entryPort] = parseNoProxyEntry(entry);
2454
- entryHost = normalizeNoProxyHost(entryHost);
2455
- if (!entryHost) {
2456
- return false;
2457
- }
2458
- if (entryPort && entryPort !== port) {
2459
- return false;
2460
- }
2461
- if (entryHost.charAt(0) === '*') {
2462
- entryHost = entryHost.slice(1);
2463
- }
2464
- if (entryHost.charAt(0) === '.') {
2465
- return hostname.endsWith(entryHost);
2466
- }
2467
- return hostname === entryHost;
2468
- });
2469
- }
2470
-
2471
- /**
2472
- * Calculate data maxRate
2473
- * @param {Number} [samplesCount= 10]
2474
- * @param {Number} [min= 1000]
2475
- * @returns {Function}
2476
- */
2477
- function speedometer(samplesCount, min) {
2478
- samplesCount = samplesCount || 10;
2479
- const bytes = new Array(samplesCount);
2480
- const timestamps = new Array(samplesCount);
2481
- let head = 0;
2482
- let tail = 0;
2483
- let firstSampleTS;
2484
- min = min !== undefined ? min : 1000;
2485
- return function push(chunkLength) {
2486
- const now = Date.now();
2487
- const startedAt = timestamps[tail];
2488
- if (!firstSampleTS) {
2489
- firstSampleTS = now;
2490
- }
2491
- bytes[head] = chunkLength;
2492
- timestamps[head] = now;
2493
- let i = tail;
2494
- let bytesCount = 0;
2495
- while (i !== head) {
2496
- bytesCount += bytes[i++];
2497
- i = i % samplesCount;
2498
- }
2499
- head = (head + 1) % samplesCount;
2500
- if (head === tail) {
2501
- tail = (tail + 1) % samplesCount;
2502
- }
2503
- if (now - firstSampleTS < min) {
2504
- return;
2505
- }
2506
- const passed = startedAt && now - startedAt;
2507
- return passed ? Math.round(bytesCount * 1000 / passed) : undefined;
2508
- };
2509
- }
2510
-
2511
- /**
2512
- * Throttle decorator
2513
- * @param {Function} fn
2514
- * @param {Number} freq
2515
- * @return {Function}
2516
- */
2517
- function throttle(fn, freq) {
2518
- let timestamp = 0;
2519
- let threshold = 1000 / freq;
2520
- let lastArgs;
2521
- let timer;
2522
- const invoke = (args, now = Date.now()) => {
2523
- timestamp = now;
2524
- lastArgs = null;
2525
- if (timer) {
2526
- clearTimeout(timer);
2527
- timer = null;
2528
- }
2529
- fn(...args);
2530
- };
2531
- const throttled = (...args) => {
2532
- const now = Date.now();
2533
- const passed = now - timestamp;
2534
- if (passed >= threshold) {
2535
- invoke(args, now);
2536
- } else {
2537
- lastArgs = args;
2538
- if (!timer) {
2539
- timer = setTimeout(() => {
2540
- timer = null;
2541
- invoke(lastArgs);
2542
- }, threshold - passed);
2543
- }
2544
- }
2545
- };
2546
- const flush = () => lastArgs && invoke(lastArgs);
2547
- return [throttled, flush];
2548
- }
2549
-
2550
- const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2551
- let bytesNotified = 0;
2552
- const _speedometer = speedometer(50, 250);
2553
- return throttle(e => {
2554
- const loaded = e.loaded;
2555
- const total = e.lengthComputable ? e.total : undefined;
2556
- const progressBytes = loaded - bytesNotified;
2557
- const rate = _speedometer(progressBytes);
2558
- const inRange = loaded <= total;
2559
- bytesNotified = loaded;
2560
- const data = {
2561
- loaded,
2562
- total,
2563
- progress: total ? loaded / total : undefined,
2564
- bytes: progressBytes,
2565
- rate: rate ? rate : undefined,
2566
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2567
- event: e,
2568
- lengthComputable: total != null,
2569
- [isDownloadStream ? 'download' : 'upload']: true
2570
- };
2571
- listener(data);
2572
- }, freq);
2573
- };
2574
- const progressEventDecorator = (total, throttled) => {
2575
- const lengthComputable = total != null;
2576
- return [loaded => throttled[0]({
2577
- lengthComputable,
2578
- total,
2579
- loaded
2580
- }), throttled[1]];
2581
- };
2582
- const asyncDecorator = fn => (...args) => utils$1.asap(() => fn(...args));
2583
-
2584
- /**
2585
- * Estimate decoded byte length of a data:// URL *without* allocating large buffers.
2586
- * - For base64: compute exact decoded size using length and padding;
2587
- * handle %XX at the character-count level (no string allocation).
2588
- * - For non-base64: use UTF-8 byteLength of the encoded body as a safe upper bound.
2589
- *
2590
- * @param {string} url
2591
- * @returns {number}
2592
- */
2593
- function estimateDataURLDecodedBytes(url) {
2594
- if (!url || typeof url !== 'string') return 0;
2595
- if (!url.startsWith('data:')) return 0;
2596
- const comma = url.indexOf(',');
2597
- if (comma < 0) return 0;
2598
- const meta = url.slice(5, comma);
2599
- const body = url.slice(comma + 1);
2600
- const isBase64 = /;base64/i.test(meta);
2601
- if (isBase64) {
2602
- let effectiveLen = body.length;
2603
- const len = body.length; // cache length
2604
-
2605
- for (let i = 0; i < len; i++) {
2606
- if (body.charCodeAt(i) === 37 /* '%' */ && i + 2 < len) {
2607
- const a = body.charCodeAt(i + 1);
2608
- const b = body.charCodeAt(i + 2);
2609
- const isHex = (a >= 48 && a <= 57 || a >= 65 && a <= 70 || a >= 97 && a <= 102) && (b >= 48 && b <= 57 || b >= 65 && b <= 70 || b >= 97 && b <= 102);
2610
- if (isHex) {
2611
- effectiveLen -= 2;
2612
- i += 2;
2613
- }
2614
- }
2615
- }
2616
- let pad = 0;
2617
- let idx = len - 1;
2618
- const tailIsPct3D = j => j >= 2 && body.charCodeAt(j - 2) === 37 &&
2619
- // '%'
2620
- body.charCodeAt(j - 1) === 51 && (
2621
- // '3'
2622
- body.charCodeAt(j) === 68 || body.charCodeAt(j) === 100); // 'D' or 'd'
2623
-
2624
- if (idx >= 0) {
2625
- if (body.charCodeAt(idx) === 61 /* '=' */) {
2626
- pad++;
2627
- idx--;
2628
- } else if (tailIsPct3D(idx)) {
2629
- pad++;
2630
- idx -= 3;
2631
- }
2632
- }
2633
- if (pad === 1 && idx >= 0) {
2634
- if (body.charCodeAt(idx) === 61 /* '=' */) {
2635
- pad++;
2636
- } else if (tailIsPct3D(idx)) {
2637
- pad++;
2638
- }
2639
- }
2640
- const groups = Math.floor(effectiveLen / 4);
2641
- const bytes = groups * 3 - (pad || 0);
2642
- return bytes > 0 ? bytes : 0;
2643
- }
2644
- return Buffer.byteLength(body, 'utf8');
2645
- }
2646
-
2647
- const zlibOptions = {
2648
- flush: zlib.constants.Z_SYNC_FLUSH,
2649
- finishFlush: zlib.constants.Z_SYNC_FLUSH
2650
- };
2651
- const brotliOptions = {
2652
- flush: zlib.constants.BROTLI_OPERATION_FLUSH,
2653
- finishFlush: zlib.constants.BROTLI_OPERATION_FLUSH
2654
- };
2655
- const isBrotliSupported = utils$1.isFunction(zlib.createBrotliDecompress);
2656
- const {
2657
- http: httpFollow,
2658
- https: httpsFollow
2659
- } = followRedirects;
2660
- const isHttps = /https:?/;
2661
- const supportedProtocols = platform.protocols.map(protocol => {
2662
- return protocol + ':';
2663
- });
2664
- const flushOnFinish = (stream, [throttled, flush]) => {
2665
- stream.on('end', flush).on('error', flush);
2666
- return throttled;
2667
- };
2668
- class Http2Sessions {
2669
- constructor() {
2670
- this.sessions = Object.create(null);
2671
- }
2672
- getSession(authority, options) {
2673
- options = Object.assign({
2674
- sessionTimeout: 1000
2675
- }, options);
2676
- let authoritySessions = this.sessions[authority];
2677
- if (authoritySessions) {
2678
- let len = authoritySessions.length;
2679
- for (let i = 0; i < len; i++) {
2680
- const [sessionHandle, sessionOptions] = authoritySessions[i];
2681
- if (!sessionHandle.destroyed && !sessionHandle.closed && util.isDeepStrictEqual(sessionOptions, options)) {
2682
- return sessionHandle;
2683
- }
2684
- }
2685
- }
2686
- const session = http2.connect(authority, options);
2687
- let removed;
2688
- const removeSession = () => {
2689
- if (removed) {
2690
- return;
2691
- }
2692
- removed = true;
2693
- let entries = authoritySessions,
2694
- len = entries.length,
2695
- i = len;
2696
- while (i--) {
2697
- if (entries[i][0] === session) {
2698
- if (len === 1) {
2699
- delete this.sessions[authority];
2700
- } else {
2701
- entries.splice(i, 1);
2702
- }
2703
- if (!session.closed) {
2704
- session.close();
2705
- }
2706
- return;
2707
- }
2708
- }
2709
- };
2710
- const originalRequestFn = session.request;
2711
- const {
2712
- sessionTimeout
2713
- } = options;
2714
- if (sessionTimeout != null) {
2715
- let timer;
2716
- let streamsCount = 0;
2717
- session.request = function () {
2718
- const stream = originalRequestFn.apply(this, arguments);
2719
- streamsCount++;
2720
- if (timer) {
2721
- clearTimeout(timer);
2722
- timer = null;
2723
- }
2724
- stream.once('close', () => {
2725
- if (! --streamsCount) {
2726
- timer = setTimeout(() => {
2727
- timer = null;
2728
- removeSession();
2729
- }, sessionTimeout);
2730
- }
2731
- });
2732
- return stream;
2733
- };
2734
- }
2735
- session.once('close', removeSession);
2736
- let entry = [session, options];
2737
- authoritySessions ? authoritySessions.push(entry) : authoritySessions = this.sessions[authority] = [entry];
2738
- return session;
2739
- }
2740
- }
2741
- const http2Sessions = new Http2Sessions();
2742
-
2743
- /**
2744
- * If the proxy or config beforeRedirects functions are defined, call them with the options
2745
- * object.
2746
- *
2747
- * @param {Object<string, any>} options - The options object that was passed to the request.
2748
- *
2749
- * @returns {Object<string, any>}
2750
- */
2751
- function dispatchBeforeRedirect(options, responseDetails) {
2752
- if (options.beforeRedirects.proxy) {
2753
- options.beforeRedirects.proxy(options);
2754
- }
2755
- if (options.beforeRedirects.config) {
2756
- options.beforeRedirects.config(options, responseDetails);
2757
- }
2758
- }
2759
-
2760
- /**
2761
- * If the proxy or config afterRedirects functions are defined, call them with the options
2762
- *
2763
- * @param {http.ClientRequestArgs} options
2764
- * @param {AxiosProxyConfig} configProxy configuration from Axios options object
2765
- * @param {string} location
2766
- *
2767
- * @returns {http.ClientRequestArgs}
2768
- */
2769
- function setProxy(options, configProxy, location) {
2770
- let proxy = configProxy;
2771
- if (!proxy && proxy !== false) {
2772
- const proxyUrl = getProxyForUrl(location);
2773
- if (proxyUrl) {
2774
- if (!shouldBypassProxy(location)) {
2775
- proxy = new URL(proxyUrl);
2776
- }
2777
- }
2778
- }
2779
- if (proxy) {
2780
- // Basic proxy authorization
2781
- if (proxy.username) {
2782
- proxy.auth = (proxy.username || '') + ':' + (proxy.password || '');
2783
- }
2784
- if (proxy.auth) {
2785
- // Support proxy auth object form
2786
- const validProxyAuth = Boolean(proxy.auth.username || proxy.auth.password);
2787
- if (validProxyAuth) {
2788
- proxy.auth = (proxy.auth.username || '') + ':' + (proxy.auth.password || '');
2789
- } else if (typeof proxy.auth === 'object') {
2790
- throw new AxiosError('Invalid proxy authorization', AxiosError.ERR_BAD_OPTION, {
2791
- proxy
2792
- });
2793
- }
2794
- const base64 = Buffer.from(proxy.auth, 'utf8').toString('base64');
2795
- options.headers['Proxy-Authorization'] = 'Basic ' + base64;
2796
- }
2797
- options.headers.host = options.hostname + (options.port ? ':' + options.port : '');
2798
- const proxyHost = proxy.hostname || proxy.host;
2799
- options.hostname = proxyHost;
2800
- // Replace 'host' since options is not a URL object
2801
- options.host = proxyHost;
2802
- options.port = proxy.port;
2803
- options.path = location;
2804
- if (proxy.protocol) {
2805
- options.protocol = proxy.protocol.includes(':') ? proxy.protocol : `${proxy.protocol}:`;
2806
- }
2807
- }
2808
- options.beforeRedirects.proxy = function beforeRedirect(redirectOptions) {
2809
- // Configure proxy for redirected request, passing the original config proxy to apply
2810
- // the exact same logic as if the redirected request was performed by axios directly.
2811
- setProxy(redirectOptions, configProxy, redirectOptions.href);
2812
- };
2813
- }
2814
- const isHttpAdapterSupported = typeof process !== 'undefined' && utils$1.kindOf(process) === 'process';
2815
-
2816
- // temporary hotfix
2817
-
2818
- const wrapAsync = asyncExecutor => {
2819
- return new Promise((resolve, reject) => {
2820
- let onDone;
2821
- let isDone;
2822
- const done = (value, isRejected) => {
2823
- if (isDone) return;
2824
- isDone = true;
2825
- onDone && onDone(value, isRejected);
2826
- };
2827
- const _resolve = value => {
2828
- done(value);
2829
- resolve(value);
2830
- };
2831
- const _reject = reason => {
2832
- done(reason, true);
2833
- reject(reason);
2834
- };
2835
- asyncExecutor(_resolve, _reject, onDoneHandler => onDone = onDoneHandler).catch(_reject);
2836
- });
2837
- };
2838
- const resolveFamily = ({
2839
- address,
2840
- family
2841
- }) => {
2842
- if (!utils$1.isString(address)) {
2843
- throw TypeError('address must be a string');
2844
- }
2845
- return {
2846
- address,
2847
- family: family || (address.indexOf('.') < 0 ? 6 : 4)
2848
- };
2849
- };
2850
- const buildAddressEntry = (address, family) => resolveFamily(utils$1.isObject(address) ? address : {
2851
- address,
2852
- family
2853
- });
2854
- const http2Transport = {
2855
- request(options, cb) {
2856
- const authority = options.protocol + '//' + options.hostname + ':' + (options.port || (options.protocol === 'https:' ? 443 : 80));
2857
- const {
2858
- http2Options,
2859
- headers
2860
- } = options;
2861
- const session = http2Sessions.getSession(authority, http2Options);
2862
- const {
2863
- HTTP2_HEADER_SCHEME,
2864
- HTTP2_HEADER_METHOD,
2865
- HTTP2_HEADER_PATH,
2866
- HTTP2_HEADER_STATUS
2867
- } = http2.constants;
2868
- const http2Headers = {
2869
- [HTTP2_HEADER_SCHEME]: options.protocol.replace(':', ''),
2870
- [HTTP2_HEADER_METHOD]: options.method,
2871
- [HTTP2_HEADER_PATH]: options.path
2872
- };
2873
- utils$1.forEach(headers, (header, name) => {
2874
- name.charAt(0) !== ':' && (http2Headers[name] = header);
2875
- });
2876
- const req = session.request(http2Headers);
2877
- req.once('response', responseHeaders => {
2878
- const response = req; //duplex
2879
-
2880
- responseHeaders = Object.assign({}, responseHeaders);
2881
- const status = responseHeaders[HTTP2_HEADER_STATUS];
2882
- delete responseHeaders[HTTP2_HEADER_STATUS];
2883
- response.headers = responseHeaders;
2884
- response.statusCode = +status;
2885
- cb(response);
2886
- });
2887
- return req;
2888
- }
2889
- };
2890
-
2891
- /*eslint consistent-return:0*/
2892
- var httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
2893
- return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
2894
- let {
2895
- data,
2896
- lookup,
2897
- family,
2898
- httpVersion = 1,
2899
- http2Options
2900
- } = config;
2901
- const {
2902
- responseType,
2903
- responseEncoding
2904
- } = config;
2905
- const method = config.method.toUpperCase();
2906
- let isDone;
2907
- let rejected = false;
2908
- let req;
2909
- httpVersion = +httpVersion;
2910
- if (Number.isNaN(httpVersion)) {
2911
- throw TypeError(`Invalid protocol version: '${config.httpVersion}' is not a number`);
2912
- }
2913
- if (httpVersion !== 1 && httpVersion !== 2) {
2914
- throw TypeError(`Unsupported protocol version '${httpVersion}'`);
2915
- }
2916
- const isHttp2 = httpVersion === 2;
2917
- if (lookup) {
2918
- const _lookup = callbackify(lookup, value => utils$1.isArray(value) ? value : [value]);
2919
- // hotfix to support opt.all option which is required for node 20.x
2920
- lookup = (hostname, opt, cb) => {
2921
- _lookup(hostname, opt, (err, arg0, arg1) => {
2922
- if (err) {
2923
- return cb(err);
2924
- }
2925
- const addresses = utils$1.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
2926
- opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
2927
- });
2928
- };
2929
- }
2930
- const abortEmitter = new events.EventEmitter();
2931
- function abort(reason) {
2932
- try {
2933
- abortEmitter.emit('abort', !reason || reason.type ? new CanceledError(null, config, req) : reason);
2934
- } catch (err) {
2935
- console.warn('emit error', err);
2936
- }
2937
- }
2938
- abortEmitter.once('abort', reject);
2939
- const onFinished = () => {
2940
- if (config.cancelToken) {
2941
- config.cancelToken.unsubscribe(abort);
2942
- }
2943
- if (config.signal) {
2944
- config.signal.removeEventListener('abort', abort);
2945
- }
2946
- abortEmitter.removeAllListeners();
2947
- };
2948
- if (config.cancelToken || config.signal) {
2949
- config.cancelToken && config.cancelToken.subscribe(abort);
2950
- if (config.signal) {
2951
- config.signal.aborted ? abort() : config.signal.addEventListener('abort', abort);
2952
- }
2953
- }
2954
- onDone((response, isRejected) => {
2955
- isDone = true;
2956
- if (isRejected) {
2957
- rejected = true;
2958
- onFinished();
2959
- return;
2960
- }
2961
- const {
2962
- data
2963
- } = response;
2964
- if (data instanceof stream.Readable || data instanceof stream.Duplex) {
2965
- const offListeners = stream.finished(data, () => {
2966
- offListeners();
2967
- onFinished();
2968
- });
2969
- } else {
2970
- onFinished();
2971
- }
2972
- });
2973
-
2974
- // Parse url
2975
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
2976
- const parsed = new URL(fullPath, platform.hasBrowserEnv ? platform.origin : undefined);
2977
- const protocol = parsed.protocol || supportedProtocols[0];
2978
- if (protocol === 'data:') {
2979
- // Apply the same semantics as HTTP: only enforce if a finite, non-negative cap is set.
2980
- if (config.maxContentLength > -1) {
2981
- // Use the exact string passed to fromDataURI (config.url); fall back to fullPath if needed.
2982
- const dataUrl = String(config.url || fullPath || '');
2983
- const estimated = estimateDataURLDecodedBytes(dataUrl);
2984
- if (estimated > config.maxContentLength) {
2985
- return reject(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config));
2986
- }
2987
- }
2988
- let convertedData;
2989
- if (method !== 'GET') {
2990
- return settle(resolve, reject, {
2991
- status: 405,
2992
- statusText: 'method not allowed',
2993
- headers: {},
2994
- config
2995
- });
2996
- }
2997
- try {
2998
- convertedData = fromDataURI(config.url, responseType === 'blob', {
2999
- Blob: config.env && config.env.Blob
3000
- });
3001
- } catch (err) {
3002
- throw AxiosError.from(err, AxiosError.ERR_BAD_REQUEST, config);
3003
- }
3004
- if (responseType === 'text') {
3005
- convertedData = convertedData.toString(responseEncoding);
3006
- if (!responseEncoding || responseEncoding === 'utf8') {
3007
- convertedData = utils$1.stripBOM(convertedData);
3008
- }
3009
- } else if (responseType === 'stream') {
3010
- convertedData = stream.Readable.from(convertedData);
3011
- }
3012
- return settle(resolve, reject, {
3013
- data: convertedData,
3014
- status: 200,
3015
- statusText: 'OK',
3016
- headers: new AxiosHeaders(),
3017
- config
3018
- });
3019
- }
3020
- if (supportedProtocols.indexOf(protocol) === -1) {
3021
- return reject(new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_BAD_REQUEST, config));
3022
- }
3023
- const headers = AxiosHeaders.from(config.headers).normalize();
3024
-
3025
- // Set User-Agent (required by some servers)
3026
- // See https://github.com/axios/axios/issues/69
3027
- // User-Agent is specified; handle case where no UA header is desired
3028
- // Only set header if it hasn't been set in config
3029
- headers.set('User-Agent', 'axios/' + VERSION, false);
3030
- const {
3031
- onUploadProgress,
3032
- onDownloadProgress
3033
- } = config;
3034
- const maxRate = config.maxRate;
3035
- let maxUploadRate = undefined;
3036
- let maxDownloadRate = undefined;
3037
-
3038
- // support for spec compliant FormData objects
3039
- if (utils$1.isSpecCompliantForm(data)) {
3040
- const userBoundary = headers.getContentType(/boundary=([-_\w\d]{10,70})/i);
3041
- data = formDataToStream(data, formHeaders => {
3042
- headers.set(formHeaders);
3043
- }, {
3044
- tag: `axios-${VERSION}-boundary`,
3045
- boundary: userBoundary && userBoundary[1] || undefined
3046
- });
3047
- // support for https://www.npmjs.com/package/form-data api
3048
- } else if (utils$1.isFormData(data) && utils$1.isFunction(data.getHeaders)) {
3049
- headers.set(data.getHeaders());
3050
- if (!headers.hasContentLength()) {
3051
- try {
3052
- const knownLength = await util.promisify(data.getLength).call(data);
3053
- Number.isFinite(knownLength) && knownLength >= 0 && headers.setContentLength(knownLength);
3054
- /*eslint no-empty:0*/
3055
- } catch (e) {}
3056
- }
3057
- } else if (utils$1.isBlob(data) || utils$1.isFile(data)) {
3058
- data.size && headers.setContentType(data.type || 'application/octet-stream');
3059
- headers.setContentLength(data.size || 0);
3060
- data = stream.Readable.from(readBlob(data));
3061
- } else if (data && !utils$1.isStream(data)) {
3062
- if (Buffer.isBuffer(data)) ; else if (utils$1.isArrayBuffer(data)) {
3063
- data = Buffer.from(new Uint8Array(data));
3064
- } else if (utils$1.isString(data)) {
3065
- data = Buffer.from(data, 'utf-8');
3066
- } else {
3067
- return reject(new AxiosError('Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream', AxiosError.ERR_BAD_REQUEST, config));
3068
- }
3069
-
3070
- // Add Content-Length header if data exists
3071
- headers.setContentLength(data.length, false);
3072
- if (config.maxBodyLength > -1 && data.length > config.maxBodyLength) {
3073
- return reject(new AxiosError('Request body larger than maxBodyLength limit', AxiosError.ERR_BAD_REQUEST, config));
3074
- }
3075
- }
3076
- const contentLength = utils$1.toFiniteNumber(headers.getContentLength());
3077
- if (utils$1.isArray(maxRate)) {
3078
- maxUploadRate = maxRate[0];
3079
- maxDownloadRate = maxRate[1];
3080
- } else {
3081
- maxUploadRate = maxDownloadRate = maxRate;
3082
- }
3083
- if (data && (onUploadProgress || maxUploadRate)) {
3084
- if (!utils$1.isStream(data)) {
3085
- data = stream.Readable.from(data, {
3086
- objectMode: false
3087
- });
3088
- }
3089
- data = stream.pipeline([data, new AxiosTransformStream({
3090
- maxRate: utils$1.toFiniteNumber(maxUploadRate)
3091
- })], utils$1.noop);
3092
- onUploadProgress && data.on('progress', flushOnFinish(data, progressEventDecorator(contentLength, progressEventReducer(asyncDecorator(onUploadProgress), false, 3))));
3093
- }
3094
-
3095
- // HTTP basic authentication
3096
- let auth = undefined;
3097
- if (config.auth) {
3098
- const username = config.auth.username || '';
3099
- const password = config.auth.password || '';
3100
- auth = username + ':' + password;
3101
- }
3102
- if (!auth && parsed.username) {
3103
- const urlUsername = parsed.username;
3104
- const urlPassword = parsed.password;
3105
- auth = urlUsername + ':' + urlPassword;
3106
- }
3107
- auth && headers.delete('authorization');
3108
- let path;
3109
- try {
3110
- path = buildURL(parsed.pathname + parsed.search, config.params, config.paramsSerializer).replace(/^\?/, '');
3111
- } catch (err) {
3112
- const customErr = new Error(err.message);
3113
- customErr.config = config;
3114
- customErr.url = config.url;
3115
- customErr.exists = true;
3116
- return reject(customErr);
3117
- }
3118
- headers.set('Accept-Encoding', 'gzip, compress, deflate' + (isBrotliSupported ? ', br' : ''), false);
3119
- const options = {
3120
- path,
3121
- method: method,
3122
- headers: headers.toJSON(),
3123
- agents: {
3124
- http: config.httpAgent,
3125
- https: config.httpsAgent
3126
- },
3127
- auth,
3128
- protocol,
3129
- family,
3130
- beforeRedirect: dispatchBeforeRedirect,
3131
- beforeRedirects: {},
3132
- http2Options
3133
- };
3134
-
3135
- // cacheable-lookup integration hotfix
3136
- !utils$1.isUndefined(lookup) && (options.lookup = lookup);
3137
- if (config.socketPath) {
3138
- options.socketPath = config.socketPath;
3139
- } else {
3140
- options.hostname = parsed.hostname.startsWith('[') ? parsed.hostname.slice(1, -1) : parsed.hostname;
3141
- options.port = parsed.port;
3142
- setProxy(options, config.proxy, protocol + '//' + parsed.hostname + (parsed.port ? ':' + parsed.port : '') + options.path);
3143
- }
3144
- let transport;
3145
- const isHttpsRequest = isHttps.test(options.protocol);
3146
- options.agent = isHttpsRequest ? config.httpsAgent : config.httpAgent;
3147
- if (isHttp2) {
3148
- transport = http2Transport;
3149
- } else {
3150
- if (config.transport) {
3151
- transport = config.transport;
3152
- } else if (config.maxRedirects === 0) {
3153
- transport = isHttpsRequest ? https : http;
3154
- } else {
3155
- if (config.maxRedirects) {
3156
- options.maxRedirects = config.maxRedirects;
3157
- }
3158
- if (config.beforeRedirect) {
3159
- options.beforeRedirects.config = config.beforeRedirect;
3160
- }
3161
- transport = isHttpsRequest ? httpsFollow : httpFollow;
3162
- }
3163
- }
3164
- if (config.maxBodyLength > -1) {
3165
- options.maxBodyLength = config.maxBodyLength;
3166
- } else {
3167
- // follow-redirects does not skip comparison, so it should always succeed for axios -1 unlimited
3168
- options.maxBodyLength = Infinity;
3169
- }
3170
- if (config.insecureHTTPParser) {
3171
- options.insecureHTTPParser = config.insecureHTTPParser;
3172
- }
3173
-
3174
- // Create the request
3175
- req = transport.request(options, function handleResponse(res) {
3176
- if (req.destroyed) return;
3177
- const streams = [res];
3178
- const responseLength = utils$1.toFiniteNumber(res.headers['content-length']);
3179
- if (onDownloadProgress || maxDownloadRate) {
3180
- const transformStream = new AxiosTransformStream({
3181
- maxRate: utils$1.toFiniteNumber(maxDownloadRate)
3182
- });
3183
- onDownloadProgress && transformStream.on('progress', flushOnFinish(transformStream, progressEventDecorator(responseLength, progressEventReducer(asyncDecorator(onDownloadProgress), true, 3))));
3184
- streams.push(transformStream);
3185
- }
3186
-
3187
- // decompress the response body transparently if required
3188
- let responseStream = res;
3189
-
3190
- // return the last request in case of redirects
3191
- const lastRequest = res.req || req;
3192
-
3193
- // if decompress disabled we should not decompress
3194
- if (config.decompress !== false && res.headers['content-encoding']) {
3195
- // if no content, but headers still say that it is encoded,
3196
- // remove the header not confuse downstream operations
3197
- if (method === 'HEAD' || res.statusCode === 204) {
3198
- delete res.headers['content-encoding'];
3199
- }
3200
- switch ((res.headers['content-encoding'] || '').toLowerCase()) {
3201
- /*eslint default-case:0*/
3202
- case 'gzip':
3203
- case 'x-gzip':
3204
- case 'compress':
3205
- case 'x-compress':
3206
- // add the unzipper to the body stream processing pipeline
3207
- streams.push(zlib.createUnzip(zlibOptions));
3208
-
3209
- // remove the content-encoding in order to not confuse downstream operations
3210
- delete res.headers['content-encoding'];
3211
- break;
3212
- case 'deflate':
3213
- streams.push(new ZlibHeaderTransformStream());
3214
-
3215
- // add the unzipper to the body stream processing pipeline
3216
- streams.push(zlib.createUnzip(zlibOptions));
3217
-
3218
- // remove the content-encoding in order to not confuse downstream operations
3219
- delete res.headers['content-encoding'];
3220
- break;
3221
- case 'br':
3222
- if (isBrotliSupported) {
3223
- streams.push(zlib.createBrotliDecompress(brotliOptions));
3224
- delete res.headers['content-encoding'];
3225
- }
3226
- }
3227
- }
3228
- responseStream = streams.length > 1 ? stream.pipeline(streams, utils$1.noop) : streams[0];
3229
- const response = {
3230
- status: res.statusCode,
3231
- statusText: res.statusMessage,
3232
- headers: new AxiosHeaders(res.headers),
3233
- config,
3234
- request: lastRequest
3235
- };
3236
- if (responseType === 'stream') {
3237
- response.data = responseStream;
3238
- settle(resolve, reject, response);
3239
- } else {
3240
- const responseBuffer = [];
3241
- let totalResponseBytes = 0;
3242
- responseStream.on('data', function handleStreamData(chunk) {
3243
- responseBuffer.push(chunk);
3244
- totalResponseBytes += chunk.length;
3245
-
3246
- // make sure the content length is not over the maxContentLength if specified
3247
- if (config.maxContentLength > -1 && totalResponseBytes > config.maxContentLength) {
3248
- // stream.destroy() emit aborted event before calling reject() on Node.js v16
3249
- rejected = true;
3250
- responseStream.destroy();
3251
- abort(new AxiosError('maxContentLength size of ' + config.maxContentLength + ' exceeded', AxiosError.ERR_BAD_RESPONSE, config, lastRequest));
3252
- }
3253
- });
3254
- responseStream.on('aborted', function handlerStreamAborted() {
3255
- if (rejected) {
3256
- return;
3257
- }
3258
- const err = new AxiosError('stream has been aborted', AxiosError.ERR_BAD_RESPONSE, config, lastRequest);
3259
- responseStream.destroy(err);
3260
- reject(err);
3261
- });
3262
- responseStream.on('error', function handleStreamError(err) {
3263
- if (req.destroyed) return;
3264
- reject(AxiosError.from(err, null, config, lastRequest));
3265
- });
3266
- responseStream.on('end', function handleStreamEnd() {
3267
- try {
3268
- let responseData = responseBuffer.length === 1 ? responseBuffer[0] : Buffer.concat(responseBuffer);
3269
- if (responseType !== 'arraybuffer') {
3270
- responseData = responseData.toString(responseEncoding);
3271
- if (!responseEncoding || responseEncoding === 'utf8') {
3272
- responseData = utils$1.stripBOM(responseData);
3273
- }
3274
- }
3275
- response.data = responseData;
3276
- } catch (err) {
3277
- return reject(AxiosError.from(err, null, config, response.request, response));
3278
- }
3279
- settle(resolve, reject, response);
3280
- });
3281
- }
3282
- abortEmitter.once('abort', err => {
3283
- if (!responseStream.destroyed) {
3284
- responseStream.emit('error', err);
3285
- responseStream.destroy();
3286
- }
3287
- });
3288
- });
3289
- abortEmitter.once('abort', err => {
3290
- if (req.close) {
3291
- req.close();
3292
- } else {
3293
- req.destroy(err);
3294
- }
3295
- });
3296
-
3297
- // Handle errors
3298
- req.on('error', function handleRequestError(err) {
3299
- reject(AxiosError.from(err, null, config, req));
3300
- });
3301
-
3302
- // set tcp keep alive to prevent drop connection by peer
3303
- req.on('socket', function handleRequestSocket(socket) {
3304
- // default interval of sending ack packet is 1 minute
3305
- socket.setKeepAlive(true, 1000 * 60);
3306
- });
3307
-
3308
- // Handle request timeout
3309
- if (config.timeout) {
3310
- // This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
3311
- const timeout = parseInt(config.timeout, 10);
3312
- if (Number.isNaN(timeout)) {
3313
- abort(new AxiosError('error trying to parse `config.timeout` to int', AxiosError.ERR_BAD_OPTION_VALUE, config, req));
3314
- return;
3315
- }
3316
-
3317
- // Sometime, the response will be very slow, and does not respond, the connect event will be block by event loop system.
3318
- // And timer callback will be fired, and abort() will be invoked before connection, then get "socket hang up" and code ECONNRESET.
3319
- // 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.
3320
- // And then these socket which be hang up will devouring CPU little by little.
3321
- // ClientRequest.setTimeout will be fired on the specify milliseconds, and can make sure that abort() will be fired after connect.
3322
- req.setTimeout(timeout, function handleRequestTimeout() {
3323
- if (isDone) return;
3324
- let timeoutErrorMessage = config.timeout ? 'timeout of ' + config.timeout + 'ms exceeded' : 'timeout exceeded';
3325
- const transitional = config.transitional || transitionalDefaults;
3326
- if (config.timeoutErrorMessage) {
3327
- timeoutErrorMessage = config.timeoutErrorMessage;
3328
- }
3329
- abort(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, req));
3330
- });
3331
- } else {
3332
- // explicitly reset the socket timeout value for a possible `keep-alive` request
3333
- req.setTimeout(0);
3334
- }
3335
-
3336
- // Send the request
3337
- if (utils$1.isStream(data)) {
3338
- let ended = false;
3339
- let errored = false;
3340
- data.on('end', () => {
3341
- ended = true;
3342
- });
3343
- data.once('error', err => {
3344
- errored = true;
3345
- req.destroy(err);
3346
- });
3347
- data.on('close', () => {
3348
- if (!ended && !errored) {
3349
- abort(new CanceledError('Request stream has been aborted', config, req));
3350
- }
3351
- });
3352
- data.pipe(req);
3353
- } else {
3354
- data && req.write(data);
3355
- req.end();
3356
- }
3357
- });
3358
- };
3359
-
3360
- var isURLSameOrigin = platform.hasStandardBrowserEnv ? ((origin, isMSIE) => url => {
3361
- url = new URL(url, platform.origin);
3362
- return origin.protocol === url.protocol && origin.host === url.host && (isMSIE || origin.port === url.port);
3363
- })(new URL(platform.origin), platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)) : () => true;
3364
-
3365
- var cookies = platform.hasStandardBrowserEnv ?
3366
- // Standard browser envs support document.cookie
3367
- {
3368
- write(name, value, expires, path, domain, secure, sameSite) {
3369
- if (typeof document === 'undefined') return;
3370
- const cookie = [`${name}=${encodeURIComponent(value)}`];
3371
- if (utils$1.isNumber(expires)) {
3372
- cookie.push(`expires=${new Date(expires).toUTCString()}`);
3373
- }
3374
- if (utils$1.isString(path)) {
3375
- cookie.push(`path=${path}`);
3376
- }
3377
- if (utils$1.isString(domain)) {
3378
- cookie.push(`domain=${domain}`);
3379
- }
3380
- if (secure === true) {
3381
- cookie.push('secure');
3382
- }
3383
- if (utils$1.isString(sameSite)) {
3384
- cookie.push(`SameSite=${sameSite}`);
3385
- }
3386
- document.cookie = cookie.join('; ');
3387
- },
3388
- read(name) {
3389
- if (typeof document === 'undefined') return null;
3390
- const match = document.cookie.match(new RegExp('(?:^|; )' + name + '=([^;]*)'));
3391
- return match ? decodeURIComponent(match[1]) : null;
3392
- },
3393
- remove(name) {
3394
- this.write(name, '', Date.now() - 86400000, '/');
3395
- }
3396
- } :
3397
- // Non-standard browser env (web workers, react-native) lack needed support.
3398
- {
3399
- write() {},
3400
- read() {
3401
- return null;
3402
- },
3403
- remove() {}
3404
- };
3405
-
3406
- const headersToObject = thing => thing instanceof AxiosHeaders ? {
3407
- ...thing
3408
- } : thing;
3409
-
3410
- /**
3411
- * Config-specific merge-function which creates a new config-object
3412
- * by merging two configuration objects together.
3413
- *
3414
- * @param {Object} config1
3415
- * @param {Object} config2
3416
- *
3417
- * @returns {Object} New object resulting from merging config2 to config1
3418
- */
3419
- function mergeConfig(config1, config2) {
3420
- // eslint-disable-next-line no-param-reassign
3421
- config2 = config2 || {};
3422
- const config = {};
3423
- function getMergedValue(target, source, prop, caseless) {
3424
- if (utils$1.isPlainObject(target) && utils$1.isPlainObject(source)) {
3425
- return utils$1.merge.call({
3426
- caseless
3427
- }, target, source);
3428
- } else if (utils$1.isPlainObject(source)) {
3429
- return utils$1.merge({}, source);
3430
- } else if (utils$1.isArray(source)) {
3431
- return source.slice();
3432
- }
3433
- return source;
3434
- }
3435
- function mergeDeepProperties(a, b, prop, caseless) {
3436
- if (!utils$1.isUndefined(b)) {
3437
- return getMergedValue(a, b, prop, caseless);
3438
- } else if (!utils$1.isUndefined(a)) {
3439
- return getMergedValue(undefined, a, prop, caseless);
3440
- }
3441
- }
3442
-
3443
- // eslint-disable-next-line consistent-return
3444
- function valueFromConfig2(a, b) {
3445
- if (!utils$1.isUndefined(b)) {
3446
- return getMergedValue(undefined, b);
3447
- }
3448
- }
3449
-
3450
- // eslint-disable-next-line consistent-return
3451
- function defaultToConfig2(a, b) {
3452
- if (!utils$1.isUndefined(b)) {
3453
- return getMergedValue(undefined, b);
3454
- } else if (!utils$1.isUndefined(a)) {
3455
- return getMergedValue(undefined, a);
3456
- }
3457
- }
3458
-
3459
- // eslint-disable-next-line consistent-return
3460
- function mergeDirectKeys(a, b, prop) {
3461
- if (prop in config2) {
3462
- return getMergedValue(a, b);
3463
- } else if (prop in config1) {
3464
- return getMergedValue(undefined, a);
3465
- }
3466
- }
3467
- const mergeMap = {
3468
- url: valueFromConfig2,
3469
- method: valueFromConfig2,
3470
- data: valueFromConfig2,
3471
- baseURL: defaultToConfig2,
3472
- transformRequest: defaultToConfig2,
3473
- transformResponse: defaultToConfig2,
3474
- paramsSerializer: defaultToConfig2,
3475
- timeout: defaultToConfig2,
3476
- timeoutMessage: defaultToConfig2,
3477
- withCredentials: defaultToConfig2,
3478
- withXSRFToken: defaultToConfig2,
3479
- adapter: defaultToConfig2,
3480
- responseType: defaultToConfig2,
3481
- xsrfCookieName: defaultToConfig2,
3482
- xsrfHeaderName: defaultToConfig2,
3483
- onUploadProgress: defaultToConfig2,
3484
- onDownloadProgress: defaultToConfig2,
3485
- decompress: defaultToConfig2,
3486
- maxContentLength: defaultToConfig2,
3487
- maxBodyLength: defaultToConfig2,
3488
- beforeRedirect: defaultToConfig2,
3489
- transport: defaultToConfig2,
3490
- httpAgent: defaultToConfig2,
3491
- httpsAgent: defaultToConfig2,
3492
- cancelToken: defaultToConfig2,
3493
- socketPath: defaultToConfig2,
3494
- responseEncoding: defaultToConfig2,
3495
- validateStatus: mergeDirectKeys,
3496
- headers: (a, b, prop) => mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true)
3497
- };
3498
- utils$1.forEach(Object.keys({
3499
- ...config1,
3500
- ...config2
3501
- }), function computeConfigValue(prop) {
3502
- if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
3503
- const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
3504
- const configValue = merge(config1[prop], config2[prop], prop);
3505
- utils$1.isUndefined(configValue) && merge !== mergeDirectKeys || (config[prop] = configValue);
3506
- });
3507
- return config;
3508
- }
3509
-
3510
- var resolveConfig = config => {
3511
- const newConfig = mergeConfig({}, config);
3512
- let {
3513
- data,
3514
- withXSRFToken,
3515
- xsrfHeaderName,
3516
- xsrfCookieName,
3517
- headers,
3518
- auth
3519
- } = newConfig;
3520
- newConfig.headers = headers = AxiosHeaders.from(headers);
3521
- newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url, newConfig.allowAbsoluteUrls), config.params, config.paramsSerializer);
3522
-
3523
- // HTTP basic authentication
3524
- if (auth) {
3525
- headers.set('Authorization', 'Basic ' + btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : '')));
3526
- }
3527
- if (utils$1.isFormData(data)) {
3528
- if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
3529
- headers.setContentType(undefined); // browser handles it
3530
- } else if (utils$1.isFunction(data.getHeaders)) {
3531
- // Node.js FormData (like form-data package)
3532
- const formHeaders = data.getHeaders();
3533
- // Only set safe headers to avoid overwriting security headers
3534
- const allowedHeaders = ['content-type', 'content-length'];
3535
- Object.entries(formHeaders).forEach(([key, val]) => {
3536
- if (allowedHeaders.includes(key.toLowerCase())) {
3537
- headers.set(key, val);
3538
- }
3539
- });
3540
- }
3541
- }
3542
-
3543
- // Add xsrf header
3544
- // This is only done if running in a standard browser environment.
3545
- // Specifically not if we're in a web worker, or react-native.
3546
-
3547
- if (platform.hasStandardBrowserEnv) {
3548
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
3549
- if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin(newConfig.url)) {
3550
- // Add xsrf header
3551
- const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
3552
- if (xsrfValue) {
3553
- headers.set(xsrfHeaderName, xsrfValue);
3554
- }
3555
- }
3556
- }
3557
- return newConfig;
3558
- };
3559
-
3560
- const isXHRAdapterSupported = typeof XMLHttpRequest !== 'undefined';
3561
- var xhrAdapter = isXHRAdapterSupported && function (config) {
3562
- return new Promise(function dispatchXhrRequest(resolve, reject) {
3563
- const _config = resolveConfig(config);
3564
- let requestData = _config.data;
3565
- const requestHeaders = AxiosHeaders.from(_config.headers).normalize();
3566
- let {
3567
- responseType,
3568
- onUploadProgress,
3569
- onDownloadProgress
3570
- } = _config;
3571
- let onCanceled;
3572
- let uploadThrottled, downloadThrottled;
3573
- let flushUpload, flushDownload;
3574
- function done() {
3575
- flushUpload && flushUpload(); // flush events
3576
- flushDownload && flushDownload(); // flush events
3577
-
3578
- _config.cancelToken && _config.cancelToken.unsubscribe(onCanceled);
3579
- _config.signal && _config.signal.removeEventListener('abort', onCanceled);
3580
- }
3581
- let request = new XMLHttpRequest();
3582
- request.open(_config.method.toUpperCase(), _config.url, true);
3583
-
3584
- // Set the request timeout in MS
3585
- request.timeout = _config.timeout;
3586
- function onloadend() {
3587
- if (!request) {
3588
- return;
3589
- }
3590
- // Prepare the response
3591
- const responseHeaders = AxiosHeaders.from('getAllResponseHeaders' in request && request.getAllResponseHeaders());
3592
- const responseData = !responseType || responseType === 'text' || responseType === 'json' ? request.responseText : request.response;
3593
- const response = {
3594
- data: responseData,
3595
- status: request.status,
3596
- statusText: request.statusText,
3597
- headers: responseHeaders,
3598
- config,
3599
- request
3600
- };
3601
- settle(function _resolve(value) {
3602
- resolve(value);
3603
- done();
3604
- }, function _reject(err) {
3605
- reject(err);
3606
- done();
3607
- }, response);
3608
-
3609
- // Clean up request
3610
- request = null;
3611
- }
3612
- if ('onloadend' in request) {
3613
- // Use onloadend if available
3614
- request.onloadend = onloadend;
3615
- } else {
3616
- // Listen for ready state to emulate onloadend
3617
- request.onreadystatechange = function handleLoad() {
3618
- if (!request || request.readyState !== 4) {
3619
- return;
3620
- }
3621
-
3622
- // The request errored out and we didn't get a response, this will be
3623
- // handled by onerror instead
3624
- // With one exception: request that using file: protocol, most browsers
3625
- // will return status as 0 even though it's a successful request
3626
- if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
3627
- return;
3628
- }
3629
- // readystate handler is calling before onerror or ontimeout handlers,
3630
- // so we should call onloadend on the next 'tick'
3631
- setTimeout(onloadend);
3632
- };
3633
- }
3634
-
3635
- // Handle browser request cancellation (as opposed to a manual cancellation)
3636
- request.onabort = function handleAbort() {
3637
- if (!request) {
3638
- return;
3639
- }
3640
- reject(new AxiosError('Request aborted', AxiosError.ECONNABORTED, config, request));
3641
-
3642
- // Clean up request
3643
- request = null;
3644
- };
3645
-
3646
- // Handle low level network errors
3647
- request.onerror = function handleError(event) {
3648
- // Browsers deliver a ProgressEvent in XHR onerror
3649
- // (message may be empty; when present, surface it)
3650
- // See https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/error_event
3651
- const msg = event && event.message ? event.message : 'Network Error';
3652
- const err = new AxiosError(msg, AxiosError.ERR_NETWORK, config, request);
3653
- // attach the underlying event for consumers who want details
3654
- err.event = event || null;
3655
- reject(err);
3656
- request = null;
3657
- };
3658
-
3659
- // Handle timeout
3660
- request.ontimeout = function handleTimeout() {
3661
- let timeoutErrorMessage = _config.timeout ? 'timeout of ' + _config.timeout + 'ms exceeded' : 'timeout exceeded';
3662
- const transitional = _config.transitional || transitionalDefaults;
3663
- if (_config.timeoutErrorMessage) {
3664
- timeoutErrorMessage = _config.timeoutErrorMessage;
3665
- }
3666
- reject(new AxiosError(timeoutErrorMessage, transitional.clarifyTimeoutError ? AxiosError.ETIMEDOUT : AxiosError.ECONNABORTED, config, request));
3667
-
3668
- // Clean up request
3669
- request = null;
3670
- };
3671
-
3672
- // Remove Content-Type if data is undefined
3673
- requestData === undefined && requestHeaders.setContentType(null);
3674
-
3675
- // Add headers to the request
3676
- if ('setRequestHeader' in request) {
3677
- utils$1.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
3678
- request.setRequestHeader(key, val);
3679
- });
3680
- }
3681
-
3682
- // Add withCredentials to request if needed
3683
- if (!utils$1.isUndefined(_config.withCredentials)) {
3684
- request.withCredentials = !!_config.withCredentials;
3685
- }
3686
-
3687
- // Add responseType to request if needed
3688
- if (responseType && responseType !== 'json') {
3689
- request.responseType = _config.responseType;
3690
- }
3691
-
3692
- // Handle progress if needed
3693
- if (onDownloadProgress) {
3694
- [downloadThrottled, flushDownload] = progressEventReducer(onDownloadProgress, true);
3695
- request.addEventListener('progress', downloadThrottled);
3696
- }
3697
-
3698
- // Not all browsers support upload events
3699
- if (onUploadProgress && request.upload) {
3700
- [uploadThrottled, flushUpload] = progressEventReducer(onUploadProgress);
3701
- request.upload.addEventListener('progress', uploadThrottled);
3702
- request.upload.addEventListener('loadend', flushUpload);
3703
- }
3704
- if (_config.cancelToken || _config.signal) {
3705
- // Handle cancellation
3706
- // eslint-disable-next-line func-names
3707
- onCanceled = cancel => {
3708
- if (!request) {
3709
- return;
3710
- }
3711
- reject(!cancel || cancel.type ? new CanceledError(null, config, request) : cancel);
3712
- request.abort();
3713
- request = null;
3714
- };
3715
- _config.cancelToken && _config.cancelToken.subscribe(onCanceled);
3716
- if (_config.signal) {
3717
- _config.signal.aborted ? onCanceled() : _config.signal.addEventListener('abort', onCanceled);
3718
- }
3719
- }
3720
- const protocol = parseProtocol(_config.url);
3721
- if (protocol && platform.protocols.indexOf(protocol) === -1) {
3722
- reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
3723
- return;
3724
- }
3725
-
3726
- // Send the request
3727
- request.send(requestData || null);
3728
- });
3729
- };
3730
-
3731
- const composeSignals = (signals, timeout) => {
3732
- const {
3733
- length
3734
- } = signals = signals ? signals.filter(Boolean) : [];
3735
- if (timeout || length) {
3736
- let controller = new AbortController();
3737
- let aborted;
3738
- const onabort = function (reason) {
3739
- if (!aborted) {
3740
- aborted = true;
3741
- unsubscribe();
3742
- const err = reason instanceof Error ? reason : this.reason;
3743
- controller.abort(err instanceof AxiosError ? err : new CanceledError(err instanceof Error ? err.message : err));
3744
- }
3745
- };
3746
- let timer = timeout && setTimeout(() => {
3747
- timer = null;
3748
- onabort(new AxiosError(`timeout of ${timeout}ms exceeded`, AxiosError.ETIMEDOUT));
3749
- }, timeout);
3750
- const unsubscribe = () => {
3751
- if (signals) {
3752
- timer && clearTimeout(timer);
3753
- timer = null;
3754
- signals.forEach(signal => {
3755
- signal.unsubscribe ? signal.unsubscribe(onabort) : signal.removeEventListener('abort', onabort);
3756
- });
3757
- signals = null;
3758
- }
3759
- };
3760
- signals.forEach(signal => signal.addEventListener('abort', onabort));
3761
- const {
3762
- signal
3763
- } = controller;
3764
- signal.unsubscribe = () => utils$1.asap(unsubscribe);
3765
- return signal;
3766
- }
3767
- };
3768
-
3769
- const streamChunk = function* (chunk, chunkSize) {
3770
- let len = chunk.byteLength;
3771
- if (len < chunkSize) {
3772
- yield chunk;
3773
- return;
3774
- }
3775
- let pos = 0;
3776
- let end;
3777
- while (pos < len) {
3778
- end = pos + chunkSize;
3779
- yield chunk.slice(pos, end);
3780
- pos = end;
3781
- }
3782
- };
3783
- const readBytes = async function* (iterable, chunkSize) {
3784
- for await (const chunk of readStream(iterable)) {
3785
- yield* streamChunk(chunk, chunkSize);
3786
- }
3787
- };
3788
- const readStream = async function* (stream) {
3789
- if (stream[Symbol.asyncIterator]) {
3790
- yield* stream;
3791
- return;
3792
- }
3793
- const reader = stream.getReader();
3794
- try {
3795
- for (;;) {
3796
- const {
3797
- done,
3798
- value
3799
- } = await reader.read();
3800
- if (done) {
3801
- break;
3802
- }
3803
- yield value;
3804
- }
3805
- } finally {
3806
- await reader.cancel();
3807
- }
3808
- };
3809
- const trackStream = (stream, chunkSize, onProgress, onFinish) => {
3810
- const iterator = readBytes(stream, chunkSize);
3811
- let bytes = 0;
3812
- let done;
3813
- let _onFinish = e => {
3814
- if (!done) {
3815
- done = true;
3816
- onFinish && onFinish(e);
3817
- }
3818
- };
3819
- return new ReadableStream({
3820
- async pull(controller) {
3821
- try {
3822
- const {
3823
- done,
3824
- value
3825
- } = await iterator.next();
3826
- if (done) {
3827
- _onFinish();
3828
- controller.close();
3829
- return;
3830
- }
3831
- let len = value.byteLength;
3832
- if (onProgress) {
3833
- let loadedBytes = bytes += len;
3834
- onProgress(loadedBytes);
3835
- }
3836
- controller.enqueue(new Uint8Array(value));
3837
- } catch (err) {
3838
- _onFinish(err);
3839
- throw err;
3840
- }
3841
- },
3842
- cancel(reason) {
3843
- _onFinish(reason);
3844
- return iterator.return();
3845
- }
3846
- }, {
3847
- highWaterMark: 2
3848
- });
3849
- };
3850
-
3851
- const DEFAULT_CHUNK_SIZE = 64 * 1024;
3852
- const {
3853
- isFunction
3854
- } = utils$1;
3855
- const globalFetchAPI = (({
3856
- Request,
3857
- Response
3858
- }) => ({
3859
- Request,
3860
- Response
3861
- }))(utils$1.global);
3862
- const {
3863
- ReadableStream: ReadableStream$1,
3864
- TextEncoder: TextEncoder$1
3865
- } = utils$1.global;
3866
- const test = (fn, ...args) => {
3867
- try {
3868
- return !!fn(...args);
3869
- } catch (e) {
3870
- return false;
3871
- }
3872
- };
3873
- const factory = env => {
3874
- env = utils$1.merge.call({
3875
- skipUndefined: true
3876
- }, globalFetchAPI, env);
3877
- const {
3878
- fetch: envFetch,
3879
- Request,
3880
- Response
3881
- } = env;
3882
- const isFetchSupported = envFetch ? isFunction(envFetch) : typeof fetch === 'function';
3883
- const isRequestSupported = isFunction(Request);
3884
- const isResponseSupported = isFunction(Response);
3885
- if (!isFetchSupported) {
3886
- return false;
3887
- }
3888
- const isReadableStreamSupported = isFetchSupported && isFunction(ReadableStream$1);
3889
- const encodeText = isFetchSupported && (typeof TextEncoder$1 === 'function' ? (encoder => str => encoder.encode(str))(new TextEncoder$1()) : async str => new Uint8Array(await new Request(str).arrayBuffer()));
3890
- const supportsRequestStream = isRequestSupported && isReadableStreamSupported && test(() => {
3891
- let duplexAccessed = false;
3892
- const body = new ReadableStream$1();
3893
- const hasContentType = new Request(platform.origin, {
3894
- body,
3895
- method: 'POST',
3896
- get duplex() {
3897
- duplexAccessed = true;
3898
- return 'half';
3899
- }
3900
- }).headers.has('Content-Type');
3901
- body.cancel();
3902
- return duplexAccessed && !hasContentType;
3903
- });
3904
- const supportsResponseStream = isResponseSupported && isReadableStreamSupported && test(() => utils$1.isReadableStream(new Response('').body));
3905
- const resolvers = {
3906
- stream: supportsResponseStream && (res => res.body)
3907
- };
3908
- isFetchSupported && (() => {
3909
- ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {
3910
- !resolvers[type] && (resolvers[type] = (res, config) => {
3911
- let method = res && res[type];
3912
- if (method) {
3913
- return method.call(res);
3914
- }
3915
- throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
3916
- });
3917
- });
3918
- })();
3919
- const getBodyLength = async body => {
3920
- if (body == null) {
3921
- return 0;
3922
- }
3923
- if (utils$1.isBlob(body)) {
3924
- return body.size;
3925
- }
3926
- if (utils$1.isSpecCompliantForm(body)) {
3927
- const _request = new Request(platform.origin, {
3928
- method: 'POST',
3929
- body
3930
- });
3931
- return (await _request.arrayBuffer()).byteLength;
3932
- }
3933
- if (utils$1.isArrayBufferView(body) || utils$1.isArrayBuffer(body)) {
3934
- return body.byteLength;
3935
- }
3936
- if (utils$1.isURLSearchParams(body)) {
3937
- body = body + '';
3938
- }
3939
- if (utils$1.isString(body)) {
3940
- return (await encodeText(body)).byteLength;
3941
- }
3942
- };
3943
- const resolveBodyLength = async (headers, body) => {
3944
- const length = utils$1.toFiniteNumber(headers.getContentLength());
3945
- return length == null ? getBodyLength(body) : length;
3946
- };
3947
- return async config => {
3948
- let {
3949
- url,
3950
- method,
3951
- data,
3952
- signal,
3953
- cancelToken,
3954
- timeout,
3955
- onDownloadProgress,
3956
- onUploadProgress,
3957
- responseType,
3958
- headers,
3959
- withCredentials = 'same-origin',
3960
- fetchOptions
3961
- } = resolveConfig(config);
3962
- let _fetch = envFetch || fetch;
3963
- responseType = responseType ? (responseType + '').toLowerCase() : 'text';
3964
- let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
3965
- let request = null;
3966
- const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
3967
- composedSignal.unsubscribe();
3968
- });
3969
- let requestContentLength;
3970
- try {
3971
- if (onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
3972
- let _request = new Request(url, {
3973
- method: 'POST',
3974
- body: data,
3975
- duplex: 'half'
3976
- });
3977
- let contentTypeHeader;
3978
- if (utils$1.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {
3979
- headers.setContentType(contentTypeHeader);
3980
- }
3981
- if (_request.body) {
3982
- const [onProgress, flush] = progressEventDecorator(requestContentLength, progressEventReducer(asyncDecorator(onUploadProgress)));
3983
- data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
3984
- }
3985
- }
3986
- if (!utils$1.isString(withCredentials)) {
3987
- withCredentials = withCredentials ? 'include' : 'omit';
3988
- }
3989
-
3990
- // Cloudflare Workers throws when credentials are defined
3991
- // see https://github.com/cloudflare/workerd/issues/902
3992
- const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
3993
- const resolvedOptions = {
3994
- ...fetchOptions,
3995
- signal: composedSignal,
3996
- method: method.toUpperCase(),
3997
- headers: headers.normalize().toJSON(),
3998
- body: data,
3999
- duplex: 'half',
4000
- credentials: isCredentialsSupported ? withCredentials : undefined
4001
- };
4002
- request = isRequestSupported && new Request(url, resolvedOptions);
4003
- let response = await (isRequestSupported ? _fetch(request, fetchOptions) : _fetch(url, resolvedOptions));
4004
- const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');
4005
- if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
4006
- const options = {};
4007
- ['status', 'statusText', 'headers'].forEach(prop => {
4008
- options[prop] = response[prop];
4009
- });
4010
- const responseContentLength = utils$1.toFiniteNumber(response.headers.get('content-length'));
4011
- const [onProgress, flush] = onDownloadProgress && progressEventDecorator(responseContentLength, progressEventReducer(asyncDecorator(onDownloadProgress), true)) || [];
4012
- response = new Response(trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
4013
- flush && flush();
4014
- unsubscribe && unsubscribe();
4015
- }), options);
4016
- }
4017
- responseType = responseType || 'text';
4018
- let responseData = await resolvers[utils$1.findKey(resolvers, responseType) || 'text'](response, config);
4019
- !isStreamResponse && unsubscribe && unsubscribe();
4020
- return await new Promise((resolve, reject) => {
4021
- settle(resolve, reject, {
4022
- data: responseData,
4023
- headers: AxiosHeaders.from(response.headers),
4024
- status: response.status,
4025
- statusText: response.statusText,
4026
- config,
4027
- request
4028
- });
4029
- });
4030
- } catch (err) {
4031
- unsubscribe && unsubscribe();
4032
- if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
4033
- throw Object.assign(new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request, err && err.response), {
4034
- cause: err.cause || err
4035
- });
4036
- }
4037
- throw AxiosError.from(err, err && err.code, config, request, err && err.response);
4038
- }
4039
- };
4040
- };
4041
- const seedCache = new Map();
4042
- const getFetch = config => {
4043
- let env = config && config.env || {};
4044
- const {
4045
- fetch,
4046
- Request,
4047
- Response
4048
- } = env;
4049
- const seeds = [Request, Response, fetch];
4050
- let len = seeds.length,
4051
- i = len,
4052
- seed,
4053
- target,
4054
- map = seedCache;
4055
- while (i--) {
4056
- seed = seeds[i];
4057
- target = map.get(seed);
4058
- target === undefined && map.set(seed, target = i ? new Map() : factory(env));
4059
- map = target;
4060
- }
4061
- return target;
4062
- };
4063
- getFetch();
4064
-
4065
- /**
4066
- * Known adapters mapping.
4067
- * Provides environment-specific adapters for Axios:
4068
- * - `http` for Node.js
4069
- * - `xhr` for browsers
4070
- * - `fetch` for fetch API-based requests
4071
- *
4072
- * @type {Object<string, Function|Object>}
4073
- */
4074
- const knownAdapters = {
4075
- http: httpAdapter,
4076
- xhr: xhrAdapter,
4077
- fetch: {
4078
- get: getFetch
4079
- }
4080
- };
4081
-
4082
- // Assign adapter names for easier debugging and identification
4083
- utils$1.forEach(knownAdapters, (fn, value) => {
4084
- if (fn) {
4085
- try {
4086
- Object.defineProperty(fn, 'name', {
4087
- value
4088
- });
4089
- } catch (e) {
4090
- // eslint-disable-next-line no-empty
4091
- }
4092
- Object.defineProperty(fn, 'adapterName', {
4093
- value
4094
- });
4095
- }
4096
- });
4097
-
4098
- /**
4099
- * Render a rejection reason string for unknown or unsupported adapters
4100
- *
4101
- * @param {string} reason
4102
- * @returns {string}
4103
- */
4104
- const renderReason = reason => `- ${reason}`;
4105
-
4106
- /**
4107
- * Check if the adapter is resolved (function, null, or false)
4108
- *
4109
- * @param {Function|null|false} adapter
4110
- * @returns {boolean}
4111
- */
4112
- const isResolvedHandle = adapter => utils$1.isFunction(adapter) || adapter === null || adapter === false;
4113
-
4114
- /**
4115
- * Get the first suitable adapter from the provided list.
4116
- * Tries each adapter in order until a supported one is found.
4117
- * Throws an AxiosError if no adapter is suitable.
4118
- *
4119
- * @param {Array<string|Function>|string|Function} adapters - Adapter(s) by name or function.
4120
- * @param {Object} config - Axios request configuration
4121
- * @throws {AxiosError} If no suitable adapter is available
4122
- * @returns {Function} The resolved adapter function
4123
- */
4124
- function getAdapter(adapters, config) {
4125
- adapters = utils$1.isArray(adapters) ? adapters : [adapters];
4126
- const {
4127
- length
4128
- } = adapters;
4129
- let nameOrAdapter;
4130
- let adapter;
4131
- const rejectedReasons = {};
4132
- for (let i = 0; i < length; i++) {
4133
- nameOrAdapter = adapters[i];
4134
- let id;
4135
- adapter = nameOrAdapter;
4136
- if (!isResolvedHandle(nameOrAdapter)) {
4137
- adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
4138
- if (adapter === undefined) {
4139
- throw new AxiosError(`Unknown adapter '${id}'`);
4140
- }
4141
- }
4142
- if (adapter && (utils$1.isFunction(adapter) || (adapter = adapter.get(config)))) {
4143
- break;
4144
- }
4145
- rejectedReasons[id || '#' + i] = adapter;
4146
- }
4147
- if (!adapter) {
4148
- const reasons = Object.entries(rejectedReasons).map(([id, state]) => `adapter ${id} ` + (state === false ? 'is not supported by the environment' : 'is not available in the build'));
4149
- let s = length ? reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0]) : 'as no adapter specified';
4150
- throw new AxiosError(`There is no suitable adapter to dispatch the request ` + s, 'ERR_NOT_SUPPORT');
4151
- }
4152
- return adapter;
4153
- }
4154
-
4155
- /**
4156
- * Exports Axios adapters and utility to resolve an adapter
4157
- */
4158
- var adapters = {
4159
- /**
4160
- * Resolve an adapter from a list of adapter names or functions.
4161
- * @type {Function}
4162
- */
4163
- getAdapter,
4164
- /**
4165
- * Exposes all known adapters
4166
- * @type {Object<string, Function|Object>}
4167
- */
4168
- adapters: knownAdapters
4169
- };
4170
-
4171
- /**
4172
- * Throws a `CanceledError` if cancellation has been requested.
4173
- *
4174
- * @param {Object} config The config that is to be used for the request
4175
- *
4176
- * @returns {void}
4177
- */
4178
- function throwIfCancellationRequested(config) {
4179
- if (config.cancelToken) {
4180
- config.cancelToken.throwIfRequested();
4181
- }
4182
- if (config.signal && config.signal.aborted) {
4183
- throw new CanceledError(null, config);
4184
- }
4185
- }
4186
-
4187
- /**
4188
- * Dispatch a request to the server using the configured adapter.
4189
- *
4190
- * @param {object} config The config that is to be used for the request
4191
- *
4192
- * @returns {Promise} The Promise to be fulfilled
4193
- */
4194
- function dispatchRequest(config) {
4195
- throwIfCancellationRequested(config);
4196
- config.headers = AxiosHeaders.from(config.headers);
4197
-
4198
- // Transform request data
4199
- config.data = transformData.call(config, config.transformRequest);
4200
- if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
4201
- config.headers.setContentType('application/x-www-form-urlencoded', false);
4202
- }
4203
- const adapter = adapters.getAdapter(config.adapter || defaults.adapter, config);
4204
- return adapter(config).then(function onAdapterResolution(response) {
4205
- throwIfCancellationRequested(config);
4206
-
4207
- // Transform response data
4208
- response.data = transformData.call(config, config.transformResponse, response);
4209
- response.headers = AxiosHeaders.from(response.headers);
4210
- return response;
4211
- }, function onAdapterRejection(reason) {
4212
- if (!isCancel(reason)) {
4213
- throwIfCancellationRequested(config);
4214
-
4215
- // Transform response data
4216
- if (reason && reason.response) {
4217
- reason.response.data = transformData.call(config, config.transformResponse, reason.response);
4218
- reason.response.headers = AxiosHeaders.from(reason.response.headers);
4219
- }
4220
- }
4221
- return Promise.reject(reason);
4222
- });
4223
- }
4224
-
4225
- const validators$1 = {};
4226
-
4227
- // eslint-disable-next-line func-names
4228
- ['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach((type, i) => {
4229
- validators$1[type] = function validator(thing) {
4230
- return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;
4231
- };
4232
- });
4233
- const deprecatedWarnings = {};
4234
-
4235
- /**
4236
- * Transitional option validator
4237
- *
4238
- * @param {function|boolean?} validator - set to false if the transitional option has been removed
4239
- * @param {string?} version - deprecated version / removed since version
4240
- * @param {string?} message - some message with additional info
4241
- *
4242
- * @returns {function}
4243
- */
4244
- validators$1.transitional = function transitional(validator, version, message) {
4245
- function formatMessage(opt, desc) {
4246
- return '[Axios v' + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? '. ' + message : '');
4247
- }
4248
-
4249
- // eslint-disable-next-line func-names
4250
- return (value, opt, opts) => {
4251
- if (validator === false) {
4252
- throw new AxiosError(formatMessage(opt, ' has been removed' + (version ? ' in ' + version : '')), AxiosError.ERR_DEPRECATED);
4253
- }
4254
- if (version && !deprecatedWarnings[opt]) {
4255
- deprecatedWarnings[opt] = true;
4256
- // eslint-disable-next-line no-console
4257
- console.warn(formatMessage(opt, ' has been deprecated since v' + version + ' and will be removed in the near future'));
4258
- }
4259
- return validator ? validator(value, opt, opts) : true;
4260
- };
4261
- };
4262
- validators$1.spelling = function spelling(correctSpelling) {
4263
- return (value, opt) => {
4264
- // eslint-disable-next-line no-console
4265
- console.warn(`${opt} is likely a misspelling of ${correctSpelling}`);
4266
- return true;
4267
- };
4268
- };
4269
-
4270
- /**
4271
- * Assert object's properties type
4272
- *
4273
- * @param {object} options
4274
- * @param {object} schema
4275
- * @param {boolean?} allowUnknown
4276
- *
4277
- * @returns {object}
4278
- */
4279
-
4280
- function assertOptions(options, schema, allowUnknown) {
4281
- if (typeof options !== 'object') {
4282
- throw new AxiosError('options must be an object', AxiosError.ERR_BAD_OPTION_VALUE);
4283
- }
4284
- const keys = Object.keys(options);
4285
- let i = keys.length;
4286
- while (i-- > 0) {
4287
- const opt = keys[i];
4288
- const validator = schema[opt];
4289
- if (validator) {
4290
- const value = options[opt];
4291
- const result = value === undefined || validator(value, opt, options);
4292
- if (result !== true) {
4293
- throw new AxiosError('option ' + opt + ' must be ' + result, AxiosError.ERR_BAD_OPTION_VALUE);
4294
- }
4295
- continue;
4296
- }
4297
- if (allowUnknown !== true) {
4298
- throw new AxiosError('Unknown option ' + opt, AxiosError.ERR_BAD_OPTION);
4299
- }
4300
- }
4301
- }
4302
- var validator = {
4303
- assertOptions,
4304
- validators: validators$1
4305
- };
4306
-
4307
- const validators = validator.validators;
4308
-
4309
- /**
4310
- * Create a new instance of Axios
4311
- *
4312
- * @param {Object} instanceConfig The default config for the instance
4313
- *
4314
- * @return {Axios} A new instance of Axios
4315
- */
4316
- class Axios {
4317
- constructor(instanceConfig) {
4318
- this.defaults = instanceConfig || {};
4319
- this.interceptors = {
4320
- request: new InterceptorManager(),
4321
- response: new InterceptorManager()
4322
- };
4323
- }
4324
-
4325
- /**
4326
- * Dispatch a request
4327
- *
4328
- * @param {String|Object} configOrUrl The config specific for this request (merged with this.defaults)
4329
- * @param {?Object} config
4330
- *
4331
- * @returns {Promise} The Promise to be fulfilled
4332
- */
4333
- async request(configOrUrl, config) {
4334
- try {
4335
- return await this._request(configOrUrl, config);
4336
- } catch (err) {
4337
- if (err instanceof Error) {
4338
- let dummy = {};
4339
- Error.captureStackTrace ? Error.captureStackTrace(dummy) : dummy = new Error();
4340
-
4341
- // slice off the Error: ... line
4342
- const stack = (() => {
4343
- if (!dummy.stack) {
4344
- return '';
4345
- }
4346
- const firstNewlineIndex = dummy.stack.indexOf('\n');
4347
- return firstNewlineIndex === -1 ? '' : dummy.stack.slice(firstNewlineIndex + 1);
4348
- })();
4349
- try {
4350
- if (!err.stack) {
4351
- err.stack = stack;
4352
- // match without the 2 top stack lines
4353
- } else if (stack) {
4354
- const firstNewlineIndex = stack.indexOf('\n');
4355
- const secondNewlineIndex = firstNewlineIndex === -1 ? -1 : stack.indexOf('\n', firstNewlineIndex + 1);
4356
- const stackWithoutTwoTopLines = secondNewlineIndex === -1 ? '' : stack.slice(secondNewlineIndex + 1);
4357
- if (!String(err.stack).endsWith(stackWithoutTwoTopLines)) {
4358
- err.stack += '\n' + stack;
4359
- }
4360
- }
4361
- } catch (e) {
4362
- // ignore the case where "stack" is an un-writable property
4363
- }
4364
- }
4365
- throw err;
4366
- }
4367
- }
4368
- _request(configOrUrl, config) {
4369
- /*eslint no-param-reassign:0*/
4370
- // Allow for axios('example/url'[, config]) a la fetch API
4371
- if (typeof configOrUrl === 'string') {
4372
- config = config || {};
4373
- config.url = configOrUrl;
4374
- } else {
4375
- config = configOrUrl || {};
4376
- }
4377
- config = mergeConfig(this.defaults, config);
4378
- const {
4379
- transitional,
4380
- paramsSerializer,
4381
- headers
4382
- } = config;
4383
- if (transitional !== undefined) {
4384
- validator.assertOptions(transitional, {
4385
- silentJSONParsing: validators.transitional(validators.boolean),
4386
- forcedJSONParsing: validators.transitional(validators.boolean),
4387
- clarifyTimeoutError: validators.transitional(validators.boolean),
4388
- legacyInterceptorReqResOrdering: validators.transitional(validators.boolean)
4389
- }, false);
4390
- }
4391
- if (paramsSerializer != null) {
4392
- if (utils$1.isFunction(paramsSerializer)) {
4393
- config.paramsSerializer = {
4394
- serialize: paramsSerializer
4395
- };
4396
- } else {
4397
- validator.assertOptions(paramsSerializer, {
4398
- encode: validators.function,
4399
- serialize: validators.function
4400
- }, true);
4401
- }
4402
- }
4403
-
4404
- // Set config.allowAbsoluteUrls
4405
- if (config.allowAbsoluteUrls !== undefined) ; else if (this.defaults.allowAbsoluteUrls !== undefined) {
4406
- config.allowAbsoluteUrls = this.defaults.allowAbsoluteUrls;
4407
- } else {
4408
- config.allowAbsoluteUrls = true;
4409
- }
4410
- validator.assertOptions(config, {
4411
- baseUrl: validators.spelling('baseURL'),
4412
- withXsrfToken: validators.spelling('withXSRFToken')
4413
- }, true);
4414
-
4415
- // Set config.method
4416
- config.method = (config.method || this.defaults.method || 'get').toLowerCase();
4417
-
4418
- // Flatten headers
4419
- let contextHeaders = headers && utils$1.merge(headers.common, headers[config.method]);
4420
- headers && utils$1.forEach(['delete', 'get', 'head', 'post', 'put', 'patch', 'common'], method => {
4421
- delete headers[method];
4422
- });
4423
- config.headers = AxiosHeaders.concat(contextHeaders, headers);
4424
-
4425
- // filter out skipped interceptors
4426
- const requestInterceptorChain = [];
4427
- let synchronousRequestInterceptors = true;
4428
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
4429
- if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {
4430
- return;
4431
- }
4432
- synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
4433
- const transitional = config.transitional || transitionalDefaults;
4434
- const legacyInterceptorReqResOrdering = transitional && transitional.legacyInterceptorReqResOrdering;
4435
- if (legacyInterceptorReqResOrdering) {
4436
- requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
4437
- } else {
4438
- requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
4439
- }
4440
- });
4441
- const responseInterceptorChain = [];
4442
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
4443
- responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
4444
- });
4445
- let promise;
4446
- let i = 0;
4447
- let len;
4448
- if (!synchronousRequestInterceptors) {
4449
- const chain = [dispatchRequest.bind(this), undefined];
4450
- chain.unshift(...requestInterceptorChain);
4451
- chain.push(...responseInterceptorChain);
4452
- len = chain.length;
4453
- promise = Promise.resolve(config);
4454
- while (i < len) {
4455
- promise = promise.then(chain[i++], chain[i++]);
4456
- }
4457
- return promise;
4458
- }
4459
- len = requestInterceptorChain.length;
4460
- let newConfig = config;
4461
- while (i < len) {
4462
- const onFulfilled = requestInterceptorChain[i++];
4463
- const onRejected = requestInterceptorChain[i++];
4464
- try {
4465
- newConfig = onFulfilled(newConfig);
4466
- } catch (error) {
4467
- onRejected.call(this, error);
4468
- break;
4469
- }
4470
- }
4471
- try {
4472
- promise = dispatchRequest.call(this, newConfig);
4473
- } catch (error) {
4474
- return Promise.reject(error);
4475
- }
4476
- i = 0;
4477
- len = responseInterceptorChain.length;
4478
- while (i < len) {
4479
- promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
4480
- }
4481
- return promise;
4482
- }
4483
- getUri(config) {
4484
- config = mergeConfig(this.defaults, config);
4485
- const fullPath = buildFullPath(config.baseURL, config.url, config.allowAbsoluteUrls);
4486
- return buildURL(fullPath, config.params, config.paramsSerializer);
4487
- }
4488
- }
4489
-
4490
- // Provide aliases for supported request methods
4491
- utils$1.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
4492
- /*eslint func-names:0*/
4493
- Axios.prototype[method] = function (url, config) {
4494
- return this.request(mergeConfig(config || {}, {
4495
- method,
4496
- url,
4497
- data: (config || {}).data
4498
- }));
4499
- };
4500
- });
4501
- utils$1.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
4502
- function generateHTTPMethod(isForm) {
4503
- return function httpMethod(url, data, config) {
4504
- return this.request(mergeConfig(config || {}, {
4505
- method,
4506
- headers: isForm ? {
4507
- 'Content-Type': 'multipart/form-data'
4508
- } : {},
4509
- url,
4510
- data
4511
- }));
4512
- };
4513
- }
4514
- Axios.prototype[method] = generateHTTPMethod();
4515
- Axios.prototype[method + 'Form'] = generateHTTPMethod(true);
4516
- });
4517
-
4518
- /**
4519
- * A `CancelToken` is an object that can be used to request cancellation of an operation.
4520
- *
4521
- * @param {Function} executor The executor function.
4522
- *
4523
- * @returns {CancelToken}
4524
- */
4525
- class CancelToken {
4526
- constructor(executor) {
4527
- if (typeof executor !== 'function') {
4528
- throw new TypeError('executor must be a function.');
4529
- }
4530
- let resolvePromise;
4531
- this.promise = new Promise(function promiseExecutor(resolve) {
4532
- resolvePromise = resolve;
4533
- });
4534
- const token = this;
4535
-
4536
- // eslint-disable-next-line func-names
4537
- this.promise.then(cancel => {
4538
- if (!token._listeners) return;
4539
- let i = token._listeners.length;
4540
- while (i-- > 0) {
4541
- token._listeners[i](cancel);
4542
- }
4543
- token._listeners = null;
4544
- });
4545
-
4546
- // eslint-disable-next-line func-names
4547
- this.promise.then = onfulfilled => {
4548
- let _resolve;
4549
- // eslint-disable-next-line func-names
4550
- const promise = new Promise(resolve => {
4551
- token.subscribe(resolve);
4552
- _resolve = resolve;
4553
- }).then(onfulfilled);
4554
- promise.cancel = function reject() {
4555
- token.unsubscribe(_resolve);
4556
- };
4557
- return promise;
4558
- };
4559
- executor(function cancel(message, config, request) {
4560
- if (token.reason) {
4561
- // Cancellation has already been requested
4562
- return;
4563
- }
4564
- token.reason = new CanceledError(message, config, request);
4565
- resolvePromise(token.reason);
4566
- });
4567
- }
4568
-
4569
- /**
4570
- * Throws a `CanceledError` if cancellation has been requested.
4571
- */
4572
- throwIfRequested() {
4573
- if (this.reason) {
4574
- throw this.reason;
4575
- }
4576
- }
4577
-
4578
- /**
4579
- * Subscribe to the cancel signal
4580
- */
4581
-
4582
- subscribe(listener) {
4583
- if (this.reason) {
4584
- listener(this.reason);
4585
- return;
4586
- }
4587
- if (this._listeners) {
4588
- this._listeners.push(listener);
4589
- } else {
4590
- this._listeners = [listener];
4591
- }
4592
- }
4593
-
4594
- /**
4595
- * Unsubscribe from the cancel signal
4596
- */
4597
-
4598
- unsubscribe(listener) {
4599
- if (!this._listeners) {
4600
- return;
4601
- }
4602
- const index = this._listeners.indexOf(listener);
4603
- if (index !== -1) {
4604
- this._listeners.splice(index, 1);
4605
- }
4606
- }
4607
- toAbortSignal() {
4608
- const controller = new AbortController();
4609
- const abort = err => {
4610
- controller.abort(err);
4611
- };
4612
- this.subscribe(abort);
4613
- controller.signal.unsubscribe = () => this.unsubscribe(abort);
4614
- return controller.signal;
4615
- }
4616
-
4617
- /**
4618
- * Returns an object that contains a new `CancelToken` and a function that, when called,
4619
- * cancels the `CancelToken`.
4620
- */
4621
- static source() {
4622
- let cancel;
4623
- const token = new CancelToken(function executor(c) {
4624
- cancel = c;
4625
- });
4626
- return {
4627
- token,
4628
- cancel
4629
- };
4630
- }
4631
- }
4632
-
4633
- /**
4634
- * Syntactic sugar for invoking a function and expanding an array for arguments.
4635
- *
4636
- * Common use case would be to use `Function.prototype.apply`.
4637
- *
4638
- * ```js
4639
- * function f(x, y, z) {}
4640
- * const args = [1, 2, 3];
4641
- * f.apply(null, args);
4642
- * ```
4643
- *
4644
- * With `spread` this example can be re-written.
4645
- *
4646
- * ```js
4647
- * spread(function(x, y, z) {})([1, 2, 3]);
4648
- * ```
4649
- *
4650
- * @param {Function} callback
4651
- *
4652
- * @returns {Function}
4653
- */
4654
- function spread(callback) {
4655
- return function wrap(arr) {
4656
- return callback.apply(null, arr);
4657
- };
4658
- }
4659
-
4660
- /**
4661
- * Determines whether the payload is an error thrown by Axios
4662
- *
4663
- * @param {*} payload The value to test
4664
- *
4665
- * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
4666
- */
4667
- function isAxiosError(payload) {
4668
- return utils$1.isObject(payload) && payload.isAxiosError === true;
4669
- }
4670
-
4671
- const HttpStatusCode = {
4672
- Continue: 100,
4673
- SwitchingProtocols: 101,
4674
- Processing: 102,
4675
- EarlyHints: 103,
4676
- Ok: 200,
4677
- Created: 201,
4678
- Accepted: 202,
4679
- NonAuthoritativeInformation: 203,
4680
- NoContent: 204,
4681
- ResetContent: 205,
4682
- PartialContent: 206,
4683
- MultiStatus: 207,
4684
- AlreadyReported: 208,
4685
- ImUsed: 226,
4686
- MultipleChoices: 300,
4687
- MovedPermanently: 301,
4688
- Found: 302,
4689
- SeeOther: 303,
4690
- NotModified: 304,
4691
- UseProxy: 305,
4692
- Unused: 306,
4693
- TemporaryRedirect: 307,
4694
- PermanentRedirect: 308,
4695
- BadRequest: 400,
4696
- Unauthorized: 401,
4697
- PaymentRequired: 402,
4698
- Forbidden: 403,
4699
- NotFound: 404,
4700
- MethodNotAllowed: 405,
4701
- NotAcceptable: 406,
4702
- ProxyAuthenticationRequired: 407,
4703
- RequestTimeout: 408,
4704
- Conflict: 409,
4705
- Gone: 410,
4706
- LengthRequired: 411,
4707
- PreconditionFailed: 412,
4708
- PayloadTooLarge: 413,
4709
- UriTooLong: 414,
4710
- UnsupportedMediaType: 415,
4711
- RangeNotSatisfiable: 416,
4712
- ExpectationFailed: 417,
4713
- ImATeapot: 418,
4714
- MisdirectedRequest: 421,
4715
- UnprocessableEntity: 422,
4716
- Locked: 423,
4717
- FailedDependency: 424,
4718
- TooEarly: 425,
4719
- UpgradeRequired: 426,
4720
- PreconditionRequired: 428,
4721
- TooManyRequests: 429,
4722
- RequestHeaderFieldsTooLarge: 431,
4723
- UnavailableForLegalReasons: 451,
4724
- InternalServerError: 500,
4725
- NotImplemented: 501,
4726
- BadGateway: 502,
4727
- ServiceUnavailable: 503,
4728
- GatewayTimeout: 504,
4729
- HttpVersionNotSupported: 505,
4730
- VariantAlsoNegotiates: 506,
4731
- InsufficientStorage: 507,
4732
- LoopDetected: 508,
4733
- NotExtended: 510,
4734
- NetworkAuthenticationRequired: 511,
4735
- WebServerIsDown: 521,
4736
- ConnectionTimedOut: 522,
4737
- OriginIsUnreachable: 523,
4738
- TimeoutOccurred: 524,
4739
- SslHandshakeFailed: 525,
4740
- InvalidSslCertificate: 526
4741
- };
4742
- Object.entries(HttpStatusCode).forEach(([key, value]) => {
4743
- HttpStatusCode[value] = key;
4744
- });
4745
-
4746
- /**
4747
- * Create an instance of Axios
4748
- *
4749
- * @param {Object} defaultConfig The default config for the instance
4750
- *
4751
- * @returns {Axios} A new instance of Axios
4752
- */
4753
- function createInstance(defaultConfig) {
4754
- const context = new Axios(defaultConfig);
4755
- const instance = bind(Axios.prototype.request, context);
4756
-
4757
- // Copy axios.prototype to instance
4758
- utils$1.extend(instance, Axios.prototype, context, {
4759
- allOwnKeys: true
4760
- });
4761
-
4762
- // Copy context to instance
4763
- utils$1.extend(instance, context, null, {
4764
- allOwnKeys: true
4765
- });
4766
-
4767
- // Factory for creating new instances
4768
- instance.create = function create(instanceConfig) {
4769
- return createInstance(mergeConfig(defaultConfig, instanceConfig));
4770
- };
4771
- return instance;
4772
- }
4773
-
4774
- // Create the default instance to be exported
4775
- const axios = createInstance(defaults);
4776
-
4777
- // Expose Axios class to allow class inheritance
4778
- axios.Axios = Axios;
4779
-
4780
- // Expose Cancel & CancelToken
4781
- axios.CanceledError = CanceledError;
4782
- axios.CancelToken = CancelToken;
4783
- axios.isCancel = isCancel;
4784
- axios.VERSION = VERSION;
4785
- axios.toFormData = toFormData;
4786
-
4787
- // Expose AxiosError class
4788
- axios.AxiosError = AxiosError;
4789
-
4790
- // alias for CanceledError for backward compatibility
4791
- axios.Cancel = axios.CanceledError;
4792
-
4793
- // Expose all/spread
4794
- axios.all = function all(promises) {
4795
- return Promise.all(promises);
4796
- };
4797
- axios.spread = spread;
4798
-
4799
- // Expose isAxiosError
4800
- axios.isAxiosError = isAxiosError;
4801
-
4802
- // Expose mergeConfig
4803
- axios.mergeConfig = mergeConfig;
4804
- axios.AxiosHeaders = AxiosHeaders;
4805
- axios.formToJSON = thing => formDataToJSON(utils$1.isHTMLForm(thing) ? new FormData(thing) : thing);
4806
- axios.getAdapter = adapters.getAdapter;
4807
- axios.HttpStatusCode = HttpStatusCode;
4808
- axios.default = axios;
4809
-
4810
- module.exports = axios;
4811
- //# sourceMappingURL=axios.cjs.map