keq 1.7.2 → 1.8.1

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 (228) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +25 -7
  3. package/ava.config.mjs +5 -0
  4. package/doc/zh-cn/readme.md +26 -6
  5. package/index.ts +0 -4
  6. package/package.json +26 -27
  7. package/es/images/logo.svg +0 -1
  8. package/es/index.d.ts +0 -4
  9. package/es/index.js +0 -5
  10. package/es/package.json +0 -92
  11. package/es/src/exception/exception.d.ts +0 -4
  12. package/es/src/exception/exception.js +0 -7
  13. package/es/src/exception/file-expected.exception.d.ts +0 -4
  14. package/es/src/exception/file-expected.exception.js +0 -6
  15. package/es/src/exception/file-expected.exception.ts +0 -8
  16. package/es/src/exception/index.d.ts +0 -4
  17. package/es/src/exception/index.js +0 -4
  18. package/es/src/exception/overwrite-array-body.exception.d.ts +0 -4
  19. package/es/src/exception/overwrite-array-body.exception.js +0 -6
  20. package/es/src/exception/overwrite-array-body.exception.ts +0 -8
  21. package/es/src/exception/unknow-content-type.exception.d.ts +0 -4
  22. package/es/src/exception/unknow-content-type.exception.js +0 -6
  23. package/es/src/exception/unknow-content-type.exception.ts +0 -8
  24. package/es/src/form-data-node/index.d.ts +0 -246
  25. package/es/src/form-data-node/index.js +0 -462
  26. package/es/src/form-data-node/util/boundary.d.ts +0 -5
  27. package/es/src/form-data-node/util/boundary.js +0 -7
  28. package/es/src/form-data-node/util/file.d.ts +0 -16
  29. package/es/src/form-data-node/util/file.js +0 -75
  30. package/es/src/form-data-node/util/get-length.d.ts +0 -11
  31. package/es/src/form-data-node/util/get-length.js +0 -43
  32. package/es/src/form-data-node/util/get-stream-iterator.d.ts +0 -9
  33. package/es/src/form-data-node/util/get-stream-iterator.js +0 -16
  34. package/es/src/form-data-node/util/get-type.d.ts +0 -11
  35. package/es/src/form-data-node/util/get-type.js +0 -27
  36. package/es/src/form-data-node/util/read-only.d.ts +0 -2
  37. package/es/src/form-data-node/util/read-only.js +0 -10
  38. package/es/src/form-data-node/util/readable-stream-iterator.d.ts +0 -9
  39. package/es/src/form-data-node/util/readable-stream-iterator.js +0 -31
  40. package/es/src/form-data-node/util/to-file.d.ts +0 -6
  41. package/es/src/form-data-node/util/to-file.js +0 -24
  42. package/es/src/index.d.ts +0 -7
  43. package/es/src/index.js +0 -7
  44. package/es/src/keq-url.d.ts +0 -9
  45. package/es/src/keq-url.js +0 -80
  46. package/es/src/keq.d.ts +0 -79
  47. package/es/src/keq.js +0 -395
  48. package/es/src/middleware.d.ts +0 -5
  49. package/es/src/middleware.js +0 -40
  50. package/es/src/mount.d.ts +0 -8
  51. package/es/src/mount.js +0 -42
  52. package/es/src/polyfill.d.ts +0 -6
  53. package/es/src/polyfill.js +0 -4
  54. package/es/src/request.d.ts +0 -2
  55. package/es/src/request.js +0 -44
  56. package/es/src/types/context.d.ts +0 -27
  57. package/es/src/types/context.js +0 -1
  58. package/es/src/types/index.d.ts +0 -10
  59. package/es/src/types/index.js +0 -10
  60. package/es/src/types/keq-body.d.ts +0 -1
  61. package/es/src/types/keq-body.js +0 -1
  62. package/es/src/types/middleware.d.ts +0 -4
  63. package/es/src/types/middleware.js +0 -1
  64. package/es/src/types/mounter.d.ts +0 -7
  65. package/es/src/types/mounter.js +0 -1
  66. package/es/src/types/options.d.ts +0 -49
  67. package/es/src/types/options.js +0 -1
  68. package/es/src/types/request-creator.d.ts +0 -25
  69. package/es/src/types/request-creator.js +0 -1
  70. package/es/src/types/request-method.d.ts +0 -1
  71. package/es/src/types/request-method.js +0 -1
  72. package/es/src/types/retry-callback.d.ts +0 -1
  73. package/es/src/types/retry-callback.js +0 -1
  74. package/es/src/types/serialize-body-fn.d.ts +0 -3
  75. package/es/src/types/serialize-body-fn.js +0 -1
  76. package/es/src/types/shorthand-content-type.d.ts +0 -1
  77. package/es/src/types/shorthand-content-type.js +0 -1
  78. package/es/src/util/encode-base64.d.ts +0 -1
  79. package/es/src/util/encode-base64.js +0 -4
  80. package/es/src/util/fix-content-type.d.ts +0 -2
  81. package/es/src/util/fix-content-type.js +0 -16
  82. package/es/src/util/get-boundary-by-content-type.d.ts +0 -1
  83. package/es/src/util/get-boundary-by-content-type.js +0 -10
  84. package/es/src/util/index.d.ts +0 -8
  85. package/es/src/util/index.js +0 -8
  86. package/es/src/util/infer-content-type-by-body.d.ts +0 -2
  87. package/es/src/util/infer-content-type-by-body.js +0 -7
  88. package/es/src/util/is/index.d.ts +0 -11
  89. package/es/src/util/is/index.js +0 -11
  90. package/es/src/util/is/is-blob.d.ts +0 -4
  91. package/es/src/util/is/is-blob.js +0 -16
  92. package/es/src/util/is/is-browser.d.ts +0 -1
  93. package/es/src/util/is/is-browser.js +0 -3
  94. package/es/src/util/is/is-file.d.ts +0 -1
  95. package/es/src/util/is/is-file.js +0 -7
  96. package/es/src/util/is/is-form-data.d.ts +0 -1
  97. package/es/src/util/is/is-form-data.js +0 -12
  98. package/es/src/util/is/is-function.d.ts +0 -1
  99. package/es/src/util/is/is-function.js +0 -3
  100. package/es/src/util/is/is-object.d.ts +0 -1
  101. package/es/src/util/is/is-object.js +0 -3
  102. package/es/src/util/is/is-read-stream.d.ts +0 -1
  103. package/es/src/util/is/is-read-stream.js +0 -12
  104. package/es/src/util/is/is-readable.d.ts +0 -1
  105. package/es/src/util/is/is-readable.js +0 -4
  106. package/es/src/util/is/is-stream.d.ts +0 -4
  107. package/es/src/util/is/is-stream.js +0 -9
  108. package/es/src/util/is/is-string.d.ts +0 -1
  109. package/es/src/util/is/is-string.js +0 -3
  110. package/es/src/util/is/is-whatwg-readable.d.ts +0 -10
  111. package/es/src/util/is/is-whatwg-readable.js +0 -20
  112. package/es/src/util/parse-form-data.d.ts +0 -1
  113. package/es/src/util/parse-form-data.js +0 -129
  114. package/es/src/util/serialize-body.d.ts +0 -6
  115. package/es/src/util/serialize-body.js +0 -53
  116. package/es/src/util/sleep.d.ts +0 -1
  117. package/es/src/util/sleep.js +0 -3
  118. package/lib/images/logo.svg +0 -1
  119. package/lib/index.d.ts +0 -4
  120. package/lib/index.js +0 -27
  121. package/lib/package.json +0 -92
  122. package/lib/src/exception/exception.d.ts +0 -4
  123. package/lib/src/exception/exception.js +0 -21
  124. package/lib/src/exception/file-expected.exception.d.ts +0 -4
  125. package/lib/src/exception/file-expected.exception.js +0 -20
  126. package/lib/src/exception/file-expected.exception.ts +0 -8
  127. package/lib/src/exception/index.d.ts +0 -4
  128. package/lib/src/exception/index.js +0 -26
  129. package/lib/src/exception/overwrite-array-body.exception.d.ts +0 -4
  130. package/lib/src/exception/overwrite-array-body.exception.js +0 -20
  131. package/lib/src/exception/overwrite-array-body.exception.ts +0 -8
  132. package/lib/src/exception/unknow-content-type.exception.d.ts +0 -4
  133. package/lib/src/exception/unknow-content-type.exception.js +0 -20
  134. package/lib/src/exception/unknow-content-type.exception.ts +0 -8
  135. package/lib/src/form-data-node/index.d.ts +0 -246
  136. package/lib/src/form-data-node/index.js +0 -474
  137. package/lib/src/form-data-node/util/boundary.d.ts +0 -5
  138. package/lib/src/form-data-node/util/boundary.js +0 -19
  139. package/lib/src/form-data-node/util/file.d.ts +0 -16
  140. package/lib/src/form-data-node/util/file.js +0 -87
  141. package/lib/src/form-data-node/util/get-length.d.ts +0 -11
  142. package/lib/src/form-data-node/util/get-length.js +0 -55
  143. package/lib/src/form-data-node/util/get-stream-iterator.d.ts +0 -9
  144. package/lib/src/form-data-node/util/get-stream-iterator.js +0 -28
  145. package/lib/src/form-data-node/util/get-type.d.ts +0 -11
  146. package/lib/src/form-data-node/util/get-type.js +0 -39
  147. package/lib/src/form-data-node/util/read-only.d.ts +0 -2
  148. package/lib/src/form-data-node/util/read-only.js +0 -22
  149. package/lib/src/form-data-node/util/readable-stream-iterator.d.ts +0 -9
  150. package/lib/src/form-data-node/util/readable-stream-iterator.js +0 -43
  151. package/lib/src/form-data-node/util/to-file.d.ts +0 -6
  152. package/lib/src/form-data-node/util/to-file.js +0 -36
  153. package/lib/src/index.d.ts +0 -7
  154. package/lib/src/index.js +0 -31
  155. package/lib/src/keq-url.d.ts +0 -9
  156. package/lib/src/keq-url.js +0 -94
  157. package/lib/src/keq.d.ts +0 -79
  158. package/lib/src/keq.js +0 -409
  159. package/lib/src/middleware.d.ts +0 -5
  160. package/lib/src/middleware.js +0 -57
  161. package/lib/src/mount.d.ts +0 -8
  162. package/lib/src/mount.js +0 -59
  163. package/lib/src/polyfill.d.ts +0 -6
  164. package/lib/src/polyfill.js +0 -20
  165. package/lib/src/request.d.ts +0 -2
  166. package/lib/src/request.js +0 -58
  167. package/lib/src/types/context.d.ts +0 -27
  168. package/lib/src/types/context.js +0 -12
  169. package/lib/src/types/index.d.ts +0 -10
  170. package/lib/src/types/index.js +0 -32
  171. package/lib/src/types/keq-body.d.ts +0 -1
  172. package/lib/src/types/keq-body.js +0 -12
  173. package/lib/src/types/middleware.d.ts +0 -4
  174. package/lib/src/types/middleware.js +0 -12
  175. package/lib/src/types/mounter.d.ts +0 -7
  176. package/lib/src/types/mounter.js +0 -12
  177. package/lib/src/types/options.d.ts +0 -49
  178. package/lib/src/types/options.js +0 -12
  179. package/lib/src/types/request-creator.d.ts +0 -25
  180. package/lib/src/types/request-creator.js +0 -12
  181. package/lib/src/types/request-method.d.ts +0 -1
  182. package/lib/src/types/request-method.js +0 -12
  183. package/lib/src/types/retry-callback.d.ts +0 -1
  184. package/lib/src/types/retry-callback.js +0 -12
  185. package/lib/src/types/serialize-body-fn.d.ts +0 -3
  186. package/lib/src/types/serialize-body-fn.js +0 -12
  187. package/lib/src/types/shorthand-content-type.d.ts +0 -1
  188. package/lib/src/types/shorthand-content-type.js +0 -12
  189. package/lib/src/util/encode-base64.d.ts +0 -1
  190. package/lib/src/util/encode-base64.js +0 -18
  191. package/lib/src/util/fix-content-type.d.ts +0 -2
  192. package/lib/src/util/fix-content-type.js +0 -30
  193. package/lib/src/util/get-boundary-by-content-type.d.ts +0 -1
  194. package/lib/src/util/get-boundary-by-content-type.js +0 -24
  195. package/lib/src/util/index.d.ts +0 -8
  196. package/lib/src/util/index.js +0 -30
  197. package/lib/src/util/infer-content-type-by-body.d.ts +0 -2
  198. package/lib/src/util/infer-content-type-by-body.js +0 -21
  199. package/lib/src/util/is/index.d.ts +0 -11
  200. package/lib/src/util/is/index.js +0 -33
  201. package/lib/src/util/is/is-blob.d.ts +0 -4
  202. package/lib/src/util/is/is-blob.js +0 -30
  203. package/lib/src/util/is/is-browser.d.ts +0 -1
  204. package/lib/src/util/is/is-browser.js +0 -17
  205. package/lib/src/util/is/is-file.d.ts +0 -1
  206. package/lib/src/util/is/is-file.js +0 -21
  207. package/lib/src/util/is/is-form-data.d.ts +0 -1
  208. package/lib/src/util/is/is-form-data.js +0 -26
  209. package/lib/src/util/is/is-function.d.ts +0 -1
  210. package/lib/src/util/is/is-function.js +0 -17
  211. package/lib/src/util/is/is-object.d.ts +0 -1
  212. package/lib/src/util/is/is-object.js +0 -17
  213. package/lib/src/util/is/is-read-stream.d.ts +0 -1
  214. package/lib/src/util/is/is-read-stream.js +0 -26
  215. package/lib/src/util/is/is-readable.d.ts +0 -1
  216. package/lib/src/util/is/is-readable.js +0 -18
  217. package/lib/src/util/is/is-stream.d.ts +0 -4
  218. package/lib/src/util/is/is-stream.js +0 -23
  219. package/lib/src/util/is/is-string.d.ts +0 -1
  220. package/lib/src/util/is/is-string.js +0 -17
  221. package/lib/src/util/is/is-whatwg-readable.d.ts +0 -10
  222. package/lib/src/util/is/is-whatwg-readable.js +0 -34
  223. package/lib/src/util/parse-form-data.d.ts +0 -1
  224. package/lib/src/util/parse-form-data.js +0 -143
  225. package/lib/src/util/serialize-body.d.ts +0 -6
  226. package/lib/src/util/serialize-body.js +0 -67
  227. package/lib/src/util/sleep.d.ts +0 -1
  228. package/lib/src/util/sleep.js +0 -17
package/CHANGELOG.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.8.1](https://www.github.com/keq-request/keq/compare/v1.8.0...v1.8.1) (2022-04-25)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * cannot compile by vite ([2727867](https://www.github.com/keq-request/keq/commit/27278676f924428e2598b634577ed8b63a1e935b))
11
+ * wrong return of response.blob() ([ca5a5b5](https://www.github.com/keq-request/keq/commit/ca5a5b5bd64bdde6a476d7ce5e86b9833cd2a43b))
12
+
13
+ ## [1.8.0](https://www.github.com/keq-request/keq/compare/v1.7.3...v1.8.0) (2022-03-22)
14
+
15
+
16
+ ### Features
17
+
18
+ * support custom request instance ([2c05dec](https://www.github.com/keq-request/keq/commit/2c05dec6d779861112507b7365822ecff175dbc3))
19
+
20
+ ### [1.7.3](https://www.github.com/keq-request/keq/compare/v1.7.2...v1.7.3) (2022-03-08)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * unable to send formdate request with file ([a4ed415](https://www.github.com/keq-request/keq/commit/a4ed41560aacb67a49d8159b453ddf69bce56799))
26
+
5
27
  ### [1.7.2](https://www.github.com/keq-request/keq/compare/v1.7.1...v1.7.2) (2022-02-25)
6
28
 
7
29
 
package/README.md CHANGED
@@ -91,7 +91,7 @@ Add option `resolveWithFullResponse` to get the origin [`Response`][Response MD
91
91
  import { request } from 'keq'
92
92
 
93
93
  const response = await request
94
- .get('http://example.com')
94
+ .get('http://test.com')
95
95
  .option('resolveWithFullResponse')
96
96
 
97
97
  const body = await response.json()
@@ -311,7 +311,7 @@ No retry by default, invoke `.retry(times[, initialTime[, callback]])` to set r
311
311
  import { request } from 'keq'
312
312
 
313
313
  await request
314
- .get('http://example.com')
314
+ .get('http://test.com')
315
315
  .retry(2, 1000, () => {})
316
316
  ```
317
317
 
@@ -324,7 +324,7 @@ Invoke `.option()` add options.
324
324
  import { request } from 'keq'
325
325
 
326
326
  await request
327
- .get('http://example.com')
327
+ .get('http://test.com')
328
328
  .option('resolveWithFullResponse')
329
329
  .option('middlewareOption', 'value')
330
330
  ```
@@ -335,7 +335,7 @@ Or as a single object:
335
335
  import { request } from 'keq'
336
336
 
337
337
  await request
338
- .get('http://example.com')
338
+ .get('http://test.com')
339
339
  .options({
340
340
  resolveWithFullResponse: true,
341
341
  middlewareOption: 'value',
@@ -390,7 +390,7 @@ request
390
390
 
391
391
  // Request Middleware
392
392
  await request
393
- .get('http://example.com')
393
+ .get('http://test.com')
394
394
  .use(middleware)
395
395
  ```
396
396
 
@@ -416,7 +416,7 @@ Keq's context object has many parameters. The following lists all the built-in c
416
416
  **Property** | **Type**
417
417
  :-----------------------------|:------------------------------------
418
418
  `context.request` | Includes request options for Fetch API.
419
- `context.request.url` | The return type of `url.parse('http://example.com', true)`.
419
+ `context.request.url` | The return type of `url.parse('http://test.com', true)`.
420
420
  `context.request.method` | One of 'get', 'post', 'put', 'patch', 'head', 'delete'.
421
421
  `context.request.body` | Object, Array, Stream, Blob or undefined.
422
422
  `context.request.headers` | The [`Headers`][Headers MDN] Object.
@@ -440,6 +440,24 @@ This is the utils used to mount middleware.
440
440
  `mount.pathname(matcher: string \| Regexp)` | Mount to the pathname that match the `matcher`. `string` can be [`glob`](https://www.npmjs.com/package/picomatch).
441
441
  `mount.host(host: string)` | Mount to the Host.
442
442
 
443
+ ### Create Request
444
+
445
+ If you want to create a request instance, you can invoke `request.create()`:
446
+
447
+
448
+ ```typescript
449
+ import { request } from 'keq'
450
+
451
+ const customRequest = request.create()
452
+
453
+ // Middleware only takes effect on customRequests
454
+ customRequest.use(/** some middleware */)
455
+
456
+ const body = await customRequest
457
+ .get('http://test.com')
458
+ ```
459
+
460
+ > The gloabl request instance is created by `request.create()` too.
443
461
 
444
462
  <!-- usage -->
445
463
 
@@ -459,7 +477,7 @@ The difference between the two is that when called multiple times.
459
477
  ```javascript
460
478
  import { request } from 'keq'
461
479
 
462
- const keq = request.get('http://example.com')
480
+ const keq = request.get('http://test.com')
463
481
 
464
482
  keq.then(onfulfilled, onrejected)
465
483
  // Won't send request, and will use the last request result.
package/ava.config.mjs ADDED
@@ -0,0 +1,5 @@
1
+ export default {
2
+ files: ['tests/**/*.ts', '!tests/**/*.before-each.ts'],
3
+ extensions: ['ts'],
4
+ require: ['ts-node/register'],
5
+ }
@@ -90,7 +90,7 @@ await request.del('https://example.com/search')
90
90
  import { request } from 'keq'
91
91
 
92
92
  const response = await request
93
- .get('http://example.com')
93
+ .get('http://test.com')
94
94
  .option('resolveWithFullResponse')
95
95
 
96
96
  const body = await response.json()
@@ -301,7 +301,7 @@ await request
301
301
  import { request } from 'keq'
302
302
 
303
303
  await request
304
- .get('http://example.com')
304
+ .get('http://test.com')
305
305
  .option('resolveWithFullResponse')
306
306
  .option('middlewareOption', 'value')
307
307
  ```
@@ -312,7 +312,7 @@ await request
312
312
  import { request } from 'keq'
313
313
 
314
314
  await request
315
- .get('http://example.com')
315
+ .get('http://test.com')
316
316
  .options({
317
317
  resolveWithFullResponse: true,
318
318
  middlewareOption: 'value',
@@ -353,7 +353,7 @@ request
353
353
 
354
354
  // Request Middleware
355
355
  await request
356
- .get('http://example.com')
356
+ .get('http://test.com')
357
357
  .use(middleware)
358
358
  ```
359
359
 
@@ -379,7 +379,7 @@ Keq的上下文对象有许多可以修改和使用的参数,下面列出了
379
379
  **Property** | **Type**
380
380
  :-----------------------------|:------------------------------------
381
381
  `context.request` | 发送fetch请求的参数。
382
- `context.request.url` | 请求地址,是一个`URL`对象,通过`url.parse('http://example.com', true)`创建。
382
+ `context.request.url` | 请求地址,是一个`URL`对象,通过`url.parse('http://test.com', true)`创建。
383
383
  `context.request.method` | Request method。
384
384
  `context.request.body` | 请求体,根据发送请求的不同,其结构可能是:`Object`(json/form-data/x-www-form-urlencoded), Array(json), Stream(NodeJS发送二进制文件), Blob(浏览器中发送二进制文件), undefined(未携带请求体)中的任意一种。
385
385
  `context.request.headers` | 请求头[`Headers`][Headers MDN]对象。
@@ -409,7 +409,7 @@ Keq的上下文对象有许多可以修改和使用的参数,下面列出了
409
409
  ```javascript
410
410
  import { request } from 'keq'
411
411
 
412
- const keq = request.get('http://example.com')
412
+ const keq = request.get('http://test.com')
413
413
 
414
414
  keq.then(onfulfilled, onrejected)
415
415
  // Won't send request, and will use the last request result.
@@ -425,6 +425,26 @@ keq.end()
425
425
 
426
426
  更重要的是,在`NodeJS`里面,`node-fetch`库没有实现`Response`的`.formData()`方法,在`NodeJS`环境中,`Keq`在克隆`ctx.res`后会自动添加`.formData()`实现。
427
427
 
428
+ ### 创建可自定义的请求实例
429
+
430
+ 如果你打算自己创建一个请求实例,而不使用全局的`request`实例,可以调用`request.create()`方法:
431
+
432
+ ```typescript
433
+ import { request } from 'keq'
434
+
435
+ const customRequest = request.create()
436
+
437
+ // Middleware only takes effect on customRequests
438
+ customRequest.use(/** some middleware */)
439
+
440
+ const body = await customRequest
441
+ .get('http://test.com')
442
+ ```
443
+
444
+ > 全局的`request`实例也是调用`request.create()`方法创建的。
445
+ > 因此,自定义的`request`实例也具备全局`request`的所有特性。
446
+
447
+
428
448
 
429
449
  ## 更多信息
430
450
 
package/index.ts CHANGED
@@ -1,5 +1 @@
1
1
  export * from './src/index'
2
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3
- /** @ts-ignore */
4
- import defaultExport from './src/index'
5
- export default defaultExport
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "keq",
3
3
  "main": "lib/index.js",
4
4
  "module": "es/index.js",
5
- "version": "1.7.2",
5
+ "version": "1.8.1",
6
6
  "license": "MIT",
7
7
  "types": "lib/index.d.ts",
8
8
  "scripts": {
@@ -16,57 +16,56 @@
16
16
  "release": "standard-version",
17
17
  "release:alpha": "standard-version --prerelease alpha",
18
18
  "release:first": "standard-version --first-release",
19
- "prepublishOnly": "npm run build",
20
19
  "clean": "rm -rf ./lib/*",
21
20
  "prebuild": "npm run clean",
22
- "build:es": "ttsc -p build/tsconfig.es.json && npm run copyfile:es",
23
- "build:lib": "ttsc -p build/tsconfig.lib.json && npm run copyfile:lib",
21
+ "build:es": "ttsc -p build/tsconfig.es.json",
22
+ "build:lib": "ttsc -p build/tsconfig.lib.json",
24
23
  "build": "npm run build:lib && npm run build:es",
25
24
  "watch": "NODE_ENV=development ttsc -p build/tsconfig.lib.json -w",
26
- "copyfile:es": "copyfiles -e \"@(build|es|lib|node_modules|tests|doc)/**/*.!(ts)\" -e \"@(README.md|CHANGELOG.md|ava.config.js|backers.md)\" \"**/*.!(ts)\" es",
27
- "copyfile:lib": "copyfiles -e \"@(build|es|lib|node_modules|tests|doc)/**/*.!(ts)\" -e \"@(README.md|CHANGELOG.md|ava.config.js|backers.md)\" \"**/*.!(ts)\" lib",
28
- "prewatch": "npm run copyfile:lib",
29
- "lint": "eslint \"src/**/*.ts\" \"tests/**/*.ts\" --fix",
25
+ "lint": "eslint \"src/**/*.ts\" \"tests/**/*.ts\" --fix --quiet",
30
26
  "prepare": "is-ci || husky install"
31
27
  },
32
28
  "devDependencies": {
33
- "@commitlint/cli": "^12.1.4",
34
- "@commitlint/config-conventional": "^12.1.4",
29
+ "@commitlint/cli": "^16.2.3",
30
+ "@commitlint/config-conventional": "^16.2.1",
35
31
  "@istanbuljs/nyc-config-typescript": "^1.0.1",
36
- "@types/sinon": "^9.0.4",
37
- "@typescript-eslint/eslint-plugin": "^4.15.2",
38
- "@typescript-eslint/parser": "^4.15.2",
32
+ "@types/sinon": "^10.0.11",
33
+ "@typescript-eslint/eslint-plugin": "4",
34
+ "@typescript-eslint/parser": "4",
39
35
  "ajv": "^8",
40
- "ava": "^3.10.1",
36
+ "ava": "^4.2.0",
41
37
  "commitizen": "^4.2.4",
42
- "copyfiles": "^2.4.1",
43
38
  "coveralls": "^3.1.0",
44
39
  "cz-conventional-changelog": "^3.3.0",
45
- "eslint": "^7.20.0",
46
- "husky": "^5.2.0",
40
+ "eslint": "7",
41
+ "husky": "^7.0.4",
47
42
  "is-ci": "^3.0.0",
48
- "lint-staged": "^11.0.0",
43
+ "lint-staged": "^12.4.0",
49
44
  "mili": "^4",
50
45
  "nyc": "^15.1.0",
51
- "sinon": "^10.0.0",
46
+ "sinon": "^13.0.2",
52
47
  "standard-version": "^9.3.0",
53
- "ts-node": "^9.1.1",
54
- "ttypescript": "^1.5.12",
55
- "typescript": "^4.2.2",
56
- "typescript-transform-paths": "^2.2.3"
48
+ "ts-node": "^10.7.0",
49
+ "ttypescript": "^1.5.13",
50
+ "typescript": "~4.6.3",
51
+ "typescript-transform-paths": "^3.3.1"
57
52
  },
58
53
  "dependencies": {
59
- "@types/node": "^14.14.31",
54
+ "@types/minimatch": "^3.0.5",
55
+ "@types/node": "^14.18.13",
60
56
  "@types/whatwg-url": "^8.2.1",
61
57
  "blob": "^0.1.0",
62
58
  "clone": "^2.1.2",
63
- "cross-fetch": "^3.0.6",
59
+ "form-data-encoder": "^1.7.2",
60
+ "formdata-node": "^4.3.2",
61
+ "formdata-polyfill": "^4.0.10",
64
62
  "formidable": "^2.0.1",
65
63
  "mime-types": "^2.1.27",
64
+ "minimatch": "^5.0.1",
66
65
  "nanoid": "^3.1.10",
66
+ "node-fetch": "2",
67
+ "object.fromentries": "^2.0.5",
67
68
  "path-to-regexp": "^6.2.0",
68
- "picomatch": "^2.2.2",
69
- "querystring": "^0.2.0",
70
69
  "ts-custom-error": "^3.2.0",
71
70
  "whatwg-url": "^11.0.0"
72
71
  },
@@ -1 +0,0 @@
1
- <svg enable-background="new 0 0 430 430" height="512" viewBox="0 0 430 430" width="512" xmlns="http://www.w3.org/2000/svg"><g id="isometric"><g><path d="m270.5 279-37-16.8-185 83.7 37 16.7 74-33.4 37 16.7 37-16.7-37-16.8z" fill="#597ba1"/><path d="m196.5 379.3 37-16.7-37-16.7-37 16.7z" fill="#597ba1"/><path d="m196.5 412.8 37-16.7-37-16.8-37 16.8z" fill="#597ba1"/><path d="m233.5 329.2 37 16.7 37-16.7-37-16.8z" fill="#597ba1"/><path d="m307.5 329.2 37 16.7 37-16.7-37-16.8z" fill="#597ba1"/><g fill="#0f4c81"><path d="m196.5 312.4v33.5l37-16.7z"/><path d="m196.5 379.3 37-16.7-37-16.7z"/><path d="m196.5 412.8 37-16.7-37-16.8z"/><path d="m270.5 345.9 37-16.7-37-16.8z"/><path d="m344.5 312.4v33.5l37-16.7z"/><path d="m233.5 262.2v33.5l37-16.7z"/></g><g fill="#597ba1"><path d="m270.5 35-74 33.4 37 16.8 37-16.8z"/><path d="m196.5 101.9 37 16.7v-33.4z"/><path d="m196.5 135.4 37 16.7v-33.5z"/><path d="m196.5 168.8v41.8l37-16.7v-41.8z"/><path d="m270.5 101.9v41.8l37-16.8v-41.7z"/><path d="m344.5 101.9v41.8l37-16.8v-41.7z"/><path d="m159.5 85.2-74 33.4v41.8l74-33.5z"/></g><path d="m159.5 85.2v33.4l37-16.7z" fill="#0f4c81"/><path d="m159.5 118.6v33.5l37-16.7z" fill="#0f4c81"/><path d="m159.5 152.1v41.8l37 16.7v-41.8z" fill="#0f4c81"/><path d="m48.5 101.9v41.8l37 16.7v-41.8z" fill="#0f4c81"/><path d="m233.5 85.2v41.7l37 16.8v-41.8z" fill="#0f4c81"/><path d="m307.5 85.2v41.7l37 16.8v-41.8z" fill="#0f4c81"/><path d="m270.5 35-37-16.8-185 83.7 37 16.7 74-33.4 37 16.7 37-16.7-37-16.8z" fill="#c6d1e0"/><path d="m196.5 135.3 37-16.7-37-16.7-37 16.7z" fill="#c6d1e0"/><path d="m196.5 168.8 37-16.7-37-16.8-37 16.8z" fill="#c6d1e0"/><path d="m233.5 85.2 37 16.7 37-16.7-37-16.8z" fill="#c6d1e0"/><path d="m307.5 85.2 37 16.7 37-16.7-37-16.8z" fill="#c6d1e0"/></g></g><g id="black"><g><path d="m382.9 326.4-37-16.7c-.9-.4-2-.4-2.9 0l-35.6 16.1-35.6-16.1c-.9-.4-2-.4-2.9 0l-35.6 16.1-28.3-12.9 29.9-13.5 37-16.7c2.7-1.1 2.7-5.3 0-6.4l-37-16.7c-.9-.4-2-.4-2.9 0l-185 83.6c-2.7 1.1-2.7 5.3 0 6.4 0 0 37 16.7 37 16.7.5.2 1 .3 1.4.3s1-.1 1.4-.3l72.6-32.8 28.5 12.9-29.9 13.5c-1.3.6-2.1 1.8-2.1 3.2s.8 2.6 2.1 3.2l29.9 13.5-29.9 13.5c-2.7 1.1-2.7 5.3 0 6.4 0 0 37 16.7 37 16.7.9.4 2 .4 2.9 0l37-16.7c2.7-1.1 2.7-5.3 0-6.4l-29.9-13.5 29.9-13.5c1.3-.6 2.1-1.8 2.1-3.2s-.8-2.6-2.1-3.2l-29.9-13.6 28.5-12.9 35.6 16.1c.5.2.9.3 1.4.3s1-.1 1.4-.3l35.6-16.1 35.6 16.1c.5.2 1 .3 1.4.3s1-.1 1.4-.3l37-16.7c2.7-1.1 2.7-5.3 0-6.4zm-157.9 70.1-28.5 12.9-28.5-12.9 25.1-11.3v12.1c0 1.9 1.6 3.5 3.5 3.5s3.5-1.6 3.5-3.5v-12zm0-33.4-28.5 12.9-28.5-12.9 25.1-11.3v11.5c0 1.9 1.6 3.5 3.5 3.5s3.5-1.6 3.5-3.5v-11.4zm-28.5-20.6-35.6-16.1c-.9-.4-2-.4-2.9 0l-72.6 32.8-28.4-12.9 173-78.2v12.1c0 1.9 1.6 3.5 3.5 3.5s3.5-1.6 3.5-3.5v-12.1l25 11.3-66.9 30.3c-1.4.6-2.3 2.3-2 3.8v16.5c.1 4.6 6.9 4.6 7 0v-11.6l24.9 11.3zm74 0-28.5-12.9 25-11.3v11.7c0 1.9 1.6 3.5 3.5 3.5s3.5-1.6 3.5-3.5v-11.7l25 11.3zm74 0-28.5-12.9 25-11.3v11.7c0 1.9 1.6 3.5 3.5 3.5s3.5-1.6 3.5-3.5v-11.7l25 11.3z"/><path d="m48.5 189.7c1.7 0 3-1.3 3-3v-18.2c0-1.7-1.3-3-3-3s-3 1.3-3 3v18.2c0 1.7 1.3 3 3 3z"/><path d="m307.5 168.2c1.7 0 3-1.3 3-3v-18.2c0-1.7-1.3-3-3-3s-3 1.3-3 3v18.2c0 1.7 1.3 3 3 3z"/><path d="m384.5 147.1c0-1.7-1.3-3-3-3s-3 1.3-3 3v18.2c0 1.7 1.3 3 3 3s3-1.3 3-3z"/><path d="m344.5 220.6c1.7 0 3-1.3 3-3v-54.2c0-1.7-1.3-3-3-3s-3 1.3-3 3v54.2c0 1.6 1.3 3 3 3z"/><path d="m341.5 244.6c0 1.7 1.3 3 3 3s3-1.3 3-3v-9.1c0-1.7-1.3-3-3-3s-3 1.3-3 3z"/><path d="m85.3 239.1c1.7 0 3-1.3 3-3v-53.2c0-1.7-1.3-3-3-3s-3 1.3-3 3v53.2c0 1.7 1.4 3 3 3z"/><path d="m82.3 263.1c0 1.7 1.3 3 3 3s3-1.3 3-3v-9.1c0-1.7-1.3-3-3-3s-3 1.3-3 3z"/><circle cx="381.5" cy="182.4" r="3"/><circle cx="307.5" cy="182.4" r="3"/><path d="m48.5 206.9c1.7 0 3-1.3 3-3s-1.3-3-3-3-3 1.3-3 3 1.3 3 3 3z"/><path d="m383.6 80.6-37-16.7c-.7-.3-1.4-.4-2.1-.4s-1.4.1-2.1.4l-34.9 15.8-32-14.5v-30.2c0-2-1.2-3.7-2.9-4.6l-37-16.7c-.7-.3-1.4-.4-2.1-.4s-1.4.1-2.1.4l-185 83.6c-1.8.8-2.9 2.6-2.9 4.6v41.8c0 2 1.2 3.7 2.9 4.6l37 16.7c.7.3 1.4.4 2.1.4s1.4-.1 2.1-.4l66.9-30.3v59.2c0 2 1.2 3.7 2.9 4.6l37 16.7c.7.3 1.4.4 2.1.4s1.4-.1 2.1-.4l37-16.7c1.8-.8 2.9-2.6 2.9-4.6v-59.2l29.9 13.5c.7.3 1.4.4 2.1.4s1.4-.1 2.1-.4l34.9-15.8 34.9 15.8c.7.3 1.4.4 2.1.4s1.4-.1 2.1-.4l37-16.7c1.8-.8 2.9-2.6 2.9-4.6v-41.7c0-2-1.2-3.8-2.9-4.6zm-300.1 76.7-33-14.9v-37.4l33 14.9zm74-31.6-70 31.6v-37.4l65.6-29.6 4.4-2zm2.2-42.5c-.4-.1-.7 0-1.1.2l-73.2 33.1-32.1-14.5 180.1-81.4 32.2 14.4-70 31.6c-1.5.6-1.5 3 0 3.6l33 14.9-32.1 14.5-36.2-16.4c-.2.1-.3 0-.6 0zm4.7 35.4 32.1-14.5 32.1 14.5-32.1 14.5zm27.2 16.8-30.1 13.6v-22-5.2zm-30.1-19.9v-27.2l30.1 13.6zm33 92-33-14.9v-37.4l33 14.9zm2-40.9-32.1-14.5 32.1-14.5 32.1 14.5zm35 26-33 14.9v-37.4l33-14.9zm0-43.6-30.1-13.6 30.1-13.6zm0-33.5-30.1-13.6 30.1-13.6zm-30.1-47.1 67.1-30.4v29.1l-35 15.8zm67.1 72.2-33-14.9v-7-30.4l33 14.9zm-30.1-55.4 32.1-14.5 32.1 14.5-32.1 14.5zm67.1 40.5-33 14.9v-37.4l33-14.9zm37 14.9-33-14.9v-37.4l33 14.9zm-30.2-55.4 32.1-14.5 32.1 14.5c-1.7.8-29.5 13.4-32.1 14.5zm67.2 40.5-33 14.9v-37.4c1.4-.6 32.5-14.7 33-14.9z"/></g></g></svg>
package/es/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from "./src/index";
2
- /** @ts-ignore */
3
- import defaultExport from "./src/index";
4
- export default defaultExport;
package/es/index.js DELETED
@@ -1,5 +0,0 @@
1
- export * from "./src/index";
2
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3
- /** @ts-ignore */
4
- import defaultExport from "./src/index";
5
- export default defaultExport;
package/es/package.json DELETED
@@ -1,92 +0,0 @@
1
- {
2
- "name": "keq",
3
- "main": "lib/index.js",
4
- "module": "es/index.js",
5
- "version": "1.7.2",
6
- "license": "MIT",
7
- "types": "lib/index.d.ts",
8
- "scripts": {
9
- "test": "ava",
10
- "test:debug": "ava --verbose",
11
- "test:update": "ava -u",
12
- "report": "nyc --reporter=html --reporter=text-summary --skip-full ava",
13
- "coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
14
- "ci": "git-cz",
15
- "ca": "git add -A && git-cz -av",
16
- "release": "standard-version",
17
- "release:alpha": "standard-version --prerelease alpha",
18
- "release:first": "standard-version --first-release",
19
- "prepublishOnly": "npm run build",
20
- "clean": "rm -rf ./lib/*",
21
- "prebuild": "npm run clean",
22
- "build:es": "ttsc -p build/tsconfig.es.json && npm run copyfile:es",
23
- "build:lib": "ttsc -p build/tsconfig.lib.json && npm run copyfile:lib",
24
- "build": "npm run build:lib && npm run build:es",
25
- "watch": "NODE_ENV=development ttsc -p build/tsconfig.lib.json -w",
26
- "copyfile:es": "copyfiles -e \"@(build|es|lib|node_modules|tests|doc)/**/*.!(ts)\" -e \"@(README.md|CHANGELOG.md|ava.config.js|backers.md)\" \"**/*.!(ts)\" es",
27
- "copyfile:lib": "copyfiles -e \"@(build|es|lib|node_modules|tests|doc)/**/*.!(ts)\" -e \"@(README.md|CHANGELOG.md|ava.config.js|backers.md)\" \"**/*.!(ts)\" lib",
28
- "prewatch": "npm run copyfile:lib",
29
- "lint": "eslint \"src/**/*.ts\" \"tests/**/*.ts\" --fix",
30
- "prepare": "is-ci || husky install"
31
- },
32
- "devDependencies": {
33
- "@commitlint/cli": "^12.1.4",
34
- "@commitlint/config-conventional": "^12.1.4",
35
- "@istanbuljs/nyc-config-typescript": "^1.0.1",
36
- "@types/sinon": "^9.0.4",
37
- "@typescript-eslint/eslint-plugin": "^4.15.2",
38
- "@typescript-eslint/parser": "^4.15.2",
39
- "ajv": "^8",
40
- "ava": "^3.10.1",
41
- "commitizen": "^4.2.4",
42
- "copyfiles": "^2.4.1",
43
- "coveralls": "^3.1.0",
44
- "cz-conventional-changelog": "^3.3.0",
45
- "eslint": "^7.20.0",
46
- "husky": "^5.2.0",
47
- "is-ci": "^3.0.0",
48
- "lint-staged": "^11.0.0",
49
- "mili": "^4",
50
- "nyc": "^15.1.0",
51
- "sinon": "^10.0.0",
52
- "standard-version": "^9.3.0",
53
- "ts-node": "^9.1.1",
54
- "ttypescript": "^1.5.12",
55
- "typescript": "^4.2.2",
56
- "typescript-transform-paths": "^2.2.3"
57
- },
58
- "dependencies": {
59
- "@types/node": "^14.14.31",
60
- "@types/whatwg-url": "^8.2.1",
61
- "blob": "^0.1.0",
62
- "clone": "^2.1.2",
63
- "cross-fetch": "^3.0.6",
64
- "formidable": "^2.0.1",
65
- "mime-types": "^2.1.27",
66
- "nanoid": "^3.1.10",
67
- "path-to-regexp": "^6.2.0",
68
- "picomatch": "^2.2.2",
69
- "querystring": "^0.2.0",
70
- "ts-custom-error": "^3.2.0",
71
- "whatwg-url": "^11.0.0"
72
- },
73
- "description": "Request API write by Typescript for flexibility, readability, and a low learning curve.",
74
- "directories": {
75
- "doc": "doc",
76
- "lib": "lib",
77
- "test": "tests"
78
- },
79
- "repository": {
80
- "type": "git",
81
- "url": "git+https://github.com/Val-istar-Guo/keq.git"
82
- },
83
- "keywords": [
84
- "request",
85
- "superagent"
86
- ],
87
- "author": "Val.istar.Guo <val.istar.guo@gmail.com>",
88
- "bugs": {
89
- "url": "https://github.com/Val-istar-Guo/keq/issues"
90
- },
91
- "homepage": "https://github.com/Val-istar-Guo/keq#readme"
92
- }
@@ -1,4 +0,0 @@
1
- import { CustomError } from 'ts-custom-error';
2
- export declare class Exception extends CustomError {
3
- constructor(message?: string);
4
- }
@@ -1,7 +0,0 @@
1
- import { CustomError } from 'ts-custom-error';
2
- export class Exception extends CustomError {
3
- constructor(message) {
4
- super(message);
5
- Object.defineProperty(this, 'name', { value: 'KeqError' });
6
- }
7
- }
@@ -1,4 +0,0 @@
1
- import { Exception } from "./exception";
2
- export declare class FileExpectedException extends Exception {
3
- constructor();
4
- }
@@ -1,6 +0,0 @@
1
- import { Exception } from "./exception";
2
- export class FileExpectedException extends Exception {
3
- constructor() {
4
- super('File/Blob (Browser) or Buffer (NodeJS) expected');
5
- }
6
- }
@@ -1,8 +0,0 @@
1
- import { Exception } from './exception'
2
-
3
-
4
- export class FileExpectedException extends Exception {
5
- constructor() {
6
- super('File/Blob (Browser) or Buffer (NodeJS) expected')
7
- }
8
- }
@@ -1,4 +0,0 @@
1
- export * from "./exception";
2
- export * from "./file-expected.exception";
3
- export * from "./overwrite-array-body.exception";
4
- export * from "./unknow-content-type.exception";
@@ -1,4 +0,0 @@
1
- export * from "./exception";
2
- export * from "./file-expected.exception";
3
- export * from "./overwrite-array-body.exception";
4
- export * from "./unknow-content-type.exception";
@@ -1,4 +0,0 @@
1
- import { Exception } from "./exception";
2
- export declare class OverwriteArrayBodyException extends Exception {
3
- constructor();
4
- }
@@ -1,6 +0,0 @@
1
- import { Exception } from "./exception";
2
- export class OverwriteArrayBodyException extends Exception {
3
- constructor() {
4
- super('Cannot merge or overwrite body. Because it has been set as an array.');
5
- }
6
- }
@@ -1,8 +0,0 @@
1
- import { Exception } from './exception'
2
-
3
-
4
- export class OverwriteArrayBodyException extends Exception {
5
- constructor() {
6
- super('Cannot merge or overwrite body. Because it has been set as an array.')
7
- }
8
- }
@@ -1,4 +0,0 @@
1
- import { Exception } from "./exception";
2
- export declare class UnknowContentTypeException extends Exception {
3
- constructor();
4
- }
@@ -1,6 +0,0 @@
1
- import { Exception } from "./exception";
2
- export class UnknowContentTypeException extends Exception {
3
- constructor() {
4
- super('Unknow Content-Type');
5
- }
6
- }
@@ -1,8 +0,0 @@
1
- import { Exception } from './exception'
2
-
3
-
4
- export class UnknowContentTypeException extends Exception {
5
- constructor() {
6
- super('Unknow Content-Type')
7
- }
8
- }