Update dependencies.

Includes prettier v2 lint fixes.
This commit is contained in:
Jayden Seric 2020-03-30 13:00:27 +11:00
parent 69b0c0fde1
commit 919c1d7a50
15 changed files with 686 additions and 437 deletions

166
api/package-lock.json generated
View File

@ -52,14 +52,20 @@
"@babel/highlight": "^7.8.3"
}
},
"@babel/helper-validator-identifier": {
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.0.tgz",
"integrity": "sha512-6G8bQKjOh+of4PV/ThDm/rRqlU7+IGoJuofpagU5GlEl29Vv0RGqqt86ZGRV8ZuSOY3o+8yXl5y782SMcG7SHw==",
"dev": true
},
"@babel/highlight": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.8.3.tgz",
"integrity": "sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg==",
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz",
"integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==",
"dev": true,
"requires": {
"@babel/helper-validator-identifier": "^7.9.0",
"chalk": "^2.0.0",
"esutils": "^2.0.2",
"js-tokens": "^4.0.0"
}
},
@ -156,6 +162,11 @@
"@types/node": "*"
}
},
"@types/content-disposition": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/@types/content-disposition/-/content-disposition-0.5.2.tgz",
"integrity": "sha1-GMyw/RJoCOSYqCDLgUnAByorkGY="
},
"@types/cookies": {
"version": "0.7.4",
"resolved": "https://registry.npmjs.org/@types/cookies/-/cookies-0.7.4.tgz",
@ -186,9 +197,9 @@
}
},
"@types/express-serve-static-core": {
"version": "4.17.2",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.2.tgz",
"integrity": "sha512-El9yMpctM6tORDAiBwZVLMcxoTMcqqRO9dVyYcn7ycLWbvR8klrDn8CAOwRfZujZtWD7yS/mshTdz43jMOejbg==",
"version": "4.17.3",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.3.tgz",
"integrity": "sha512-sHEsvEzjqN+zLbqP+8OXTipc10yH1QLR+hnr5uw29gi9AhCAAAdri8ClNV7iMdrJrIzXIQtlkPvq8tJGhj3QJQ==",
"requires": {
"@types/node": "*",
"@types/range-parser": "*"
@ -224,11 +235,12 @@
"integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw=="
},
"@types/koa": {
"version": "2.11.2",
"resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.11.2.tgz",
"integrity": "sha512-2UPelagNNW6bnc1I5kIzluCaheXRA9S+NyOdXEFFj9Az7jc15ek5V03kb8OTbb3tdZ5i2BIJObe86PhHvpMolg==",
"version": "2.11.3",
"resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.11.3.tgz",
"integrity": "sha512-ABxVkrNWa4O/Jp24EYI/hRNqEVRlhB9g09p48neQp4m3xL1TJtdWk2NyNQSMCU45ejeELMQZBYyfstyVvO2H3Q==",
"requires": {
"@types/accepts": "*",
"@types/content-disposition": "*",
"@types/cookies": "*",
"@types/http-assert": "*",
"@types/keygrip": "*",
@ -271,9 +283,9 @@
"integrity": "sha512-FwI9gX75FgVBJ7ywgnq/P7tw+/o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw=="
},
"@types/node": {
"version": "13.9.1",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.9.1.tgz",
"integrity": "sha512-E6M6N0blf/jiZx8Q3nb0vNaswQeEyn0XlupO+xN6DtJ6r6IT4nXrTry7zhIfYvFCl3/8Cu6WIysmUBKiqV0bqQ=="
"version": "13.9.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-13.9.5.tgz",
"integrity": "sha512-hkzMMD3xu6BrJpGVLeQ3htQQNAcOrJjX7WFmtK8zWQpz2UJf13LCFF2ALA7c9OVdvc2vQJeDdjfR35M0sBCxvw=="
},
"@types/node-fetch": {
"version": "2.5.5",
@ -313,9 +325,9 @@
}
},
"@wry/equality": {
"version": "0.1.9",
"resolved": "https://registry.npmjs.org/@wry/equality/-/equality-0.1.9.tgz",
"integrity": "sha512-mB6ceGjpMGz1ZTza8HYnrPGos2mC6So4NhS1PtZ8s4Qt0K7fBiIGhpSxUbQmhwcSWE3no+bYxmI2OL6KuXYmoQ==",
"version": "0.1.11",
"resolved": "https://registry.npmjs.org/@wry/equality/-/equality-0.1.11.tgz",
"integrity": "sha512-mwEVBDUVODlsQQ5dfuLUS5/Tf7jqUKyhKYHmVi4fPB6bDMOfWvUPJmKgS1Z7Za/sOI3vzWt4+O7yCiL/70MogA==",
"requires": {
"tslib": "^1.9.3"
}
@ -1161,9 +1173,9 @@
"integrity": "sha1-4rPZG1Su1nLzCdlQ0VSFD6EdTzc="
},
"es-abstract": {
"version": "1.17.4",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.4.tgz",
"integrity": "sha512-Ae3um/gb8F0mui/jPL+QiqmglkUsaQf7FwBEHYIFkztkneosu9imhqHpBzQ3h1vit8t5iQ74t6PEVvphBZiuiQ==",
"version": "1.17.5",
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.5.tgz",
"integrity": "sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg==",
"requires": {
"es-to-primitive": "^1.2.1",
"function-bind": "^1.1.1",
@ -1254,12 +1266,12 @@
}
},
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz",
"integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==",
"dev": true,
"requires": {
"minimist": "0.0.8"
"minimist": "^1.2.5"
}
},
"ms": {
@ -1290,9 +1302,9 @@
}
},
"eslint-config-prettier": {
"version": "6.10.0",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.10.0.tgz",
"integrity": "sha512-AtndijGte1rPILInUdHjvKEGbIV06NuvPrqlIEaEaWtbtvJh464mDeyGMdZEQMsGvC0ZVkiex1fSNcC4HAbRGg==",
"version": "6.10.1",
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.10.1.tgz",
"integrity": "sha512-svTy6zh1ecQojvpbJSgH3aei/Rt7C6i090l5f2WQ4aB05lYHeZIR1qL4wZyyILTbtmnbHP5Yn8MrsOJMGa8RkQ==",
"dev": true,
"requires": {
"get-stdin": "^6.0.0"
@ -1320,9 +1332,9 @@
}
},
"eslint-module-utils": {
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.5.2.tgz",
"integrity": "sha512-LGScZ/JSlqGKiT8OC+cYRxseMjyqt6QO54nl281CK93unD89ijSeRV6An8Ci/2nvWVKe8K/Tqdm75RQoIOCr+Q==",
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.6.0.tgz",
"integrity": "sha512-6j9xxegbqe8/kZY8cYpcp0xhbK0EgJlg3g9mib3/miLaExuuwc3n5UEfSnU6hWMbT0FAYVvDbL9RrRgpUeQIvA==",
"dev": true,
"requires": {
"debug": "^2.6.9",
@ -1368,9 +1380,9 @@
}
},
"eslint-plugin-import": {
"version": "2.20.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.20.1.tgz",
"integrity": "sha512-qQHgFOTjguR+LnYRoToeZWT62XM55MBVXObHM6SKFd1VzDcX/vqT1kAz8ssqigh5eMj8qXcRoXXGZpPP6RfdCw==",
"version": "2.20.2",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.20.2.tgz",
"integrity": "sha512-FObidqpXrR8OnCh4iNsxy+WACztJLXAHBO5hK79T1Hc77PgQZkyDGA5Ag9xAvRpglvLNxhH/zSmZ70/pZ31dHg==",
"dev": true,
"requires": {
"array-includes": "^3.0.3",
@ -1485,9 +1497,9 @@
}
},
"eslint-plugin-jsdoc": {
"version": "22.0.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-22.0.1.tgz",
"integrity": "sha512-lqQgGtd+roOhd5lSdIK4P3mlDmTVmVdcehj/r8nY25CGB2yi4Tk6JVwETCPBGnRKd40JkllkchyZmt0tFN+5pw==",
"version": "22.1.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-22.1.0.tgz",
"integrity": "sha512-54NdbICM7KrxsGUqQsev9aIMqPXyvyBx2218Qcm0TQ16P9CtBI+YY4hayJR6adrxlq4Ej0JLpgfUXWaQVFqmQg==",
"dev": true,
"requires": {
"comment-parser": "^0.7.2",
@ -1517,9 +1529,9 @@
}
},
"eslint-plugin-node": {
"version": "11.0.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.0.0.tgz",
"integrity": "sha512-chUs/NVID+sknFiJzxoN9lM7uKSOEta8GC8365hw1nDfwIPIjjpRSwwPvQanWv8dt/pDe9EV4anmVSwdiSndNg==",
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz",
"integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==",
"dev": true,
"requires": {
"eslint-plugin-es": "^3.0.0",
@ -1599,12 +1611,20 @@
"dev": true
},
"esquery": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.1.0.tgz",
"integrity": "sha512-MxYW9xKmROWF672KqjO75sszsA8Mxhw06YFeS5VHlB98KDHbOSurm3ArsjO60Eaf3QmGMCP1yn+0JQkNLo/97Q==",
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.2.0.tgz",
"integrity": "sha512-weltsSqdeWIX9G2qQZz7KlTRJdkkOCTPgLYJUz1Hacf48R4YOwGPHO3+ORfWedqJKbq5WQmsgK90n+pFLIKt/Q==",
"dev": true,
"requires": {
"estraverse": "^4.0.0"
"estraverse": "^5.0.0"
},
"dependencies": {
"estraverse": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.0.0.tgz",
"integrity": "sha512-j3acdrMzqrxmJTNj5dbr1YbjacrYgAxVMeF0gK16E3j494mOe7xygM/ZLIguEQ0ETwAg2hlJCtHRGav+y0Ny5A==",
"dev": true
}
}
},
"esrecurse": {
@ -1760,9 +1780,9 @@
}
},
"flatted": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.1.tgz",
"integrity": "sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==",
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz",
"integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==",
"dev": true
},
"form-data": {
@ -1836,9 +1856,9 @@
}
},
"glob-parent": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz",
"integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==",
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz",
"integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==",
"dev": true,
"requires": {
"is-glob": "^4.0.1"
@ -2374,9 +2394,9 @@
}
},
"koa-bodyparser": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/koa-bodyparser/-/koa-bodyparser-4.2.1.tgz",
"integrity": "sha512-UIjPAlMZfNYDDe+4zBaOAUKYqkwAGcIU6r2ARf1UOXPAlfennQys5IiShaVeNf7KkVBlf88f2LeLvBFvKylttw==",
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/koa-bodyparser/-/koa-bodyparser-4.3.0.tgz",
"integrity": "sha512-uyV8G29KAGwZc4q/0WUAjH+Tsmuv9ImfBUF2oZVyZtaeo0husInagyn/JH85xMSxM0hEk/mbCII5ubLDuqW/Rw==",
"requires": {
"co-body": "^6.0.0",
"copy-to": "^2.0.1"
@ -2581,9 +2601,9 @@
}
},
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true
},
"mkdirp": {
@ -2944,9 +2964,9 @@
}
},
"picomatch": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.1.tgz",
"integrity": "sha512-ISBaA8xQNmwELC7eOjqFKMESB2VIqt4PPDD0nsS95b/9dZXvVKOlz9keMSnoGGKcOHXfTvDD6WMaRoSc9UuhRA==",
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
"integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
"dev": true
},
"pify": {
@ -3027,9 +3047,9 @@
"dev": true
},
"prettier": {
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
"integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.2.tgz",
"integrity": "sha512-5xJQIPT8BraI7ZnaDwSbu5zLrB6vvi8hVV58yHQ+QK64qrY40dULy0HSRlQ2/2IdzeBpjhDkqdcFBnFeDEMVdg==",
"dev": true
},
"prettier-linter-helpers": {
@ -3074,9 +3094,9 @@
"dev": true
},
"qs": {
"version": "6.9.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.1.tgz",
"integrity": "sha512-Cxm7/SS/y/Z3MHWSxXb8lIFqgqBowP5JMlTUFyJN88y0SGQhVmZnqFK/PeuMX9LzUyWsqqhNxIyg0jlzq946yA=="
"version": "6.9.3",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.3.tgz",
"integrity": "sha512-EbZYNarm6138UKKq46tdx08Yo/q9ZhFoAXAI1meAFd2GtbRDhbZY2WQSICskT0c5q99aFzLG1D4nvTk9tqfXIw=="
},
"raw-body": {
"version": "2.4.1",
@ -3101,12 +3121,6 @@
"strip-json-comments": "~2.0.1"
},
"dependencies": {
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true
},
"strip-json-comments": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
@ -3314,9 +3328,9 @@
}
},
"signal-exit": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
"dev": true
},
"slice-ansi": {
@ -3834,12 +3848,12 @@
},
"dependencies": {
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.4.tgz",
"integrity": "sha512-iG9AK/dJLtJ0XNgTuDbSyNS3zECqDlAhnQW4CsNxBG3LQJBbHmRX1egw39DmtOdCAqY+dKXV+sgPgilNWUKMVw==",
"dev": true,
"requires": {
"minimist": "0.0.8"
"minimist": "^1.2.5"
}
}
}

View File

@ -23,13 +23,13 @@
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-env": "^13.0.4",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsdoc": "^22.0.1",
"eslint-plugin-node": "^11.0.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsdoc": "^22.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.2",
"nodemon": "^2.0.2",
"prettier": "^1.19.1"
"prettier": "^2.0.2"
},
"scripts": {
"test": "npm run test:eslint && npm run test:prettier",

View File

@ -6,5 +6,5 @@ const { QueryType } = require('./types/Query')
exports.schema = new GraphQLSchema({
query: QueryType,
mutation: MutationType
mutation: MutationType,
})

View File

@ -24,7 +24,7 @@ mkdirp.sync(UPLOAD_DIR)
* @param {GraphQLUpload} upload GraphQL file upload.
* @returns {object} File metadata.
*/
const storeUpload = async upload => {
const storeUpload = async (upload) => {
const { createReadStream, filename, mimetype } = await upload
const stream = createReadStream()
const id = shortid.generate()
@ -41,7 +41,7 @@ const storeUpload = async upload => {
// If there's an error writing the file, remove the partially written file
// and reject the promise.
writeStream.on('error', error => {
writeStream.on('error', (error) => {
unlink(path, () => {
reject(error)
})
@ -50,16 +50,14 @@ const storeUpload = async upload => {
// In node <= 13, errors are not automatically propagated between piped
// streams. If there is an error receiving the upload, destroy the write
// stream with the corresponding error.
stream.on('error', error => writeStream.destroy(error))
stream.on('error', (error) => writeStream.destroy(error))
// Pipe the upload into the write stream.
stream.pipe(writeStream)
})
// Record the file metadata in the DB.
db.get('uploads')
.push(file)
.write()
db.get('uploads').push(file).write()
return file
}
@ -72,15 +70,15 @@ const server = new ApolloServer({
// graphql-upload:
// https://github.com/jaydenseric/graphql-upload#type-processrequestoptions
maxFileSize: 10000000, // 10 MB
maxFiles: 20
maxFiles: 20,
},
schema,
context: { db, storeUpload }
context: { db, storeUpload },
})
server.applyMiddleware({ app })
app.listen(process.env.PORT, error => {
app.listen(process.env.PORT, (error) => {
if (error) throw error
console.info(

View File

@ -4,7 +4,7 @@ const {
GraphQLNonNull,
GraphQLObjectType,
GraphQLString,
GraphQLID
GraphQLID,
} = require('graphql')
exports.FileType = new GraphQLObjectType({
@ -13,19 +13,19 @@ exports.FileType = new GraphQLObjectType({
fields: () => ({
id: {
description: 'Unique ID.',
type: GraphQLNonNull(GraphQLID)
type: GraphQLNonNull(GraphQLID),
},
path: {
description: 'Where its stored in the filesystem.',
type: GraphQLNonNull(GraphQLString)
type: GraphQLNonNull(GraphQLString),
},
filename: {
description: 'Filename, including extension.',
type: GraphQLNonNull(GraphQLString)
type: GraphQLNonNull(GraphQLString),
},
mimetype: {
description: 'MIME type.',
type: GraphQLNonNull(GraphQLString)
}
})
type: GraphQLNonNull(GraphQLString),
},
}),
})

View File

@ -14,10 +14,10 @@ exports.MutationType = new GraphQLObjectType({
args: {
file: {
description: 'File to store.',
type: GraphQLNonNull(GraphQLUpload)
}
type: GraphQLNonNull(GraphQLUpload),
},
},
resolve: (parent, { file }, { storeUpload }) => storeUpload(file)
resolve: (parent, { file }, { storeUpload }) => storeUpload(file),
},
multipleUpload: {
description: 'Stores multiple files.',
@ -25,8 +25,8 @@ exports.MutationType = new GraphQLObjectType({
args: {
files: {
description: 'Files to store.',
type: GraphQLNonNull(GraphQLList(GraphQLNonNull(GraphQLUpload)))
}
type: GraphQLNonNull(GraphQLList(GraphQLNonNull(GraphQLUpload))),
},
},
async resolve(parent, { files }, { storeUpload }) {
const { resolve, reject } = await promisesAll.all(
@ -39,7 +39,7 @@ exports.MutationType = new GraphQLObjectType({
)
return resolve
}
}
})
},
},
}),
})

View File

@ -9,7 +9,7 @@ exports.QueryType = new GraphQLObjectType({
uploads: {
description: 'All stored files.',
type: GraphQLNonNull(GraphQLList(GraphQLNonNull(FileType))),
resolve: (source, args, { db }) => db.get('uploads').value()
}
})
resolve: (source, args, { db }) => db.get('uploads').value(),
},
}),
})

View File

@ -1,4 +1,4 @@
export const Header = props => (
export const Header = (props) => (
<>
<header {...props} />
<style jsx>{`

View File

@ -1,4 +1,4 @@
export const Section = props => (
export const Section = (props) => (
<>
<section {...props} />
<style jsx>{`

View File

@ -21,7 +21,7 @@ export const UploadBlob = () => {
const onNameChange = ({ target: { value } }) => setName(value)
const onContentChange = ({ target: { value } }) => setContent(value)
const onSubmit = event => {
const onSubmit = (event) => {
event.preventDefault()
const file = new Blob([content], { type: 'text/plain' })

View File

@ -16,8 +16,8 @@ export const UploadFile = () => {
const onChange = ({
target: {
validity,
files: [file]
}
files: [file],
},
}) =>
validity.valid &&
uploadFileMutation({ variables: { file } }).then(() => {

View File

@ -1,5 +1,5 @@
module.exports = {
env: {
API_URI: process.env.API_URI
}
API_URI: process.env.API_URI,
},
}

853
app/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -23,22 +23,22 @@
"dotenv-cli": "^3.1.0",
"graphql": "^14.6.0",
"graphql-tag": "^2.10.3",
"next": "^9.3.0",
"react": "^16.13.0",
"react-dom": "^16.13.0"
"next": "^9.3.2",
"react": "^16.13.1",
"react-dom": "^16.13.1"
},
"devDependencies": {
"babel-eslint": "^10.1.0",
"eslint": "^6.8.0",
"eslint-config-env": "^13.0.4",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-import": "^2.20.1",
"eslint-plugin-jsdoc": "^22.0.1",
"eslint-plugin-node": "^11.0.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsdoc": "^22.1.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^2.5.0",
"prettier": "^1.19.1"
"eslint-plugin-react-hooks": "^3.0.0",
"prettier": "^2.0.2"
},
"scripts": {
"test": "npm run test:eslint && npm run test:prettier",

View File

@ -10,14 +10,14 @@ const createApolloClient = (cache = {}) =>
new ApolloClient({
ssrMode: typeof window !== 'undefined',
cache: new InMemoryCache().restore(cache),
link: createUploadLink({ uri: process.env.API_URI })
link: createUploadLink({ uri: process.env.API_URI }),
})
const App = ({
Component,
pageProps,
apolloCache,
apolloClient = createApolloClient(apolloCache)
apolloClient = createApolloClient(apolloCache),
}) => (
<ApolloProvider client={apolloClient}>
<Head>
@ -36,11 +36,11 @@ const App = ({
</ApolloProvider>
)
App.getInitialProps = async context => {
App.getInitialProps = async (context) => {
const props = {
pageProps: context.Component.getInitialProps
? await context.Component.getInitialProps(context)
: {}
: {},
}
if (context.ctx.req) {