@fireberry/sdk 0.0.3 → 0.0.5

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 (304) hide show
  1. package/{node_modules/asynckit/LICENSE → LICENSE.md} +2 -2
  2. package/README.md +85 -37
  3. package/dist/cjs/constants/index.d.ts +13 -0
  4. package/dist/cjs/constants/index.d.ts.map +1 -0
  5. package/dist/cjs/constants/index.js +16 -0
  6. package/dist/cjs/constants/index.js.map +1 -0
  7. package/dist/cjs/context/context.d.ts +7 -0
  8. package/dist/cjs/context/context.d.ts.map +1 -0
  9. package/dist/cjs/context/context.js +11 -0
  10. package/dist/cjs/context/context.js.map +1 -0
  11. package/dist/cjs/context/index.d.ts +2 -0
  12. package/dist/cjs/context/index.d.ts.map +1 -0
  13. package/dist/cjs/context/index.js.map +1 -0
  14. package/dist/cjs/fireberrySDK.client.d.ts +18 -0
  15. package/dist/cjs/fireberrySDK.client.d.ts.map +1 -0
  16. package/dist/cjs/fireberrySDK.client.js +66 -0
  17. package/dist/cjs/fireberrySDK.client.js.map +1 -0
  18. package/dist/cjs/iframeMessageManager.d.ts +12 -0
  19. package/dist/cjs/iframeMessageManager.d.ts.map +1 -0
  20. package/dist/cjs/iframeMessageManager.js +68 -0
  21. package/dist/cjs/iframeMessageManager.js.map +1 -0
  22. package/dist/cjs/types/index.d.ts +67 -0
  23. package/dist/cjs/types/index.d.ts.map +1 -0
  24. package/dist/{src/fireberryAPI/types.js → cjs/types/index.js} +1 -0
  25. package/dist/cjs/types/index.js.map +1 -0
  26. package/dist/esm/constants/index.d.ts +13 -0
  27. package/dist/esm/constants/index.d.ts.map +1 -0
  28. package/dist/esm/constants/index.js +13 -0
  29. package/dist/esm/constants/index.js.map +1 -0
  30. package/dist/esm/context/context.d.ts +7 -0
  31. package/dist/esm/context/context.d.ts.map +1 -0
  32. package/dist/esm/context/context.js +7 -0
  33. package/dist/esm/context/context.js.map +1 -0
  34. package/dist/esm/context/index.d.ts +2 -0
  35. package/dist/esm/context/index.d.ts.map +1 -0
  36. package/dist/esm/context/index.js +2 -0
  37. package/dist/esm/context/index.js.map +1 -0
  38. package/dist/esm/fireberrySDK.client.d.ts +18 -0
  39. package/dist/esm/fireberrySDK.client.d.ts.map +1 -0
  40. package/dist/esm/fireberrySDK.client.js +62 -0
  41. package/dist/esm/fireberrySDK.client.js.map +1 -0
  42. package/dist/esm/iframeMessageManager.d.ts +12 -0
  43. package/dist/esm/iframeMessageManager.d.ts.map +1 -0
  44. package/dist/esm/iframeMessageManager.js +64 -0
  45. package/dist/esm/iframeMessageManager.js.map +1 -0
  46. package/dist/esm/types/index.d.ts +67 -0
  47. package/dist/esm/types/index.d.ts.map +1 -0
  48. package/dist/esm/types/index.js +2 -0
  49. package/dist/esm/types/index.js.map +1 -0
  50. package/package.json +51 -28
  51. package/.eslintrc.json +0 -36
  52. package/.prettierrc.json +0 -7
  53. package/.vscode/settings.json +0 -35
  54. package/dist/base.fireberrySDK.d.ts +0 -7
  55. package/dist/base.fireberrySDK.js +0 -10
  56. package/dist/base.fireberrySDK.js.map +0 -1
  57. package/dist/context/context.d.ts +0 -13
  58. package/dist/context/context.js +0 -22
  59. package/dist/context/context.js.map +0 -1
  60. package/dist/context/context.record.test.d.ts +0 -1
  61. package/dist/context/context.record.test.js +0 -45
  62. package/dist/context/context.record.test.js.map +0 -1
  63. package/dist/context/index.d.ts +0 -5
  64. package/dist/context/index.js.map +0 -1
  65. package/dist/context/record.d.ts +0 -9
  66. package/dist/context/record.js +0 -33
  67. package/dist/context/record.js.map +0 -1
  68. package/dist/context/user.d.ts +0 -5
  69. package/dist/context/user.js +0 -27
  70. package/dist/context/user.js.map +0 -1
  71. package/dist/fireberry.sdk.d.ts +0 -4
  72. package/dist/fireberry.sdk.js +0 -13
  73. package/dist/fireberry.sdk.js.map +0 -1
  74. package/dist/fireberryAPI/fireberryV2Api.d.ts +0 -17
  75. package/dist/fireberryAPI/fireberryV2Api.js +0 -54
  76. package/dist/fireberryAPI/fireberryV2Api.js.map +0 -1
  77. package/dist/fireberryAPI/fireberryV2Api.test.d.ts +0 -1
  78. package/dist/fireberryAPI/fireberryV2Api.test.js +0 -56
  79. package/dist/fireberryAPI/fireberryV2Api.test.js.map +0 -1
  80. package/dist/fireberryAPI/index.d.ts +0 -2
  81. package/dist/fireberryAPI/index.js +0 -21
  82. package/dist/fireberryAPI/index.js.map +0 -1
  83. package/dist/fireberryAPI/types.d.ts +0 -10
  84. package/dist/fireberryAPI/types.js +0 -3
  85. package/dist/fireberryAPI/types.js.map +0 -1
  86. package/dist/fireberrySDK.client.d.ts +0 -5
  87. package/dist/fireberrySDK.client.js +0 -13
  88. package/dist/fireberrySDK.client.js.map +0 -1
  89. package/dist/fireberrySDK.server.d.ts +0 -6
  90. package/dist/fireberrySDK.server.js +0 -12
  91. package/dist/fireberrySDK.server.js.map +0 -1
  92. package/dist/index.d.ts +0 -6
  93. package/dist/index.js +0 -25
  94. package/dist/index.js.map +0 -1
  95. package/dist/jest.config.d.ts +0 -6
  96. package/dist/jest.config.js +0 -11
  97. package/dist/src/context/context.d.ts +0 -13
  98. package/dist/src/context/context.js +0 -21
  99. package/dist/src/context/context.record.test.d.ts +0 -1
  100. package/dist/src/context/context.record.test.js +0 -36
  101. package/dist/src/context/index.d.ts +0 -5
  102. package/dist/src/context/index.js +0 -17
  103. package/dist/src/context/record.d.ts +0 -9
  104. package/dist/src/context/record.js +0 -32
  105. package/dist/src/context/user.d.ts +0 -8
  106. package/dist/src/context/user.js +0 -31
  107. package/dist/src/fireberry.sdk.d.ts +0 -9
  108. package/dist/src/fireberry.sdk.js +0 -14
  109. package/dist/src/fireberryAPI/fireberryV2Api.d.ts +0 -14
  110. package/dist/src/fireberryAPI/fireberryV2Api.js +0 -41
  111. package/dist/src/fireberryAPI/index.d.ts +0 -2
  112. package/dist/src/fireberryAPI/index.js +0 -20
  113. package/dist/src/fireberryAPI/types.d.ts +0 -10
  114. package/dist/src/index.d.ts +0 -9
  115. package/dist/src/index.js +0 -6
  116. package/dist/src/utils/axios.util.d.ts +0 -6
  117. package/dist/src/utils/axios.util.js +0 -24
  118. package/dist/src/utils/index.d.ts +0 -2
  119. package/dist/src/utils/index.js +0 -18
  120. package/dist/src/utils/queryParam.util.d.ts +0 -1
  121. package/dist/src/utils/queryParam.util.js +0 -10
  122. package/dist/utils/axios.util.d.ts +0 -6
  123. package/dist/utils/axios.util.js +0 -24
  124. package/dist/utils/axios.util.js.map +0 -1
  125. package/dist/utils/index.d.ts +0 -2
  126. package/dist/utils/index.js +0 -19
  127. package/dist/utils/index.js.map +0 -1
  128. package/dist/utils/queryParam.util.d.ts +0 -1
  129. package/dist/utils/queryParam.util.js +0 -12
  130. package/dist/utils/queryParam.util.js.map +0 -1
  131. package/jest.config.ts +0 -10
  132. package/node_modules/asynckit/README.md +0 -233
  133. package/node_modules/asynckit/bench.js +0 -76
  134. package/node_modules/asynckit/index.js +0 -6
  135. package/node_modules/asynckit/lib/abort.js +0 -29
  136. package/node_modules/asynckit/lib/async.js +0 -34
  137. package/node_modules/asynckit/lib/defer.js +0 -26
  138. package/node_modules/asynckit/lib/iterate.js +0 -75
  139. package/node_modules/asynckit/lib/readable_asynckit.js +0 -91
  140. package/node_modules/asynckit/lib/readable_parallel.js +0 -25
  141. package/node_modules/asynckit/lib/readable_serial.js +0 -25
  142. package/node_modules/asynckit/lib/readable_serial_ordered.js +0 -29
  143. package/node_modules/asynckit/lib/state.js +0 -37
  144. package/node_modules/asynckit/lib/streamify.js +0 -141
  145. package/node_modules/asynckit/lib/terminator.js +0 -29
  146. package/node_modules/asynckit/package.json +0 -63
  147. package/node_modules/asynckit/parallel.js +0 -43
  148. package/node_modules/asynckit/serial.js +0 -17
  149. package/node_modules/asynckit/serialOrdered.js +0 -75
  150. package/node_modules/asynckit/stream.js +0 -21
  151. package/node_modules/axios/CHANGELOG.md +0 -874
  152. package/node_modules/axios/LICENSE +0 -7
  153. package/node_modules/axios/MIGRATION_GUIDE.md +0 -3
  154. package/node_modules/axios/README.md +0 -1650
  155. package/node_modules/axios/SECURITY.md +0 -6
  156. package/node_modules/axios/dist/axios.js +0 -3448
  157. package/node_modules/axios/dist/axios.js.map +0 -1
  158. package/node_modules/axios/dist/axios.min.js +0 -2
  159. package/node_modules/axios/dist/axios.min.js.map +0 -1
  160. package/node_modules/axios/dist/browser/axios.cjs +0 -3258
  161. package/node_modules/axios/dist/browser/axios.cjs.map +0 -1
  162. package/node_modules/axios/dist/esm/axios.js +0 -3281
  163. package/node_modules/axios/dist/esm/axios.js.map +0 -1
  164. package/node_modules/axios/dist/esm/axios.min.js +0 -2
  165. package/node_modules/axios/dist/esm/axios.min.js.map +0 -1
  166. package/node_modules/axios/dist/node/axios.cjs +0 -4354
  167. package/node_modules/axios/dist/node/axios.cjs.map +0 -1
  168. package/node_modules/axios/index.d.cts +0 -542
  169. package/node_modules/axios/index.d.ts +0 -559
  170. package/node_modules/axios/index.js +0 -43
  171. package/node_modules/axios/lib/adapters/README.md +0 -37
  172. package/node_modules/axios/lib/adapters/adapters.js +0 -77
  173. package/node_modules/axios/lib/adapters/http.js +0 -685
  174. package/node_modules/axios/lib/adapters/xhr.js +0 -260
  175. package/node_modules/axios/lib/axios.js +0 -89
  176. package/node_modules/axios/lib/cancel/CancelToken.js +0 -121
  177. package/node_modules/axios/lib/cancel/CanceledError.js +0 -25
  178. package/node_modules/axios/lib/cancel/isCancel.js +0 -5
  179. package/node_modules/axios/lib/core/Axios.js +0 -225
  180. package/node_modules/axios/lib/core/AxiosError.js +0 -100
  181. package/node_modules/axios/lib/core/AxiosHeaders.js +0 -298
  182. package/node_modules/axios/lib/core/InterceptorManager.js +0 -71
  183. package/node_modules/axios/lib/core/README.md +0 -8
  184. package/node_modules/axios/lib/core/buildFullPath.js +0 -21
  185. package/node_modules/axios/lib/core/dispatchRequest.js +0 -81
  186. package/node_modules/axios/lib/core/mergeConfig.js +0 -106
  187. package/node_modules/axios/lib/core/settle.js +0 -27
  188. package/node_modules/axios/lib/core/transformData.js +0 -28
  189. package/node_modules/axios/lib/defaults/index.js +0 -156
  190. package/node_modules/axios/lib/defaults/transitional.js +0 -7
  191. package/node_modules/axios/lib/env/README.md +0 -3
  192. package/node_modules/axios/lib/env/classes/FormData.js +0 -2
  193. package/node_modules/axios/lib/env/data.js +0 -1
  194. package/node_modules/axios/lib/helpers/AxiosTransformStream.js +0 -191
  195. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -58
  196. package/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -71
  197. package/node_modules/axios/lib/helpers/README.md +0 -7
  198. package/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +0 -28
  199. package/node_modules/axios/lib/helpers/bind.js +0 -7
  200. package/node_modules/axios/lib/helpers/buildURL.js +0 -63
  201. package/node_modules/axios/lib/helpers/callbackify.js +0 -16
  202. package/node_modules/axios/lib/helpers/combineURLs.js +0 -15
  203. package/node_modules/axios/lib/helpers/cookies.js +0 -42
  204. package/node_modules/axios/lib/helpers/deprecatedMethod.js +0 -26
  205. package/node_modules/axios/lib/helpers/formDataToJSON.js +0 -95
  206. package/node_modules/axios/lib/helpers/formDataToStream.js +0 -111
  207. package/node_modules/axios/lib/helpers/fromDataURI.js +0 -53
  208. package/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -15
  209. package/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
  210. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -67
  211. package/node_modules/axios/lib/helpers/null.js +0 -2
  212. package/node_modules/axios/lib/helpers/parseHeaders.js +0 -55
  213. package/node_modules/axios/lib/helpers/parseProtocol.js +0 -6
  214. package/node_modules/axios/lib/helpers/readBlob.js +0 -15
  215. package/node_modules/axios/lib/helpers/speedometer.js +0 -55
  216. package/node_modules/axios/lib/helpers/spread.js +0 -28
  217. package/node_modules/axios/lib/helpers/throttle.js +0 -33
  218. package/node_modules/axios/lib/helpers/toFormData.js +0 -219
  219. package/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -18
  220. package/node_modules/axios/lib/helpers/validator.js +0 -91
  221. package/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -3
  222. package/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -3
  223. package/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -4
  224. package/node_modules/axios/lib/platform/browser/index.js +0 -13
  225. package/node_modules/axios/lib/platform/common/utils.js +0 -47
  226. package/node_modules/axios/lib/platform/index.js +0 -7
  227. package/node_modules/axios/lib/platform/node/classes/FormData.js +0 -3
  228. package/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +0 -4
  229. package/node_modules/axios/lib/platform/node/index.js +0 -12
  230. package/node_modules/axios/lib/utils.js +0 -723
  231. package/node_modules/axios/package.json +0 -218
  232. package/node_modules/combined-stream/License +0 -19
  233. package/node_modules/combined-stream/Readme.md +0 -138
  234. package/node_modules/combined-stream/lib/combined_stream.js +0 -208
  235. package/node_modules/combined-stream/package.json +0 -25
  236. package/node_modules/delayed-stream/.npmignore +0 -1
  237. package/node_modules/delayed-stream/License +0 -19
  238. package/node_modules/delayed-stream/Makefile +0 -7
  239. package/node_modules/delayed-stream/Readme.md +0 -141
  240. package/node_modules/delayed-stream/lib/delayed_stream.js +0 -107
  241. package/node_modules/delayed-stream/package.json +0 -27
  242. package/node_modules/dotenv/CHANGELOG.md +0 -475
  243. package/node_modules/dotenv/LICENSE +0 -23
  244. package/node_modules/dotenv/README-es.md +0 -448
  245. package/node_modules/dotenv/README.md +0 -728
  246. package/node_modules/dotenv/config.d.ts +0 -1
  247. package/node_modules/dotenv/config.js +0 -9
  248. package/node_modules/dotenv/lib/cli-options.js +0 -11
  249. package/node_modules/dotenv/lib/env-options.js +0 -24
  250. package/node_modules/dotenv/lib/main.d.ts +0 -153
  251. package/node_modules/dotenv/lib/main.js +0 -361
  252. package/node_modules/dotenv/package.json +0 -65
  253. package/node_modules/follow-redirects/LICENSE +0 -18
  254. package/node_modules/follow-redirects/README.md +0 -155
  255. package/node_modules/follow-redirects/debug.js +0 -15
  256. package/node_modules/follow-redirects/http.js +0 -1
  257. package/node_modules/follow-redirects/https.js +0 -1
  258. package/node_modules/follow-redirects/index.js +0 -672
  259. package/node_modules/follow-redirects/package.json +0 -58
  260. package/node_modules/form-data/License +0 -19
  261. package/node_modules/form-data/README.md.bak +0 -358
  262. package/node_modules/form-data/Readme.md +0 -358
  263. package/node_modules/form-data/index.d.ts +0 -62
  264. package/node_modules/form-data/lib/browser.js +0 -2
  265. package/node_modules/form-data/lib/form_data.js +0 -501
  266. package/node_modules/form-data/lib/populate.js +0 -10
  267. package/node_modules/form-data/package.json +0 -68
  268. package/node_modules/mime-db/HISTORY.md +0 -507
  269. package/node_modules/mime-db/LICENSE +0 -23
  270. package/node_modules/mime-db/README.md +0 -100
  271. package/node_modules/mime-db/db.json +0 -8519
  272. package/node_modules/mime-db/index.js +0 -12
  273. package/node_modules/mime-db/package.json +0 -60
  274. package/node_modules/mime-types/HISTORY.md +0 -397
  275. package/node_modules/mime-types/LICENSE +0 -23
  276. package/node_modules/mime-types/README.md +0 -113
  277. package/node_modules/mime-types/index.js +0 -188
  278. package/node_modules/mime-types/package.json +0 -44
  279. package/node_modules/proxy-from-env/.eslintrc +0 -29
  280. package/node_modules/proxy-from-env/.travis.yml +0 -10
  281. package/node_modules/proxy-from-env/LICENSE +0 -20
  282. package/node_modules/proxy-from-env/README.md +0 -131
  283. package/node_modules/proxy-from-env/index.js +0 -108
  284. package/node_modules/proxy-from-env/package.json +0 -34
  285. package/node_modules/proxy-from-env/test.js +0 -483
  286. package/src/base.fireberrySDK.ts +0 -7
  287. package/src/context/context.record.test.ts +0 -47
  288. package/src/context/context.ts +0 -28
  289. package/src/context/index.ts +0 -6
  290. package/src/context/record.ts +0 -22
  291. package/src/context/user.ts +0 -15
  292. package/src/fireberry.sdk.ts +0 -14
  293. package/src/fireberryAPI/fireberryV2Api.test.ts +0 -57
  294. package/src/fireberryAPI/fireberryV2Api.ts +0 -61
  295. package/src/fireberryAPI/index.ts +0 -2
  296. package/src/fireberryAPI/types.ts +0 -10
  297. package/src/fireberrySDK.client.ts +0 -10
  298. package/src/fireberrySDK.server.ts +0 -8
  299. package/src/index.ts +0 -9
  300. package/src/utils/axios.util.ts +0 -20
  301. package/src/utils/index.ts +0 -2
  302. package/src/utils/queryParam.util.ts +0 -8
  303. package/tsconfig.json +0 -123
  304. /package/dist/{context → cjs/context}/index.js +0 -0
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- import isAbsoluteURL from '../helpers/isAbsoluteURL.js';
4
- import combineURLs from '../helpers/combineURLs.js';
5
-
6
- /**
7
- * Creates a new URL by combining the baseURL with the requestedURL,
8
- * only when the requestedURL is not already an absolute URL.
9
- * If the requestURL is absolute, this function returns the requestedURL untouched.
10
- *
11
- * @param {string} baseURL The base URL
12
- * @param {string} requestedURL Absolute or relative URL to combine
13
- *
14
- * @returns {string} The combined full path
15
- */
16
- export default function buildFullPath(baseURL, requestedURL) {
17
- if (baseURL && !isAbsoluteURL(requestedURL)) {
18
- return combineURLs(baseURL, requestedURL);
19
- }
20
- return requestedURL;
21
- }
@@ -1,81 +0,0 @@
1
- 'use strict';
2
-
3
- import transformData from './transformData.js';
4
- import isCancel from '../cancel/isCancel.js';
5
- import defaults from '../defaults/index.js';
6
- import CanceledError from '../cancel/CanceledError.js';
7
- import AxiosHeaders from '../core/AxiosHeaders.js';
8
- import adapters from "../adapters/adapters.js";
9
-
10
- /**
11
- * Throws a `CanceledError` if cancellation has been requested.
12
- *
13
- * @param {Object} config The config that is to be used for the request
14
- *
15
- * @returns {void}
16
- */
17
- function throwIfCancellationRequested(config) {
18
- if (config.cancelToken) {
19
- config.cancelToken.throwIfRequested();
20
- }
21
-
22
- if (config.signal && config.signal.aborted) {
23
- throw new CanceledError(null, config);
24
- }
25
- }
26
-
27
- /**
28
- * Dispatch a request to the server using the configured adapter.
29
- *
30
- * @param {object} config The config that is to be used for the request
31
- *
32
- * @returns {Promise} The Promise to be fulfilled
33
- */
34
- export default function dispatchRequest(config) {
35
- throwIfCancellationRequested(config);
36
-
37
- config.headers = AxiosHeaders.from(config.headers);
38
-
39
- // Transform request data
40
- config.data = transformData.call(
41
- config,
42
- config.transformRequest
43
- );
44
-
45
- if (['post', 'put', 'patch'].indexOf(config.method) !== -1) {
46
- config.headers.setContentType('application/x-www-form-urlencoded', false);
47
- }
48
-
49
- const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
50
-
51
- return adapter(config).then(function onAdapterResolution(response) {
52
- throwIfCancellationRequested(config);
53
-
54
- // Transform response data
55
- response.data = transformData.call(
56
- config,
57
- config.transformResponse,
58
- response
59
- );
60
-
61
- response.headers = AxiosHeaders.from(response.headers);
62
-
63
- return response;
64
- }, function onAdapterRejection(reason) {
65
- if (!isCancel(reason)) {
66
- throwIfCancellationRequested(config);
67
-
68
- // Transform response data
69
- if (reason && reason.response) {
70
- reason.response.data = transformData.call(
71
- config,
72
- config.transformResponse,
73
- reason.response
74
- );
75
- reason.response.headers = AxiosHeaders.from(reason.response.headers);
76
- }
77
- }
78
-
79
- return Promise.reject(reason);
80
- });
81
- }
@@ -1,106 +0,0 @@
1
- 'use strict';
2
-
3
- import utils from '../utils.js';
4
- import AxiosHeaders from "./AxiosHeaders.js";
5
-
6
- const headersToObject = (thing) => thing instanceof AxiosHeaders ? { ...thing } : thing;
7
-
8
- /**
9
- * Config-specific merge-function which creates a new config-object
10
- * by merging two configuration objects together.
11
- *
12
- * @param {Object} config1
13
- * @param {Object} config2
14
- *
15
- * @returns {Object} New object resulting from merging config2 to config1
16
- */
17
- export default function mergeConfig(config1, config2) {
18
- // eslint-disable-next-line no-param-reassign
19
- config2 = config2 || {};
20
- const config = {};
21
-
22
- function getMergedValue(target, source, caseless) {
23
- if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
24
- return utils.merge.call({caseless}, target, source);
25
- } else if (utils.isPlainObject(source)) {
26
- return utils.merge({}, source);
27
- } else if (utils.isArray(source)) {
28
- return source.slice();
29
- }
30
- return source;
31
- }
32
-
33
- // eslint-disable-next-line consistent-return
34
- function mergeDeepProperties(a, b, caseless) {
35
- if (!utils.isUndefined(b)) {
36
- return getMergedValue(a, b, caseless);
37
- } else if (!utils.isUndefined(a)) {
38
- return getMergedValue(undefined, a, caseless);
39
- }
40
- }
41
-
42
- // eslint-disable-next-line consistent-return
43
- function valueFromConfig2(a, b) {
44
- if (!utils.isUndefined(b)) {
45
- return getMergedValue(undefined, b);
46
- }
47
- }
48
-
49
- // eslint-disable-next-line consistent-return
50
- function defaultToConfig2(a, b) {
51
- if (!utils.isUndefined(b)) {
52
- return getMergedValue(undefined, b);
53
- } else if (!utils.isUndefined(a)) {
54
- return getMergedValue(undefined, a);
55
- }
56
- }
57
-
58
- // eslint-disable-next-line consistent-return
59
- function mergeDirectKeys(a, b, prop) {
60
- if (prop in config2) {
61
- return getMergedValue(a, b);
62
- } else if (prop in config1) {
63
- return getMergedValue(undefined, a);
64
- }
65
- }
66
-
67
- const mergeMap = {
68
- url: valueFromConfig2,
69
- method: valueFromConfig2,
70
- data: valueFromConfig2,
71
- baseURL: defaultToConfig2,
72
- transformRequest: defaultToConfig2,
73
- transformResponse: defaultToConfig2,
74
- paramsSerializer: defaultToConfig2,
75
- timeout: defaultToConfig2,
76
- timeoutMessage: defaultToConfig2,
77
- withCredentials: defaultToConfig2,
78
- withXSRFToken: defaultToConfig2,
79
- adapter: defaultToConfig2,
80
- responseType: defaultToConfig2,
81
- xsrfCookieName: defaultToConfig2,
82
- xsrfHeaderName: defaultToConfig2,
83
- onUploadProgress: defaultToConfig2,
84
- onDownloadProgress: defaultToConfig2,
85
- decompress: defaultToConfig2,
86
- maxContentLength: defaultToConfig2,
87
- maxBodyLength: defaultToConfig2,
88
- beforeRedirect: defaultToConfig2,
89
- transport: defaultToConfig2,
90
- httpAgent: defaultToConfig2,
91
- httpsAgent: defaultToConfig2,
92
- cancelToken: defaultToConfig2,
93
- socketPath: defaultToConfig2,
94
- responseEncoding: defaultToConfig2,
95
- validateStatus: mergeDirectKeys,
96
- headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
97
- };
98
-
99
- utils.forEach(Object.keys(Object.assign({}, config1, config2)), function computeConfigValue(prop) {
100
- const merge = mergeMap[prop] || mergeDeepProperties;
101
- const configValue = merge(config1[prop], config2[prop], prop);
102
- (utils.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
103
- });
104
-
105
- return config;
106
- }
@@ -1,27 +0,0 @@
1
- 'use strict';
2
-
3
- import AxiosError from './AxiosError.js';
4
-
5
- /**
6
- * Resolve or reject a Promise based on response status.
7
- *
8
- * @param {Function} resolve A function that resolves the promise.
9
- * @param {Function} reject A function that rejects the promise.
10
- * @param {object} response The response.
11
- *
12
- * @returns {object} The response.
13
- */
14
- export default function settle(resolve, reject, response) {
15
- const validateStatus = response.config.validateStatus;
16
- if (!response.status || !validateStatus || validateStatus(response.status)) {
17
- resolve(response);
18
- } else {
19
- reject(new AxiosError(
20
- 'Request failed with status code ' + response.status,
21
- [AxiosError.ERR_BAD_REQUEST, AxiosError.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
22
- response.config,
23
- response.request,
24
- response
25
- ));
26
- }
27
- }
@@ -1,28 +0,0 @@
1
- 'use strict';
2
-
3
- import utils from './../utils.js';
4
- import defaults from '../defaults/index.js';
5
- import AxiosHeaders from '../core/AxiosHeaders.js';
6
-
7
- /**
8
- * Transform the data for a request or a response
9
- *
10
- * @param {Array|Function} fns A single function or Array of functions
11
- * @param {?Object} response The response object
12
- *
13
- * @returns {*} The resulting transformed data
14
- */
15
- export default function transformData(fns, response) {
16
- const config = this || defaults;
17
- const context = response || config;
18
- const headers = AxiosHeaders.from(context.headers);
19
- let data = context.data;
20
-
21
- utils.forEach(fns, function transform(fn) {
22
- data = fn.call(config, data, headers.normalize(), response ? response.status : undefined);
23
- });
24
-
25
- headers.normalize();
26
-
27
- return data;
28
- }
@@ -1,156 +0,0 @@
1
- 'use strict';
2
-
3
- import utils from '../utils.js';
4
- import AxiosError from '../core/AxiosError.js';
5
- import transitionalDefaults from './transitional.js';
6
- import toFormData from '../helpers/toFormData.js';
7
- import toURLEncodedForm from '../helpers/toURLEncodedForm.js';
8
- import platform from '../platform/index.js';
9
- import formDataToJSON from '../helpers/formDataToJSON.js';
10
-
11
- /**
12
- * It takes a string, tries to parse it, and if it fails, it returns the stringified version
13
- * of the input
14
- *
15
- * @param {any} rawValue - The value to be stringified.
16
- * @param {Function} parser - A function that parses a string into a JavaScript object.
17
- * @param {Function} encoder - A function that takes a value and returns a string.
18
- *
19
- * @returns {string} A stringified version of the rawValue.
20
- */
21
- function stringifySafely(rawValue, parser, encoder) {
22
- if (utils.isString(rawValue)) {
23
- try {
24
- (parser || JSON.parse)(rawValue);
25
- return utils.trim(rawValue);
26
- } catch (e) {
27
- if (e.name !== 'SyntaxError') {
28
- throw e;
29
- }
30
- }
31
- }
32
-
33
- return (encoder || JSON.stringify)(rawValue);
34
- }
35
-
36
- const defaults = {
37
-
38
- transitional: transitionalDefaults,
39
-
40
- adapter: ['xhr', 'http'],
41
-
42
- transformRequest: [function transformRequest(data, headers) {
43
- const contentType = headers.getContentType() || '';
44
- const hasJSONContentType = contentType.indexOf('application/json') > -1;
45
- const isObjectPayload = utils.isObject(data);
46
-
47
- if (isObjectPayload && utils.isHTMLForm(data)) {
48
- data = new FormData(data);
49
- }
50
-
51
- const isFormData = utils.isFormData(data);
52
-
53
- if (isFormData) {
54
- return hasJSONContentType ? JSON.stringify(formDataToJSON(data)) : data;
55
- }
56
-
57
- if (utils.isArrayBuffer(data) ||
58
- utils.isBuffer(data) ||
59
- utils.isStream(data) ||
60
- utils.isFile(data) ||
61
- utils.isBlob(data)
62
- ) {
63
- return data;
64
- }
65
- if (utils.isArrayBufferView(data)) {
66
- return data.buffer;
67
- }
68
- if (utils.isURLSearchParams(data)) {
69
- headers.setContentType('application/x-www-form-urlencoded;charset=utf-8', false);
70
- return data.toString();
71
- }
72
-
73
- let isFileList;
74
-
75
- if (isObjectPayload) {
76
- if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
77
- return toURLEncodedForm(data, this.formSerializer).toString();
78
- }
79
-
80
- if ((isFileList = utils.isFileList(data)) || contentType.indexOf('multipart/form-data') > -1) {
81
- const _FormData = this.env && this.env.FormData;
82
-
83
- return toFormData(
84
- isFileList ? {'files[]': data} : data,
85
- _FormData && new _FormData(),
86
- this.formSerializer
87
- );
88
- }
89
- }
90
-
91
- if (isObjectPayload || hasJSONContentType ) {
92
- headers.setContentType('application/json', false);
93
- return stringifySafely(data);
94
- }
95
-
96
- return data;
97
- }],
98
-
99
- transformResponse: [function transformResponse(data) {
100
- const transitional = this.transitional || defaults.transitional;
101
- const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
102
- const JSONRequested = this.responseType === 'json';
103
-
104
- if (data && utils.isString(data) && ((forcedJSONParsing && !this.responseType) || JSONRequested)) {
105
- const silentJSONParsing = transitional && transitional.silentJSONParsing;
106
- const strictJSONParsing = !silentJSONParsing && JSONRequested;
107
-
108
- try {
109
- return JSON.parse(data);
110
- } catch (e) {
111
- if (strictJSONParsing) {
112
- if (e.name === 'SyntaxError') {
113
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
114
- }
115
- throw e;
116
- }
117
- }
118
- }
119
-
120
- return data;
121
- }],
122
-
123
- /**
124
- * A timeout in milliseconds to abort a request. If set to 0 (default) a
125
- * timeout is not created.
126
- */
127
- timeout: 0,
128
-
129
- xsrfCookieName: 'XSRF-TOKEN',
130
- xsrfHeaderName: 'X-XSRF-TOKEN',
131
-
132
- maxContentLength: -1,
133
- maxBodyLength: -1,
134
-
135
- env: {
136
- FormData: platform.classes.FormData,
137
- Blob: platform.classes.Blob
138
- },
139
-
140
- validateStatus: function validateStatus(status) {
141
- return status >= 200 && status < 300;
142
- },
143
-
144
- headers: {
145
- common: {
146
- 'Accept': 'application/json, text/plain, */*',
147
- 'Content-Type': undefined
148
- }
149
- }
150
- };
151
-
152
- utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
153
- defaults.headers[method] = {};
154
- });
155
-
156
- export default defaults;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- export default {
4
- silentJSONParsing: true,
5
- forcedJSONParsing: true,
6
- clarifyTimeoutError: false
7
- };
@@ -1,3 +0,0 @@
1
- # axios // env
2
-
3
- The `data.js` file is updated automatically when the package version is upgrading. Please do not edit it manually.
@@ -1,2 +0,0 @@
1
- import _FormData from 'form-data';
2
- export default typeof FormData !== 'undefined' ? FormData : _FormData;
@@ -1 +0,0 @@
1
- export const VERSION = "1.6.8";
@@ -1,191 +0,0 @@
1
- 'use strict';
2
-
3
- import stream from 'stream';
4
- import utils from '../utils.js';
5
- import throttle from './throttle.js';
6
- import speedometer from './speedometer.js';
7
-
8
- const kInternals = Symbol('internals');
9
-
10
- class AxiosTransformStream extends stream.Transform{
11
- constructor(options) {
12
- options = utils.toFlatObject(options, {
13
- maxRate: 0,
14
- chunkSize: 64 * 1024,
15
- minChunkSize: 100,
16
- timeWindow: 500,
17
- ticksRate: 2,
18
- samplesCount: 15
19
- }, null, (prop, source) => {
20
- return !utils.isUndefined(source[prop]);
21
- });
22
-
23
- super({
24
- readableHighWaterMark: options.chunkSize
25
- });
26
-
27
- const self = this;
28
-
29
- const internals = this[kInternals] = {
30
- length: options.length,
31
- timeWindow: options.timeWindow,
32
- ticksRate: options.ticksRate,
33
- chunkSize: options.chunkSize,
34
- maxRate: options.maxRate,
35
- minChunkSize: options.minChunkSize,
36
- bytesSeen: 0,
37
- isCaptured: false,
38
- notifiedBytesLoaded: 0,
39
- ts: Date.now(),
40
- bytes: 0,
41
- onReadCallback: null
42
- };
43
-
44
- const _speedometer = speedometer(internals.ticksRate * options.samplesCount, internals.timeWindow);
45
-
46
- this.on('newListener', event => {
47
- if (event === 'progress') {
48
- if (!internals.isCaptured) {
49
- internals.isCaptured = true;
50
- }
51
- }
52
- });
53
-
54
- let bytesNotified = 0;
55
-
56
- internals.updateProgress = throttle(function throttledHandler() {
57
- const totalBytes = internals.length;
58
- const bytesTransferred = internals.bytesSeen;
59
- const progressBytes = bytesTransferred - bytesNotified;
60
- if (!progressBytes || self.destroyed) return;
61
-
62
- const rate = _speedometer(progressBytes);
63
-
64
- bytesNotified = bytesTransferred;
65
-
66
- process.nextTick(() => {
67
- self.emit('progress', {
68
- 'loaded': bytesTransferred,
69
- 'total': totalBytes,
70
- 'progress': totalBytes ? (bytesTransferred / totalBytes) : undefined,
71
- 'bytes': progressBytes,
72
- 'rate': rate ? rate : undefined,
73
- 'estimated': rate && totalBytes && bytesTransferred <= totalBytes ?
74
- (totalBytes - bytesTransferred) / rate : undefined
75
- });
76
- });
77
- }, internals.ticksRate);
78
-
79
- const onFinish = () => {
80
- internals.updateProgress(true);
81
- };
82
-
83
- this.once('end', onFinish);
84
- this.once('error', onFinish);
85
- }
86
-
87
- _read(size) {
88
- const internals = this[kInternals];
89
-
90
- if (internals.onReadCallback) {
91
- internals.onReadCallback();
92
- }
93
-
94
- return super._read(size);
95
- }
96
-
97
- _transform(chunk, encoding, callback) {
98
- const self = this;
99
- const internals = this[kInternals];
100
- const maxRate = internals.maxRate;
101
-
102
- const readableHighWaterMark = this.readableHighWaterMark;
103
-
104
- const timeWindow = internals.timeWindow;
105
-
106
- const divider = 1000 / timeWindow;
107
- const bytesThreshold = (maxRate / divider);
108
- const minChunkSize = internals.minChunkSize !== false ? Math.max(internals.minChunkSize, bytesThreshold * 0.01) : 0;
109
-
110
- function pushChunk(_chunk, _callback) {
111
- const bytes = Buffer.byteLength(_chunk);
112
- internals.bytesSeen += bytes;
113
- internals.bytes += bytes;
114
-
115
- if (internals.isCaptured) {
116
- internals.updateProgress();
117
- }
118
-
119
- if (self.push(_chunk)) {
120
- process.nextTick(_callback);
121
- } else {
122
- internals.onReadCallback = () => {
123
- internals.onReadCallback = null;
124
- process.nextTick(_callback);
125
- };
126
- }
127
- }
128
-
129
- const transformChunk = (_chunk, _callback) => {
130
- const chunkSize = Buffer.byteLength(_chunk);
131
- let chunkRemainder = null;
132
- let maxChunkSize = readableHighWaterMark;
133
- let bytesLeft;
134
- let passed = 0;
135
-
136
- if (maxRate) {
137
- const now = Date.now();
138
-
139
- if (!internals.ts || (passed = (now - internals.ts)) >= timeWindow) {
140
- internals.ts = now;
141
- bytesLeft = bytesThreshold - internals.bytes;
142
- internals.bytes = bytesLeft < 0 ? -bytesLeft : 0;
143
- passed = 0;
144
- }
145
-
146
- bytesLeft = bytesThreshold - internals.bytes;
147
- }
148
-
149
- if (maxRate) {
150
- if (bytesLeft <= 0) {
151
- // next time window
152
- return setTimeout(() => {
153
- _callback(null, _chunk);
154
- }, timeWindow - passed);
155
- }
156
-
157
- if (bytesLeft < maxChunkSize) {
158
- maxChunkSize = bytesLeft;
159
- }
160
- }
161
-
162
- if (maxChunkSize && chunkSize > maxChunkSize && (chunkSize - maxChunkSize) > minChunkSize) {
163
- chunkRemainder = _chunk.subarray(maxChunkSize);
164
- _chunk = _chunk.subarray(0, maxChunkSize);
165
- }
166
-
167
- pushChunk(_chunk, chunkRemainder ? () => {
168
- process.nextTick(_callback, null, chunkRemainder);
169
- } : _callback);
170
- };
171
-
172
- transformChunk(chunk, function transformNextChunk(err, _chunk) {
173
- if (err) {
174
- return callback(err);
175
- }
176
-
177
- if (_chunk) {
178
- transformChunk(_chunk, transformNextChunk);
179
- } else {
180
- callback(null);
181
- }
182
- });
183
- }
184
-
185
- setLength(length) {
186
- this[kInternals].length = +length;
187
- return this;
188
- }
189
- }
190
-
191
- export default AxiosTransformStream;
@@ -1,58 +0,0 @@
1
- 'use strict';
2
-
3
- import toFormData from './toFormData.js';
4
-
5
- /**
6
- * It encodes a string by replacing all characters that are not in the unreserved set with
7
- * their percent-encoded equivalents
8
- *
9
- * @param {string} str - The string to encode.
10
- *
11
- * @returns {string} The encoded string.
12
- */
13
- function encode(str) {
14
- const charMap = {
15
- '!': '%21',
16
- "'": '%27',
17
- '(': '%28',
18
- ')': '%29',
19
- '~': '%7E',
20
- '%20': '+',
21
- '%00': '\x00'
22
- };
23
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
24
- return charMap[match];
25
- });
26
- }
27
-
28
- /**
29
- * It takes a params object and converts it to a FormData object
30
- *
31
- * @param {Object<string, any>} params - The parameters to be converted to a FormData object.
32
- * @param {Object<string, any>} options - The options object passed to the Axios constructor.
33
- *
34
- * @returns {void}
35
- */
36
- function AxiosURLSearchParams(params, options) {
37
- this._pairs = [];
38
-
39
- params && toFormData(params, this, options);
40
- }
41
-
42
- const prototype = AxiosURLSearchParams.prototype;
43
-
44
- prototype.append = function append(name, value) {
45
- this._pairs.push([name, value]);
46
- };
47
-
48
- prototype.toString = function toString(encoder) {
49
- const _encode = encoder ? function(value) {
50
- return encoder.call(this, value, encode);
51
- } : encode;
52
-
53
- return this._pairs.map(function each(pair) {
54
- return _encode(pair[0]) + '=' + _encode(pair[1]);
55
- }, '').join('&');
56
- };
57
-
58
- export default AxiosURLSearchParams;