@fireberry/sdk 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/{node_modules/asynckit/LICENSE → LICENSE.md} +2 -2
  2. package/README.md +136 -37
  3. package/dist/cjs/constants/index.d.ts +18 -0
  4. package/dist/cjs/constants/index.d.ts.map +1 -0
  5. package/dist/cjs/constants/index.js +21 -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 +32 -0
  15. package/dist/cjs/fireberrySDK.client.d.ts.map +1 -0
  16. package/dist/cjs/fireberrySDK.client.js +102 -0
  17. package/dist/cjs/fireberrySDK.client.js.map +1 -0
  18. package/dist/cjs/iframeMessageManager.d.ts +13 -0
  19. package/dist/cjs/iframeMessageManager.d.ts.map +1 -0
  20. package/dist/cjs/iframeMessageManager.js +88 -0
  21. package/dist/cjs/iframeMessageManager.js.map +1 -0
  22. package/dist/cjs/types/index.d.ts +86 -0
  23. package/dist/cjs/types/index.d.ts.map +1 -0
  24. package/dist/{fireberryAPI/types.js → cjs/types/index.js} +1 -1
  25. package/dist/cjs/types/index.js.map +1 -0
  26. package/dist/esm/constants/index.d.ts +18 -0
  27. package/dist/esm/constants/index.d.ts.map +1 -0
  28. package/dist/esm/constants/index.js +18 -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 +32 -0
  39. package/dist/esm/fireberrySDK.client.d.ts.map +1 -0
  40. package/dist/esm/fireberrySDK.client.js +98 -0
  41. package/dist/esm/fireberrySDK.client.js.map +1 -0
  42. package/dist/esm/iframeMessageManager.d.ts +13 -0
  43. package/dist/esm/iframeMessageManager.d.ts.map +1 -0
  44. package/dist/esm/iframeMessageManager.js +84 -0
  45. package/dist/esm/iframeMessageManager.js.map +1 -0
  46. package/dist/esm/types/index.d.ts +86 -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 +54 -27
  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.map +0 -1
  85. package/dist/fireberrySDK.client.d.ts +0 -5
  86. package/dist/fireberrySDK.client.js +0 -13
  87. package/dist/fireberrySDK.client.js.map +0 -1
  88. package/dist/fireberrySDK.server.d.ts +0 -6
  89. package/dist/fireberrySDK.server.js +0 -12
  90. package/dist/fireberrySDK.server.js.map +0 -1
  91. package/dist/index.d.ts +0 -6
  92. package/dist/index.js +0 -25
  93. package/dist/index.js.map +0 -1
  94. package/dist/utils/axios.util.d.ts +0 -6
  95. package/dist/utils/axios.util.js +0 -24
  96. package/dist/utils/axios.util.js.map +0 -1
  97. package/dist/utils/index.d.ts +0 -2
  98. package/dist/utils/index.js +0 -19
  99. package/dist/utils/index.js.map +0 -1
  100. package/dist/utils/queryParam.util.d.ts +0 -1
  101. package/dist/utils/queryParam.util.js +0 -12
  102. package/dist/utils/queryParam.util.js.map +0 -1
  103. package/jest.config.ts +0 -10
  104. package/node_modules/asynckit/README.md +0 -233
  105. package/node_modules/asynckit/bench.js +0 -76
  106. package/node_modules/asynckit/index.js +0 -6
  107. package/node_modules/asynckit/lib/abort.js +0 -29
  108. package/node_modules/asynckit/lib/async.js +0 -34
  109. package/node_modules/asynckit/lib/defer.js +0 -26
  110. package/node_modules/asynckit/lib/iterate.js +0 -75
  111. package/node_modules/asynckit/lib/readable_asynckit.js +0 -91
  112. package/node_modules/asynckit/lib/readable_parallel.js +0 -25
  113. package/node_modules/asynckit/lib/readable_serial.js +0 -25
  114. package/node_modules/asynckit/lib/readable_serial_ordered.js +0 -29
  115. package/node_modules/asynckit/lib/state.js +0 -37
  116. package/node_modules/asynckit/lib/streamify.js +0 -141
  117. package/node_modules/asynckit/lib/terminator.js +0 -29
  118. package/node_modules/asynckit/package.json +0 -63
  119. package/node_modules/asynckit/parallel.js +0 -43
  120. package/node_modules/asynckit/serial.js +0 -17
  121. package/node_modules/asynckit/serialOrdered.js +0 -75
  122. package/node_modules/asynckit/stream.js +0 -21
  123. package/node_modules/axios/CHANGELOG.md +0 -874
  124. package/node_modules/axios/LICENSE +0 -7
  125. package/node_modules/axios/MIGRATION_GUIDE.md +0 -3
  126. package/node_modules/axios/README.md +0 -1650
  127. package/node_modules/axios/SECURITY.md +0 -6
  128. package/node_modules/axios/dist/axios.js +0 -3448
  129. package/node_modules/axios/dist/axios.js.map +0 -1
  130. package/node_modules/axios/dist/axios.min.js +0 -2
  131. package/node_modules/axios/dist/axios.min.js.map +0 -1
  132. package/node_modules/axios/dist/browser/axios.cjs +0 -3258
  133. package/node_modules/axios/dist/browser/axios.cjs.map +0 -1
  134. package/node_modules/axios/dist/esm/axios.js +0 -3281
  135. package/node_modules/axios/dist/esm/axios.js.map +0 -1
  136. package/node_modules/axios/dist/esm/axios.min.js +0 -2
  137. package/node_modules/axios/dist/esm/axios.min.js.map +0 -1
  138. package/node_modules/axios/dist/node/axios.cjs +0 -4354
  139. package/node_modules/axios/dist/node/axios.cjs.map +0 -1
  140. package/node_modules/axios/index.d.cts +0 -542
  141. package/node_modules/axios/index.d.ts +0 -559
  142. package/node_modules/axios/index.js +0 -43
  143. package/node_modules/axios/lib/adapters/README.md +0 -37
  144. package/node_modules/axios/lib/adapters/adapters.js +0 -77
  145. package/node_modules/axios/lib/adapters/http.js +0 -685
  146. package/node_modules/axios/lib/adapters/xhr.js +0 -260
  147. package/node_modules/axios/lib/axios.js +0 -89
  148. package/node_modules/axios/lib/cancel/CancelToken.js +0 -121
  149. package/node_modules/axios/lib/cancel/CanceledError.js +0 -25
  150. package/node_modules/axios/lib/cancel/isCancel.js +0 -5
  151. package/node_modules/axios/lib/core/Axios.js +0 -225
  152. package/node_modules/axios/lib/core/AxiosError.js +0 -100
  153. package/node_modules/axios/lib/core/AxiosHeaders.js +0 -298
  154. package/node_modules/axios/lib/core/InterceptorManager.js +0 -71
  155. package/node_modules/axios/lib/core/README.md +0 -8
  156. package/node_modules/axios/lib/core/buildFullPath.js +0 -21
  157. package/node_modules/axios/lib/core/dispatchRequest.js +0 -81
  158. package/node_modules/axios/lib/core/mergeConfig.js +0 -106
  159. package/node_modules/axios/lib/core/settle.js +0 -27
  160. package/node_modules/axios/lib/core/transformData.js +0 -28
  161. package/node_modules/axios/lib/defaults/index.js +0 -156
  162. package/node_modules/axios/lib/defaults/transitional.js +0 -7
  163. package/node_modules/axios/lib/env/README.md +0 -3
  164. package/node_modules/axios/lib/env/classes/FormData.js +0 -2
  165. package/node_modules/axios/lib/env/data.js +0 -1
  166. package/node_modules/axios/lib/helpers/AxiosTransformStream.js +0 -191
  167. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -58
  168. package/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -71
  169. package/node_modules/axios/lib/helpers/README.md +0 -7
  170. package/node_modules/axios/lib/helpers/ZlibHeaderTransformStream.js +0 -28
  171. package/node_modules/axios/lib/helpers/bind.js +0 -7
  172. package/node_modules/axios/lib/helpers/buildURL.js +0 -63
  173. package/node_modules/axios/lib/helpers/callbackify.js +0 -16
  174. package/node_modules/axios/lib/helpers/combineURLs.js +0 -15
  175. package/node_modules/axios/lib/helpers/cookies.js +0 -42
  176. package/node_modules/axios/lib/helpers/deprecatedMethod.js +0 -26
  177. package/node_modules/axios/lib/helpers/formDataToJSON.js +0 -95
  178. package/node_modules/axios/lib/helpers/formDataToStream.js +0 -111
  179. package/node_modules/axios/lib/helpers/fromDataURI.js +0 -53
  180. package/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -15
  181. package/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
  182. package/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -67
  183. package/node_modules/axios/lib/helpers/null.js +0 -2
  184. package/node_modules/axios/lib/helpers/parseHeaders.js +0 -55
  185. package/node_modules/axios/lib/helpers/parseProtocol.js +0 -6
  186. package/node_modules/axios/lib/helpers/readBlob.js +0 -15
  187. package/node_modules/axios/lib/helpers/speedometer.js +0 -55
  188. package/node_modules/axios/lib/helpers/spread.js +0 -28
  189. package/node_modules/axios/lib/helpers/throttle.js +0 -33
  190. package/node_modules/axios/lib/helpers/toFormData.js +0 -219
  191. package/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -18
  192. package/node_modules/axios/lib/helpers/validator.js +0 -91
  193. package/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -3
  194. package/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -3
  195. package/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -4
  196. package/node_modules/axios/lib/platform/browser/index.js +0 -13
  197. package/node_modules/axios/lib/platform/common/utils.js +0 -47
  198. package/node_modules/axios/lib/platform/index.js +0 -7
  199. package/node_modules/axios/lib/platform/node/classes/FormData.js +0 -3
  200. package/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +0 -4
  201. package/node_modules/axios/lib/platform/node/index.js +0 -12
  202. package/node_modules/axios/lib/utils.js +0 -723
  203. package/node_modules/axios/package.json +0 -218
  204. package/node_modules/combined-stream/License +0 -19
  205. package/node_modules/combined-stream/Readme.md +0 -138
  206. package/node_modules/combined-stream/lib/combined_stream.js +0 -208
  207. package/node_modules/combined-stream/package.json +0 -25
  208. package/node_modules/delayed-stream/.npmignore +0 -1
  209. package/node_modules/delayed-stream/License +0 -19
  210. package/node_modules/delayed-stream/Makefile +0 -7
  211. package/node_modules/delayed-stream/Readme.md +0 -141
  212. package/node_modules/delayed-stream/lib/delayed_stream.js +0 -107
  213. package/node_modules/delayed-stream/package.json +0 -27
  214. package/node_modules/dotenv/CHANGELOG.md +0 -475
  215. package/node_modules/dotenv/LICENSE +0 -23
  216. package/node_modules/dotenv/README-es.md +0 -448
  217. package/node_modules/dotenv/README.md +0 -728
  218. package/node_modules/dotenv/config.d.ts +0 -1
  219. package/node_modules/dotenv/config.js +0 -9
  220. package/node_modules/dotenv/lib/cli-options.js +0 -11
  221. package/node_modules/dotenv/lib/env-options.js +0 -24
  222. package/node_modules/dotenv/lib/main.d.ts +0 -153
  223. package/node_modules/dotenv/lib/main.js +0 -361
  224. package/node_modules/dotenv/package.json +0 -65
  225. package/node_modules/follow-redirects/LICENSE +0 -18
  226. package/node_modules/follow-redirects/README.md +0 -155
  227. package/node_modules/follow-redirects/debug.js +0 -15
  228. package/node_modules/follow-redirects/http.js +0 -1
  229. package/node_modules/follow-redirects/https.js +0 -1
  230. package/node_modules/follow-redirects/index.js +0 -672
  231. package/node_modules/follow-redirects/package.json +0 -58
  232. package/node_modules/form-data/License +0 -19
  233. package/node_modules/form-data/README.md.bak +0 -358
  234. package/node_modules/form-data/Readme.md +0 -358
  235. package/node_modules/form-data/index.d.ts +0 -62
  236. package/node_modules/form-data/lib/browser.js +0 -2
  237. package/node_modules/form-data/lib/form_data.js +0 -501
  238. package/node_modules/form-data/lib/populate.js +0 -10
  239. package/node_modules/form-data/package.json +0 -68
  240. package/node_modules/mime-db/HISTORY.md +0 -507
  241. package/node_modules/mime-db/LICENSE +0 -23
  242. package/node_modules/mime-db/README.md +0 -100
  243. package/node_modules/mime-db/db.json +0 -8519
  244. package/node_modules/mime-db/index.js +0 -12
  245. package/node_modules/mime-db/package.json +0 -60
  246. package/node_modules/mime-types/HISTORY.md +0 -397
  247. package/node_modules/mime-types/LICENSE +0 -23
  248. package/node_modules/mime-types/README.md +0 -113
  249. package/node_modules/mime-types/index.js +0 -188
  250. package/node_modules/mime-types/package.json +0 -44
  251. package/node_modules/proxy-from-env/.eslintrc +0 -29
  252. package/node_modules/proxy-from-env/.travis.yml +0 -10
  253. package/node_modules/proxy-from-env/LICENSE +0 -20
  254. package/node_modules/proxy-from-env/README.md +0 -131
  255. package/node_modules/proxy-from-env/index.js +0 -108
  256. package/node_modules/proxy-from-env/package.json +0 -34
  257. package/node_modules/proxy-from-env/test.js +0 -483
  258. package/src/base.fireberrySDK.ts +0 -7
  259. package/src/context/context.record.test.ts +0 -47
  260. package/src/context/context.ts +0 -28
  261. package/src/context/index.ts +0 -6
  262. package/src/context/record.ts +0 -22
  263. package/src/context/user.ts +0 -15
  264. package/src/fireberry.sdk.ts +0 -14
  265. package/src/fireberryAPI/fireberryV2Api.test.ts +0 -57
  266. package/src/fireberryAPI/fireberryV2Api.ts +0 -61
  267. package/src/fireberryAPI/index.ts +0 -2
  268. package/src/fireberryAPI/types.ts +0 -10
  269. package/src/fireberrySDK.client.ts +0 -10
  270. package/src/fireberrySDK.server.ts +0 -8
  271. package/src/index.ts +0 -9
  272. package/src/utils/axios.util.ts +0 -20
  273. package/src/utils/index.ts +0 -2
  274. package/src/utils/queryParam.util.ts +0 -8
  275. package/tsconfig.json +0 -123
  276. /package/dist/{context → cjs/context}/index.js +0 -0
@@ -1,71 +0,0 @@
1
- const HttpStatusCode = {
2
- Continue: 100,
3
- SwitchingProtocols: 101,
4
- Processing: 102,
5
- EarlyHints: 103,
6
- Ok: 200,
7
- Created: 201,
8
- Accepted: 202,
9
- NonAuthoritativeInformation: 203,
10
- NoContent: 204,
11
- ResetContent: 205,
12
- PartialContent: 206,
13
- MultiStatus: 207,
14
- AlreadyReported: 208,
15
- ImUsed: 226,
16
- MultipleChoices: 300,
17
- MovedPermanently: 301,
18
- Found: 302,
19
- SeeOther: 303,
20
- NotModified: 304,
21
- UseProxy: 305,
22
- Unused: 306,
23
- TemporaryRedirect: 307,
24
- PermanentRedirect: 308,
25
- BadRequest: 400,
26
- Unauthorized: 401,
27
- PaymentRequired: 402,
28
- Forbidden: 403,
29
- NotFound: 404,
30
- MethodNotAllowed: 405,
31
- NotAcceptable: 406,
32
- ProxyAuthenticationRequired: 407,
33
- RequestTimeout: 408,
34
- Conflict: 409,
35
- Gone: 410,
36
- LengthRequired: 411,
37
- PreconditionFailed: 412,
38
- PayloadTooLarge: 413,
39
- UriTooLong: 414,
40
- UnsupportedMediaType: 415,
41
- RangeNotSatisfiable: 416,
42
- ExpectationFailed: 417,
43
- ImATeapot: 418,
44
- MisdirectedRequest: 421,
45
- UnprocessableEntity: 422,
46
- Locked: 423,
47
- FailedDependency: 424,
48
- TooEarly: 425,
49
- UpgradeRequired: 426,
50
- PreconditionRequired: 428,
51
- TooManyRequests: 429,
52
- RequestHeaderFieldsTooLarge: 431,
53
- UnavailableForLegalReasons: 451,
54
- InternalServerError: 500,
55
- NotImplemented: 501,
56
- BadGateway: 502,
57
- ServiceUnavailable: 503,
58
- GatewayTimeout: 504,
59
- HttpVersionNotSupported: 505,
60
- VariantAlsoNegotiates: 506,
61
- InsufficientStorage: 507,
62
- LoopDetected: 508,
63
- NotExtended: 510,
64
- NetworkAuthenticationRequired: 511,
65
- };
66
-
67
- Object.entries(HttpStatusCode).forEach(([key, value]) => {
68
- HttpStatusCode[value] = key;
69
- });
70
-
71
- export default HttpStatusCode;
@@ -1,7 +0,0 @@
1
- # axios // helpers
2
-
3
- The modules found in `helpers/` should be generic modules that are _not_ specific to the domain logic of axios. These modules could theoretically be published to npm on their own and consumed by other modules or apps. Some examples of generic modules are things like:
4
-
5
- - Browser polyfills
6
- - Managing cookies
7
- - Parsing HTTP headers
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- import stream from "stream";
4
-
5
- class ZlibHeaderTransformStream extends stream.Transform {
6
- __transform(chunk, encoding, callback) {
7
- this.push(chunk);
8
- callback();
9
- }
10
-
11
- _transform(chunk, encoding, callback) {
12
- if (chunk.length !== 0) {
13
- this._transform = this.__transform;
14
-
15
- // Add Default Compression headers if no zlib headers are present
16
- if (chunk[0] !== 120) { // Hex: 78
17
- const header = Buffer.alloc(2);
18
- header[0] = 120; // Hex: 78
19
- header[1] = 156; // Hex: 9C
20
- this.push(header, encoding);
21
- }
22
- }
23
-
24
- this.__transform(chunk, encoding, callback);
25
- }
26
- }
27
-
28
- export default ZlibHeaderTransformStream;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- export default function bind(fn, thisArg) {
4
- return function wrap() {
5
- return fn.apply(thisArg, arguments);
6
- };
7
- }
@@ -1,63 +0,0 @@
1
- 'use strict';
2
-
3
- import utils from '../utils.js';
4
- import AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';
5
-
6
- /**
7
- * It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
8
- * URI encoded counterparts
9
- *
10
- * @param {string} val The value to be encoded.
11
- *
12
- * @returns {string} The encoded value.
13
- */
14
- function encode(val) {
15
- return encodeURIComponent(val).
16
- replace(/%3A/gi, ':').
17
- replace(/%24/g, '$').
18
- replace(/%2C/gi, ',').
19
- replace(/%20/g, '+').
20
- replace(/%5B/gi, '[').
21
- replace(/%5D/gi, ']');
22
- }
23
-
24
- /**
25
- * Build a URL by appending params to the end
26
- *
27
- * @param {string} url The base of the url (e.g., http://www.google.com)
28
- * @param {object} [params] The params to be appended
29
- * @param {?object} options
30
- *
31
- * @returns {string} The formatted url
32
- */
33
- export default function buildURL(url, params, options) {
34
- /*eslint no-param-reassign:0*/
35
- if (!params) {
36
- return url;
37
- }
38
-
39
- const _encode = options && options.encode || encode;
40
-
41
- const serializeFn = options && options.serialize;
42
-
43
- let serializedParams;
44
-
45
- if (serializeFn) {
46
- serializedParams = serializeFn(params, options);
47
- } else {
48
- serializedParams = utils.isURLSearchParams(params) ?
49
- params.toString() :
50
- new AxiosURLSearchParams(params, options).toString(_encode);
51
- }
52
-
53
- if (serializedParams) {
54
- const hashmarkIndex = url.indexOf("#");
55
-
56
- if (hashmarkIndex !== -1) {
57
- url = url.slice(0, hashmarkIndex);
58
- }
59
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
60
- }
61
-
62
- return url;
63
- }
@@ -1,16 +0,0 @@
1
- import utils from "../utils.js";
2
-
3
- const callbackify = (fn, reducer) => {
4
- return utils.isAsyncFn(fn) ? function (...args) {
5
- const cb = args.pop();
6
- fn.apply(this, args).then((value) => {
7
- try {
8
- reducer ? cb(null, ...reducer(value)) : cb(null, value);
9
- } catch (err) {
10
- cb(err);
11
- }
12
- }, cb);
13
- } : fn;
14
- }
15
-
16
- export default callbackify;
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Creates a new URL by combining the specified URLs
5
- *
6
- * @param {string} baseURL The base URL
7
- * @param {string} relativeURL The relative URL
8
- *
9
- * @returns {string} The combined URL
10
- */
11
- export default function combineURLs(baseURL, relativeURL) {
12
- return relativeURL
13
- ? baseURL.replace(/\/?\/$/, '') + '/' + relativeURL.replace(/^\/+/, '')
14
- : baseURL;
15
- }
@@ -1,42 +0,0 @@
1
- import utils from './../utils.js';
2
- import platform from '../platform/index.js';
3
-
4
- export default platform.hasStandardBrowserEnv ?
5
-
6
- // Standard browser envs support document.cookie
7
- {
8
- write(name, value, expires, path, domain, secure) {
9
- const cookie = [name + '=' + encodeURIComponent(value)];
10
-
11
- utils.isNumber(expires) && cookie.push('expires=' + new Date(expires).toGMTString());
12
-
13
- utils.isString(path) && cookie.push('path=' + path);
14
-
15
- utils.isString(domain) && cookie.push('domain=' + domain);
16
-
17
- secure === true && cookie.push('secure');
18
-
19
- document.cookie = cookie.join('; ');
20
- },
21
-
22
- read(name) {
23
- const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
24
- return (match ? decodeURIComponent(match[3]) : null);
25
- },
26
-
27
- remove(name) {
28
- this.write(name, '', Date.now() - 86400000);
29
- }
30
- }
31
-
32
- :
33
-
34
- // Non-standard browser env (web workers, react-native) lack needed support.
35
- {
36
- write() {},
37
- read() {
38
- return null;
39
- },
40
- remove() {}
41
- };
42
-
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- /*eslint no-console:0*/
4
-
5
- /**
6
- * Supply a warning to the developer that a method they are using
7
- * has been deprecated.
8
- *
9
- * @param {string} method The name of the deprecated method
10
- * @param {string} [instead] The alternate method to use if applicable
11
- * @param {string} [docs] The documentation URL to get further details
12
- *
13
- * @returns {void}
14
- */
15
- export default function deprecatedMethod(method, instead, docs) {
16
- try {
17
- console.warn(
18
- 'DEPRECATED method `' + method + '`.' +
19
- (instead ? ' Use `' + instead + '` instead.' : '') +
20
- ' This method will be removed in a future release.');
21
-
22
- if (docs) {
23
- console.warn('For more information about usage see ' + docs);
24
- }
25
- } catch (e) { /* Ignore */ }
26
- }
@@ -1,95 +0,0 @@
1
- 'use strict';
2
-
3
- import utils from '../utils.js';
4
-
5
- /**
6
- * It takes a string like `foo[x][y][z]` and returns an array like `['foo', 'x', 'y', 'z']
7
- *
8
- * @param {string} name - The name of the property to get.
9
- *
10
- * @returns An array of strings.
11
- */
12
- function parsePropPath(name) {
13
- // foo[x][y][z]
14
- // foo.x.y.z
15
- // foo-x-y-z
16
- // foo x y z
17
- return utils.matchAll(/\w+|\[(\w*)]/g, name).map(match => {
18
- return match[0] === '[]' ? '' : match[1] || match[0];
19
- });
20
- }
21
-
22
- /**
23
- * Convert an array to an object.
24
- *
25
- * @param {Array<any>} arr - The array to convert to an object.
26
- *
27
- * @returns An object with the same keys and values as the array.
28
- */
29
- function arrayToObject(arr) {
30
- const obj = {};
31
- const keys = Object.keys(arr);
32
- let i;
33
- const len = keys.length;
34
- let key;
35
- for (i = 0; i < len; i++) {
36
- key = keys[i];
37
- obj[key] = arr[key];
38
- }
39
- return obj;
40
- }
41
-
42
- /**
43
- * It takes a FormData object and returns a JavaScript object
44
- *
45
- * @param {string} formData The FormData object to convert to JSON.
46
- *
47
- * @returns {Object<string, any> | null} The converted object.
48
- */
49
- function formDataToJSON(formData) {
50
- function buildPath(path, value, target, index) {
51
- let name = path[index++];
52
-
53
- if (name === '__proto__') return true;
54
-
55
- const isNumericKey = Number.isFinite(+name);
56
- const isLast = index >= path.length;
57
- name = !name && utils.isArray(target) ? target.length : name;
58
-
59
- if (isLast) {
60
- if (utils.hasOwnProp(target, name)) {
61
- target[name] = [target[name], value];
62
- } else {
63
- target[name] = value;
64
- }
65
-
66
- return !isNumericKey;
67
- }
68
-
69
- if (!target[name] || !utils.isObject(target[name])) {
70
- target[name] = [];
71
- }
72
-
73
- const result = buildPath(path, value, target[name], index);
74
-
75
- if (result && utils.isArray(target[name])) {
76
- target[name] = arrayToObject(target[name]);
77
- }
78
-
79
- return !isNumericKey;
80
- }
81
-
82
- if (utils.isFormData(formData) && utils.isFunction(formData.entries)) {
83
- const obj = {};
84
-
85
- utils.forEachEntry(formData, (name, value) => {
86
- buildPath(parsePropPath(name), value, obj, 0);
87
- });
88
-
89
- return obj;
90
- }
91
-
92
- return null;
93
- }
94
-
95
- export default formDataToJSON;
@@ -1,111 +0,0 @@
1
- import {TextEncoder} from 'util';
2
- import {Readable} from 'stream';
3
- import utils from "../utils.js";
4
- import readBlob from "./readBlob.js";
5
-
6
- const BOUNDARY_ALPHABET = utils.ALPHABET.ALPHA_DIGIT + '-_';
7
-
8
- const textEncoder = new TextEncoder();
9
-
10
- const CRLF = '\r\n';
11
- const CRLF_BYTES = textEncoder.encode(CRLF);
12
- const CRLF_BYTES_COUNT = 2;
13
-
14
- class FormDataPart {
15
- constructor(name, value) {
16
- const {escapeName} = this.constructor;
17
- const isStringValue = utils.isString(value);
18
-
19
- let headers = `Content-Disposition: form-data; name="${escapeName(name)}"${
20
- !isStringValue && value.name ? `; filename="${escapeName(value.name)}"` : ''
21
- }${CRLF}`;
22
-
23
- if (isStringValue) {
24
- value = textEncoder.encode(String(value).replace(/\r?\n|\r\n?/g, CRLF));
25
- } else {
26
- headers += `Content-Type: ${value.type || "application/octet-stream"}${CRLF}`
27
- }
28
-
29
- this.headers = textEncoder.encode(headers + CRLF);
30
-
31
- this.contentLength = isStringValue ? value.byteLength : value.size;
32
-
33
- this.size = this.headers.byteLength + this.contentLength + CRLF_BYTES_COUNT;
34
-
35
- this.name = name;
36
- this.value = value;
37
- }
38
-
39
- async *encode(){
40
- yield this.headers;
41
-
42
- const {value} = this;
43
-
44
- if(utils.isTypedArray(value)) {
45
- yield value;
46
- } else {
47
- yield* readBlob(value);
48
- }
49
-
50
- yield CRLF_BYTES;
51
- }
52
-
53
- static escapeName(name) {
54
- return String(name).replace(/[\r\n"]/g, (match) => ({
55
- '\r' : '%0D',
56
- '\n' : '%0A',
57
- '"' : '%22',
58
- }[match]));
59
- }
60
- }
61
-
62
- const formDataToStream = (form, headersHandler, options) => {
63
- const {
64
- tag = 'form-data-boundary',
65
- size = 25,
66
- boundary = tag + '-' + utils.generateString(size, BOUNDARY_ALPHABET)
67
- } = options || {};
68
-
69
- if(!utils.isFormData(form)) {
70
- throw TypeError('FormData instance required');
71
- }
72
-
73
- if (boundary.length < 1 || boundary.length > 70) {
74
- throw Error('boundary must be 10-70 characters long')
75
- }
76
-
77
- const boundaryBytes = textEncoder.encode('--' + boundary + CRLF);
78
- const footerBytes = textEncoder.encode('--' + boundary + '--' + CRLF + CRLF);
79
- let contentLength = footerBytes.byteLength;
80
-
81
- const parts = Array.from(form.entries()).map(([name, value]) => {
82
- const part = new FormDataPart(name, value);
83
- contentLength += part.size;
84
- return part;
85
- });
86
-
87
- contentLength += boundaryBytes.byteLength * parts.length;
88
-
89
- contentLength = utils.toFiniteNumber(contentLength);
90
-
91
- const computedHeaders = {
92
- 'Content-Type': `multipart/form-data; boundary=${boundary}`
93
- }
94
-
95
- if (Number.isFinite(contentLength)) {
96
- computedHeaders['Content-Length'] = contentLength;
97
- }
98
-
99
- headersHandler && headersHandler(computedHeaders);
100
-
101
- return Readable.from((async function *() {
102
- for(const part of parts) {
103
- yield boundaryBytes;
104
- yield* part.encode();
105
- }
106
-
107
- yield footerBytes;
108
- })());
109
- };
110
-
111
- export default formDataToStream;
@@ -1,53 +0,0 @@
1
- 'use strict';
2
-
3
- import AxiosError from '../core/AxiosError.js';
4
- import parseProtocol from './parseProtocol.js';
5
- import platform from '../platform/index.js';
6
-
7
- const DATA_URL_PATTERN = /^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;
8
-
9
- /**
10
- * Parse data uri to a Buffer or Blob
11
- *
12
- * @param {String} uri
13
- * @param {?Boolean} asBlob
14
- * @param {?Object} options
15
- * @param {?Function} options.Blob
16
- *
17
- * @returns {Buffer|Blob}
18
- */
19
- export default function fromDataURI(uri, asBlob, options) {
20
- const _Blob = options && options.Blob || platform.classes.Blob;
21
- const protocol = parseProtocol(uri);
22
-
23
- if (asBlob === undefined && _Blob) {
24
- asBlob = true;
25
- }
26
-
27
- if (protocol === 'data') {
28
- uri = protocol.length ? uri.slice(protocol.length + 1) : uri;
29
-
30
- const match = DATA_URL_PATTERN.exec(uri);
31
-
32
- if (!match) {
33
- throw new AxiosError('Invalid URL', AxiosError.ERR_INVALID_URL);
34
- }
35
-
36
- const mime = match[1];
37
- const isBase64 = match[2];
38
- const body = match[3];
39
- const buffer = Buffer.from(decodeURIComponent(body), isBase64 ? 'base64' : 'utf8');
40
-
41
- if (asBlob) {
42
- if (!_Blob) {
43
- throw new AxiosError('Blob is not supported', AxiosError.ERR_NOT_SUPPORT);
44
- }
45
-
46
- return new _Blob([buffer], {type: mime});
47
- }
48
-
49
- return buffer;
50
- }
51
-
52
- throw new AxiosError('Unsupported protocol ' + protocol, AxiosError.ERR_NOT_SUPPORT);
53
- }
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Determines whether the specified URL is absolute
5
- *
6
- * @param {string} url The URL to test
7
- *
8
- * @returns {boolean} True if the specified URL is absolute, otherwise false
9
- */
10
- export default function isAbsoluteURL(url) {
11
- // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
12
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
13
- // by any combination of letters, digits, plus, period, or hyphen.
14
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
15
- }
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- import utils from './../utils.js';
4
-
5
- /**
6
- * Determines whether the payload is an error thrown by Axios
7
- *
8
- * @param {*} payload The value to test
9
- *
10
- * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false
11
- */
12
- export default function isAxiosError(payload) {
13
- return utils.isObject(payload) && (payload.isAxiosError === true);
14
- }
@@ -1,67 +0,0 @@
1
- 'use strict';
2
-
3
- import utils from './../utils.js';
4
- import platform from '../platform/index.js';
5
-
6
- export default platform.hasStandardBrowserEnv ?
7
-
8
- // Standard browser envs have full support of the APIs needed to test
9
- // whether the request URL is of the same origin as current location.
10
- (function standardBrowserEnv() {
11
- const msie = /(msie|trident)/i.test(navigator.userAgent);
12
- const urlParsingNode = document.createElement('a');
13
- let originURL;
14
-
15
- /**
16
- * Parse a URL to discover its components
17
- *
18
- * @param {String} url The URL to be parsed
19
- * @returns {Object}
20
- */
21
- function resolveURL(url) {
22
- let href = url;
23
-
24
- if (msie) {
25
- // IE needs attribute set twice to normalize properties
26
- urlParsingNode.setAttribute('href', href);
27
- href = urlParsingNode.href;
28
- }
29
-
30
- urlParsingNode.setAttribute('href', href);
31
-
32
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
33
- return {
34
- href: urlParsingNode.href,
35
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
36
- host: urlParsingNode.host,
37
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
38
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
39
- hostname: urlParsingNode.hostname,
40
- port: urlParsingNode.port,
41
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
42
- urlParsingNode.pathname :
43
- '/' + urlParsingNode.pathname
44
- };
45
- }
46
-
47
- originURL = resolveURL(window.location.href);
48
-
49
- /**
50
- * Determine if a URL shares the same origin as the current location
51
- *
52
- * @param {String} requestURL The URL to test
53
- * @returns {boolean} True if URL shares the same origin, otherwise false
54
- */
55
- return function isURLSameOrigin(requestURL) {
56
- const parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
57
- return (parsed.protocol === originURL.protocol &&
58
- parsed.host === originURL.host);
59
- };
60
- })() :
61
-
62
- // Non standard browser envs (web workers, react-native) lack needed support.
63
- (function nonStandardBrowserEnv() {
64
- return function isURLSameOrigin() {
65
- return true;
66
- };
67
- })();
@@ -1,2 +0,0 @@
1
- // eslint-disable-next-line strict
2
- export default null;