@wopee-io/wopee.wdio 4.0.0 → 4.6.0

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