graphql-upload 8.0.0 → 8.0.4
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.
- package/changelog.md +32 -0
- package/lib/processRequest.js +5 -3
- package/lib/processRequest.mjs +4 -2
- package/package.json +29 -24
- package/readme.md +2 -2
package/changelog.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# graphql-upload changelog
|
|
2
2
|
|
|
3
|
+
## 8.0.4
|
|
4
|
+
|
|
5
|
+
### Patch
|
|
6
|
+
|
|
7
|
+
- Updated the [`fs-capacitor`](https://npm.im/fs-capacitor) dependency to v2, fixing [#131](https://github.com/jaydenseric/graphql-upload/issues/131) via [#132](https://github.com/jaydenseric/graphql-upload/pull/132).
|
|
8
|
+
|
|
9
|
+
## 8.0.3
|
|
10
|
+
|
|
11
|
+
### Patch
|
|
12
|
+
|
|
13
|
+
- Updated dependencies. The `busboy` update contains [a bug fix for `.pipe()` on file streams](https://github.com/mscdex/busboy/issues/188).
|
|
14
|
+
- Use [jsDelivr](https://jsdelivr.com) for the readme logo instead of [RawGit](https://rawgit.com) as they are shutting down.
|
|
15
|
+
|
|
16
|
+
## 8.0.2
|
|
17
|
+
|
|
18
|
+
### Patch
|
|
19
|
+
|
|
20
|
+
- Updated dev dependencies.
|
|
21
|
+
- Fixed hanging when a request with a large payload has an “immediate” error, such as a malformed request, fixing [#123](https://github.com/jaydenseric/graphql-upload/issues/123) via [#124](https://github.com/jaydenseric/graphql-upload/pull/124).
|
|
22
|
+
- Moved JSDoc type definitions to the end of files to make it easier to open to the code.
|
|
23
|
+
|
|
24
|
+
## 8.0.1
|
|
25
|
+
|
|
26
|
+
### Patch
|
|
27
|
+
|
|
28
|
+
- Updated dev dependencies.
|
|
29
|
+
- Removed the package `module` field. Webpack by default resolves extensionless paths the same way Node.js in `--experimental-modules` mode does; `.mjs` files are preferred. Tools misconfigured or unable to resolve `.mjs` can get confused when `module` points to an `.mjs` ESM file and they attempt to resolve named imports from `.js` CJS files.
|
|
30
|
+
- Updated package scripts and config for the new [`husky`](https://npm.im/husky) version.
|
|
31
|
+
- Added a package `browserslist` field with the target Node.js version for [`@babel/preset-env`](https://npm.im/@babel/preset-env) and removed related config from `babel.config.js`.
|
|
32
|
+
- Tests now log if the environment is CJS or ESM (`--experimental-modules`) and the `NODE_ENV`.
|
|
33
|
+
- Fixed broken readme API documentation links.
|
|
34
|
+
|
|
3
35
|
## 8.0.0
|
|
4
36
|
|
|
5
37
|
### Major
|
package/lib/processRequest.js
CHANGED
|
@@ -7,12 +7,12 @@ var _util = _interopRequireDefault(require('util'))
|
|
|
7
7
|
|
|
8
8
|
var _busboy = _interopRequireDefault(require('busboy'))
|
|
9
9
|
|
|
10
|
-
var _objectPath = _interopRequireDefault(require('object-path'))
|
|
11
|
-
|
|
12
10
|
var _fsCapacitor = _interopRequireDefault(require('fs-capacitor'))
|
|
13
11
|
|
|
14
12
|
var _httpErrors = _interopRequireDefault(require('http-errors'))
|
|
15
13
|
|
|
14
|
+
var _objectPath = _interopRequireDefault(require('object-path'))
|
|
15
|
+
|
|
16
16
|
function _interopRequireDefault(obj) {
|
|
17
17
|
return obj && obj.__esModule ? obj : { default: obj }
|
|
18
18
|
}
|
|
@@ -66,7 +66,9 @@ const processRequest = (
|
|
|
66
66
|
for (const upload of map.values())
|
|
67
67
|
if (!upload.file) upload.reject(exitError)
|
|
68
68
|
request.unpipe(parser)
|
|
69
|
-
|
|
69
|
+
setImmediate(() => {
|
|
70
|
+
request.resume()
|
|
71
|
+
})
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
const release = () => {
|
package/lib/processRequest.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import util from 'util'
|
|
2
2
|
import Busboy from 'busboy'
|
|
3
|
-
import objectPath from 'object-path'
|
|
4
3
|
import WriteStream from 'fs-capacitor'
|
|
5
4
|
import createError from 'http-errors'
|
|
5
|
+
import objectPath from 'object-path'
|
|
6
6
|
const SPEC_URL = 'https://github.com/jaydenseric/graphql-multipart-request-spec'
|
|
7
7
|
|
|
8
8
|
class Upload {
|
|
@@ -52,7 +52,9 @@ export const processRequest = (
|
|
|
52
52
|
for (const upload of map.values())
|
|
53
53
|
if (!upload.file) upload.reject(exitError)
|
|
54
54
|
request.unpipe(parser)
|
|
55
|
-
|
|
55
|
+
setImmediate(() => {
|
|
56
|
+
request.resume()
|
|
57
|
+
})
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
const release = () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphql-upload",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.4",
|
|
4
4
|
"description": "Middleware and an Upload scalar to add support for GraphQL multipart requests (file uploads via queries and mutations) to various Node.js GraphQL servers.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -28,40 +28,41 @@
|
|
|
28
28
|
"!lib/test.*"
|
|
29
29
|
],
|
|
30
30
|
"main": "lib",
|
|
31
|
-
"module": "lib/index.mjs",
|
|
32
31
|
"engines": {
|
|
33
32
|
"node": ">=8.5"
|
|
34
33
|
},
|
|
34
|
+
"browserslist": "node 8.5",
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"graphql": "0.13.1 - 14"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"busboy": "^0.
|
|
40
|
-
"fs-capacitor": "^
|
|
39
|
+
"busboy": "^0.3.0",
|
|
40
|
+
"fs-capacitor": "^2.0.0",
|
|
41
41
|
"http-errors": "^1.7.1",
|
|
42
42
|
"object-path": "^0.11.4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@babel/cli": "^7.
|
|
46
|
-
"@babel/core": "^7.
|
|
47
|
-
"@babel/preset-env": "^7.
|
|
48
|
-
"babel-eslint": "^
|
|
49
|
-
"eslint": "^5.
|
|
50
|
-
"eslint-config-env": "^
|
|
51
|
-
"eslint-config-prettier": "^3.0
|
|
45
|
+
"@babel/cli": "^7.2.3",
|
|
46
|
+
"@babel/core": "^7.2.2",
|
|
47
|
+
"@babel/preset-env": "^7.2.3",
|
|
48
|
+
"babel-eslint": "^10.0.1",
|
|
49
|
+
"eslint": "^5.12.0",
|
|
50
|
+
"eslint-config-env": "^2.0.0",
|
|
51
|
+
"eslint-config-prettier": "^3.3.0",
|
|
52
52
|
"eslint-plugin-import": "^2.14.0",
|
|
53
|
-
"eslint-plugin-
|
|
54
|
-
"eslint-plugin-
|
|
55
|
-
"
|
|
56
|
-
"
|
|
53
|
+
"eslint-plugin-import-order-alphabetical": "0.0.1",
|
|
54
|
+
"eslint-plugin-node": "^8.0.1",
|
|
55
|
+
"eslint-plugin-prettier": "^3.0.1",
|
|
56
|
+
"express": "^4.16.4",
|
|
57
|
+
"form-data": "^2.3.3",
|
|
57
58
|
"graphql": "^14.0.2",
|
|
58
|
-
"husky": "^
|
|
59
|
-
"jsdoc-md": "^1.
|
|
60
|
-
"koa": "^2.
|
|
61
|
-
"lint-staged": "^
|
|
62
|
-
"node-fetch": "^2.
|
|
63
|
-
"prettier": "^1.
|
|
64
|
-
"tap": "^12.
|
|
59
|
+
"husky": "^1.3.1",
|
|
60
|
+
"jsdoc-md": "^1.7.0",
|
|
61
|
+
"koa": "^2.6.2",
|
|
62
|
+
"lint-staged": "^8.1.0",
|
|
63
|
+
"node-fetch": "^2.3.0",
|
|
64
|
+
"prettier": "^1.15.3",
|
|
65
|
+
"tap": "^12.1.1",
|
|
65
66
|
"watch": "^1.0.2"
|
|
66
67
|
},
|
|
67
68
|
"scripts": {
|
|
@@ -77,8 +78,12 @@
|
|
|
77
78
|
"test:mjs": "node --experimental-modules --no-warnings lib/test | tap-mocha-reporter spec",
|
|
78
79
|
"test:js": "node lib/test | tap-mocha-reporter spec",
|
|
79
80
|
"prepublishOnly": "npm run prepare && npm test",
|
|
80
|
-
"watch": "watch 'npm run prepublishOnly --silent' src --interval 1"
|
|
81
|
-
|
|
81
|
+
"watch": "watch 'npm run prepublishOnly --silent' src --interval 1"
|
|
82
|
+
},
|
|
83
|
+
"husky": {
|
|
84
|
+
"hooks": {
|
|
85
|
+
"pre-commit": "lint-staged"
|
|
86
|
+
}
|
|
82
87
|
},
|
|
83
88
|
"lint-staged": {
|
|
84
89
|
"*.{mjs,js}": "eslint",
|
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-

|
|
2
2
|
|
|
3
3
|
# graphql-upload
|
|
4
4
|
|
|
@@ -32,7 +32,7 @@ To install [`graphql-upload`](https://npm.im/graphql-upload) and the [`graphql`]
|
|
|
32
32
|
npm install graphql-upload graphql
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Use the [`graphqlUploadKoa`](#function-
|
|
35
|
+
Use the [`graphqlUploadKoa`](#function-graphqluploadkoa) or [`graphqlUploadExpress`](#function-graphqluploadexpress) middleware just before GraphQL middleware. Alternatively, use [`processRequest`](#function-processrequest) to create custom middleware.
|
|
36
36
|
|
|
37
37
|
A schema built with separate SDL and resolvers (e.g. using [`makeExecutableSchema`](https://apollographql.com/docs/graphql-tools/generate-schema#makeExecutableSchema)) requires the [`Upload` scalar](#class-graphqlupload) to be setup.
|
|
38
38
|
|