graphql-upload
Advanced tools
Comparing version 11.0.0 to 12.0.0
# graphql-upload changelog | ||
## 12.0.0 | ||
### Major | ||
- Updated Node.js support to `^12.20 || >= 14.13`. | ||
- Updated dev dependencies, some of which require newer Node.js versions than previously supported. | ||
- The tests are now ESM in `.mjs` files instead of CJS in `.js` files. | ||
- Replaced the the `package.json` `exports` field public [subpath folder mapping](https://nodejs.org/api/packages.html#packages_subpath_folder_mappings) (deprecated by Node.js) with a [subpath pattern](https://nodejs.org/api/packages.html#packages_subpath_patterns). Deep `require` paths must now include the `.js` file extension. | ||
### Minor | ||
- Added a package `sideEffects` field. | ||
### Patch | ||
- Updated dependencies. | ||
- Lint fixes for the updated Prettier version. | ||
- Updated GitHub Actions CI config: | ||
- Updated the tested Node.js versions to v12, v14, v16. | ||
- Updated `actions/checkout` to v2. | ||
- Updated `actions/setup-node` to v2. | ||
- Simplify config with the [`npm install-test`](https://docs.npmjs.com/cli/v7/commands/npm-install-test) command. | ||
- Don’t specify the `CI` environment variable as it’s set by default. | ||
- Removed `npm-debug.log` from the `.gitignore` file as npm [v4.2.0](https://github.com/npm/npm/releases/tag/v4.2.0)+ doesn’t create it in the current working directory. | ||
- Updated the EditorConfig URL. | ||
- Updated the package `keywords` field. | ||
- More specific package `main` field path. | ||
- Simplified JSDoc related package scripts now that [`jsdoc-md`](https://npm.im/jsdoc-md) v10 automatically generates a Prettier formatted readme. | ||
- Added a package `test:jsdoc` script that checks the readme API docs are up to date with the source JSDoc. | ||
- Refactored private constants from exports of a single module to individual modules. | ||
- Fixed test name and comment typos. | ||
- Updated external URLs in docs. | ||
- Prettier format for a JSDoc code example. | ||
- Updated a `GraphQLUpload` code example to use [`@graphql-tools/schema`](https://npm.im/@graphql-tools/schema) instead of [`graphql-tools`](https://npm.im/graphql-tools). | ||
- Removed from the readme the notice that the package was previously published as [`apollo-upload-server`](https://npm.im/apollo-upload-server). | ||
- Simplified the readme “Setup” and “Support” sections. | ||
## 11.0.0 | ||
@@ -4,0 +41,0 @@ |
{ | ||
"name": "graphql-upload", | ||
"version": "11.0.0", | ||
"version": "12.0.0", | ||
"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.", | ||
@@ -20,3 +20,5 @@ "license": "MIT", | ||
"multipart", | ||
"request", | ||
"server", | ||
"middleware", | ||
"koa", | ||
@@ -32,3 +34,4 @@ "express", | ||
], | ||
"main": "public", | ||
"sideEffects": false, | ||
"main": "./public/index.js", | ||
"exports": { | ||
@@ -39,3 +42,3 @@ ".": { | ||
}, | ||
"./public/": "./public/", | ||
"./public/*": "./public/*", | ||
"./package": "./package.json", | ||
@@ -45,3 +48,3 @@ "./package.json": "./package.json" | ||
"engines": { | ||
"node": "^10.13.0 || ^12.0.0 || >= 13.7.0" | ||
"node": "^12.20 || >= 14.13" | ||
}, | ||
@@ -53,36 +56,35 @@ "peerDependencies": { | ||
"busboy": "^0.3.1", | ||
"fs-capacitor": "^6.1.0", | ||
"http-errors": "^1.7.3", | ||
"fs-capacitor": "^6.2.0", | ||
"http-errors": "^1.8.0", | ||
"isobject": "^4.0.0", | ||
"object-path": "^0.11.4" | ||
"object-path": "^0.11.5" | ||
}, | ||
"devDependencies": { | ||
"coverage-node": "^2.0.3", | ||
"eslint": "^7.1.0", | ||
"eslint-config-env": "^14.0.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-import": "^2.20.2", | ||
"eslint-plugin-jsdoc": "^25.4.2", | ||
"coverage-node": "^5.0.1", | ||
"eslint": "^7.25.0", | ||
"eslint-config-env": "^19.0.2", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.22.1", | ||
"eslint-plugin-jsdoc": "^33.1.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"express": "^4.17.1", | ||
"form-data": "^3.0.0", | ||
"graphql": "^15.0.0", | ||
"form-data": "^4.0.0", | ||
"graphql": "^15.5.0", | ||
"hard-rejection": "^2.1.0", | ||
"jsdoc-md": "^6.0.0", | ||
"koa": "^2.12.0", | ||
"node-fetch": "^2.6.0", | ||
"prettier": "^2.0.5", | ||
"test-director": "^4.0.1" | ||
"jsdoc-md": "^10.1.0", | ||
"koa": "^2.13.1", | ||
"node-fetch": "^2.6.1", | ||
"prettier": "^2.2.1", | ||
"test-director": "^6.0.0" | ||
}, | ||
"scripts": { | ||
"prepare": "npm run prepare:jsdoc && npm run prepare:prettier", | ||
"prepare:jsdoc": "jsdoc-md", | ||
"prepare:prettier": "prettier --write readme.md", | ||
"test": "npm run test:eslint && npm run test:prettier && npm run test:api", | ||
"jsdoc": "jsdoc-md", | ||
"test": "npm run test:eslint && npm run test:prettier && npm run test:jsdoc && npm run test:api", | ||
"test:eslint": "eslint .", | ||
"test:prettier": "prettier -c .", | ||
"test:api": "coverage-node -r hard-rejection/register test", | ||
"test:jsdoc": "jsdoc-md -c", | ||
"test:api": "coverage-node -r hard-rejection/register test/index.mjs", | ||
"prepublishOnly": "npm test" | ||
} | ||
} |
@@ -0,1 +1,5 @@ | ||
// One of the JSDoc code examples contains `*/` escaped using `*\/`, see: | ||
// https://github.com/gajus/eslint-plugin-jsdoc/issues/710 | ||
/* eslint-disable jsdoc/check-examples */ | ||
'use strict'; | ||
@@ -27,7 +31,7 @@ | ||
* ```js | ||
* const GraphQLUpload = require('graphql-upload/public/GraphQLUpload'); | ||
* const GraphQLUpload = require('graphql-upload/public/GraphQLUpload.js'); | ||
* ``` | ||
* @example <caption>Setup for a schema built with [`makeExecutableSchema`](https://apollographql.com/docs/graphql-tools/generate-schema#makeExecutableSchema).</caption> | ||
* @example <caption>A schema built using [`makeExecutableSchema`](https://www.graphql-tools.com/docs/api/modules/schema#makeexecutableschema) from [`@graphql-tools/schema`](https://npm.im/@graphql-tools/schema).</caption> | ||
* ```js | ||
* const { makeExecutableSchema } = require('graphql-tools'); | ||
* const { makeExecutableSchema } = require('@graphql-tools/schema'); | ||
* const { GraphQLUpload } = require('graphql-upload'); | ||
@@ -46,7 +50,3 @@ * | ||
* ```js | ||
* const { | ||
* GraphQLSchema, | ||
* GraphQLObjectType, | ||
* GraphQLBoolean, | ||
* } = require('graphql'); | ||
* const { GraphQLSchema, GraphQLObjectType, GraphQLBoolean } = require('graphql'); | ||
* const { GraphQLUpload } = require('graphql-upload'); | ||
@@ -53,0 +53,0 @@ * |
@@ -31,3 +31,3 @@ 'use strict'; | ||
* ```js | ||
* const graphqlUploadExpress = require('graphql-upload/public/graphqlUploadExpress'); | ||
* const graphqlUploadExpress = require('graphql-upload/public/graphqlUploadExpress.js'); | ||
* ``` | ||
@@ -34,0 +34,0 @@ * @example <caption>Basic [`express-graphql`](https://npm.im/express-graphql) setup.</caption> |
@@ -31,3 +31,3 @@ 'use strict'; | ||
* ```js | ||
* const graphqlUploadKoa = require('graphql-upload/public/graphqlUploadKoa'); | ||
* const graphqlUploadKoa = require('graphql-upload/public/graphqlUploadKoa.js'); | ||
* ``` | ||
@@ -34,0 +34,0 @@ * @example <caption>Basic [`graphql-api-koa`](https://npm.im/graphql-api-koa) setup.</caption> |
@@ -23,3 +23,7 @@ 'use strict'; | ||
/** | ||
* Creates a [Node.js readable stream](https://nodejs.org/api/stream.html#stream_readable_streams) of an [uploading file’s]{@link FileUpload} contents, for processing and storage. Multiple calls create independent streams. Throws if called after all resolvers have resolved, or after an error has interrupted the request. | ||
* Creates a | ||
* [Node.js readable stream](https://nodejs.org/api/stream.html#stream_readable_streams) | ||
* of an [uploading file’s]{@link FileUpload} contents, for processing and | ||
* storage. Multiple calls create independent streams. Throws if called after | ||
* all resolvers have resolved, or after an error has interrupted the request. | ||
* @kind typedef | ||
@@ -33,3 +37,3 @@ * @name FileUploadCreateReadStream | ||
* @see [Node.js `Readable` stream constructor docs](https://nodejs.org/api/stream.html#stream_new_stream_readable_options). | ||
* @see [Node.js stream backpressure guide](https://nodejs.org/es/docs/guides/backpressuring-in-streams). | ||
* @see [Node.js stream backpressure guide](https://nodejs.org/en/docs/guides/backpressuring-in-streams). | ||
*/ | ||
@@ -46,8 +50,9 @@ | ||
* @prop {object|null} [variables] GraphQL document operation variables and values map. | ||
* @see [GraphQL over HTTP spec](https://github.com/APIs-guru/graphql-over-http#request-parameters). | ||
* @see [Apollo Server POST requests](https://www.apollographql.com/docs/apollo-server/requests#postRequests). | ||
* @see [GraphQL over HTTP spec](https://github.com/graphql/graphql-over-http). | ||
* @see [Apollo Server POST requests](https://www.apollographql.com/docs/apollo-server/requests/#post-requests). | ||
*/ | ||
/** | ||
* Processes a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec). | ||
* Processes a | ||
* [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec). | ||
* @kind typedef | ||
@@ -64,3 +69,4 @@ * @name ProcessRequestFunction | ||
/** | ||
* Options for processing a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec); | ||
* Options for processing a | ||
* [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec); | ||
* mostly relating to security, performance and limits. | ||
@@ -67,0 +73,0 @@ * @kind typedef |
@@ -8,3 +8,3 @@ 'use strict'; | ||
const objectPath = require('object-path'); | ||
const { SPEC_URL } = require('../private/constants'); | ||
const GRAPHQL_MULTIPART_REQUEST_SPEC_URL = require('../private/GRAPHQL_MULTIPART_REQUEST_SPEC_URL'); | ||
const ignoreStream = require('../private/ignoreStream'); | ||
@@ -14,3 +14,4 @@ const Upload = require('./Upload'); | ||
/** | ||
* Processes a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec). | ||
* Processes a | ||
* [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec). | ||
* It parses the `operations` and `map` fields to create an | ||
@@ -20,8 +21,8 @@ * [`Upload`]{@link Upload} instance for each expected file upload, placing | ||
* [GraphQL operation]{@link GraphQLOperation} for the | ||
* [`Upload` scalar]{@link GraphQLUpload} to derive it’s value. Errors are | ||
* created with [`http-errors`](https://npm.im/http-errors) to assist in | ||
* sending responses with appropriate HTTP status codes. Used in | ||
* [`Upload`]{@link GraphQLUpload} scalar to derive it’s value. Errors are | ||
* created with [`http-errors`](https://npm.im/http-errors) to assist in sending | ||
* responses with appropriate HTTP status codes. Used in | ||
* [`graphqlUploadExpress`]{@link graphqlUploadExpress} and | ||
* [`graphqlUploadKoa`]{@link graphqlUploadKoa} and can be used to create | ||
* custom middleware. | ||
* [`graphqlUploadKoa`]{@link graphqlUploadKoa} and can be used to create custom | ||
* middleware. | ||
* @kind function | ||
@@ -44,3 +45,3 @@ * @name processRequest | ||
* ```js | ||
* const processRequest = require('graphql-upload/public/processRequest'); | ||
* const processRequest = require('graphql-upload/public/processRequest.js'); | ||
* ``` | ||
@@ -159,3 +160,3 @@ */ | ||
400, | ||
`Invalid JSON in the ‘operations’ multipart field (${SPEC_URL}).` | ||
`Invalid JSON in the ‘operations’ multipart field (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL}).` | ||
) | ||
@@ -169,3 +170,3 @@ ); | ||
400, | ||
`Invalid type for the ‘operations’ multipart field (${SPEC_URL}).` | ||
`Invalid type for the ‘operations’ multipart field (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL}).` | ||
) | ||
@@ -182,3 +183,3 @@ ); | ||
400, | ||
`Misordered multipart fields; ‘map’ should follow ‘operations’ (${SPEC_URL}).` | ||
`Misordered multipart fields; ‘map’ should follow ‘operations’ (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL}).` | ||
) | ||
@@ -194,3 +195,3 @@ ); | ||
400, | ||
`Invalid JSON in the ‘map’ multipart field (${SPEC_URL}).` | ||
`Invalid JSON in the ‘map’ multipart field (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL}).` | ||
) | ||
@@ -204,3 +205,3 @@ ); | ||
400, | ||
`Invalid type for the ‘map’ multipart field (${SPEC_URL}).` | ||
`Invalid type for the ‘map’ multipart field (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL}).` | ||
) | ||
@@ -211,4 +212,4 @@ ); | ||
// Check max files is not exceeded, even though the number of files to | ||
// parse might not match th(e map provided by the client. | ||
// Check max files is not exceeded, even though the number of files | ||
// to parse might not match the map provided by the client. | ||
if (mapEntries.length > maxFiles) | ||
@@ -225,3 +226,3 @@ return exit( | ||
400, | ||
`Invalid type for the ‘map’ multipart field entry key ‘${fieldName}’ array (${SPEC_URL}).` | ||
`Invalid type for the ‘map’ multipart field entry key ‘${fieldName}’ array (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL}).` | ||
) | ||
@@ -237,3 +238,3 @@ ); | ||
400, | ||
`Invalid type for the ‘map’ multipart field entry key ‘${fieldName}’ array index ‘${index}’ value (${SPEC_URL}).` | ||
`Invalid type for the ‘map’ multipart field entry key ‘${fieldName}’ array index ‘${index}’ value (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL}).` | ||
) | ||
@@ -248,3 +249,3 @@ ); | ||
400, | ||
`Invalid object path for the ‘map’ multipart field entry key ‘${fieldName}’ array index ‘${index}’ value ‘${path}’ (${SPEC_URL}).` | ||
`Invalid object path for the ‘map’ multipart field entry key ‘${fieldName}’ array index ‘${index}’ value ‘${path}’ (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL}).` | ||
) | ||
@@ -273,3 +274,3 @@ ); | ||
400, | ||
`Misordered multipart fields; files should follow ‘map’ (${SPEC_URL}).` | ||
`Misordered multipart fields; files should follow ‘map’ (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL}).` | ||
) | ||
@@ -345,3 +346,3 @@ ); | ||
400, | ||
`Missing multipart field ‘operations’ (${SPEC_URL}).` | ||
`Missing multipart field ‘operations’ (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL}).` | ||
) | ||
@@ -352,3 +353,6 @@ ); | ||
return exit( | ||
createError(400, `Missing multipart field ‘map’ (${SPEC_URL}).`) | ||
createError( | ||
400, | ||
`Missing multipart field ‘map’ (${GRAPHQL_MULTIPART_REQUEST_SPEC_URL}).` | ||
) | ||
); | ||
@@ -355,0 +359,0 @@ |
@@ -9,3 +9,3 @@ 'use strict'; | ||
* [GraphQL operation]{@link GraphQLOperation}. The | ||
* [`Upload` scalar]{@link GraphQLUpload} derives it’s value from the | ||
* [`Upload`]{@link GraphQLUpload} scalar derives it’s value from the | ||
* [`promise`]{@link Upload#promise} property. | ||
@@ -28,3 +28,3 @@ * @kind class | ||
* ```js | ||
* const Upload = require('graphql-upload/public/Upload'); | ||
* const Upload = require('graphql-upload/public/Upload.js'); | ||
* ``` | ||
@@ -31,0 +31,0 @@ */ |
@@ -7,28 +7,11 @@ ![graphql-upload logo](https://cdn.jsdelivr.net/gh/jaydenseric/graphql-upload@8.0.0/graphql-upload-logo.svg) | ||
Middleware and an [`Upload` scalar](#class-graphqlupload) to add support for [GraphQL multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec) (file uploads via queries and mutations) to various Node.js GraphQL servers. | ||
Middleware and an [`Upload`](#class-graphqlupload) scalar to add support for [GraphQL multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec) (file uploads via queries and mutations) to various Node.js GraphQL servers. | ||
⚠️ Previously published as [`apollo-upload-server`](https://npm.im/apollo-upload-server). | ||
## Support | ||
The following environments are known to be compatible: | ||
- [Node.js](https://nodejs.org) `^10.13.0 || ^12.0.0 || >= 13.7.0` | ||
- [Koa](https://koajs.com) | ||
- [`graphql-api-koa`](https://npm.im/graphql-api-koa) | ||
- [`koa-graphql`](https://npm.im/koa-graphql) | ||
- [`apollo-server-koa`](https://npm.im/apollo-server-koa) (inbuilt) | ||
- [Express](https://expressjs.com) | ||
- [`express-graphql`](https://npm.im/express-graphql) | ||
- [`apollo-server-express`](https://npm.im/apollo-server-express) (inbuilt) | ||
See also [GraphQL multipart request spec server implementations](https://github.com/jaydenseric/graphql-multipart-request-spec#server). | ||
## Setup | ||
Setup is necessary if your environment doesn’t feature this package inbuilt (see **_[Support](#support)_**). | ||
First, check if there are [GraphQL multipart request spec server implementations](https://github.com/jaydenseric/graphql-multipart-request-spec#server) (most for Node.js integrate [`graphql-upload`](https://npm.im/graphql-upload)) that are more suitable for your environment than a manual setup. | ||
To install [`graphql-upload`](https://npm.im/graphql-upload) and the [`graphql`](https://npm.im/graphql) peer dependency from [npm](https://npmjs.com) run: | ||
To install [`graphql-upload`](https://npm.im/graphql-upload) and the [`graphql`](https://npm.im/graphql) peer dependency with [npm](https://npmjs.com/get-npm), run: | ||
```shell | ||
```sh | ||
npm install graphql-upload graphql | ||
@@ -39,7 +22,7 @@ ``` | ||
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. | ||
A schema built with separate SDL and resolvers (e.g. using [`makeExecutableSchema`](https://www.graphql-tools.com/docs/api/modules/schema#makeexecutableschema) from [`@graphql-tools/schema`](https://npm.im/@graphql-tools/schema)) requires the [`Upload`](#class-graphqlupload) scalar to be setup. | ||
## Usage | ||
[Clients implementing the GraphQL multipart request spec](https://github.com/jaydenseric/graphql-multipart-request-spec#client) upload files as [`Upload` scalar](#class-graphqlupload) query or mutation variables. Their resolver values are promises that resolve [file upload details](#type-fileupload) for processing and storage. Files are typically streamed into cloud storage but may also be stored in the filesystem. | ||
[Clients implementing the GraphQL multipart request spec](https://github.com/jaydenseric/graphql-multipart-request-spec#client) upload files as [`Upload`](#class-graphqlupload) scalar query or mutation variables. Their resolver values are promises that resolve [file upload details](#type-fileupload) for processing and storage. Files are typically streamed into cloud storage but may also be stored in the filesystem. | ||
@@ -62,6 +45,10 @@ See the [example API and client](https://github.com/jaydenseric/apollo-upload-examples). | ||
[`busboy`](https://npm.im/busboy) parses multipart request streams. Once the `operations` and `map` fields have been parsed, [`Upload` scalar](#class-graphqlupload) values in the GraphQL operations are populated with promises, and the operations are passed down the middleware chain to GraphQL resolvers. | ||
[`busboy`](https://npm.im/busboy) parses multipart request streams. Once the `operations` and `map` fields have been parsed, [`Upload`](#class-graphqlupload) scalar values in the GraphQL operations are populated with promises, and the operations are passed down the middleware chain to GraphQL resolvers. | ||
[`fs-capacitor`](https://npm.im/fs-capacitor) is used to buffer file uploads to the filesystem and coordinate simultaneous reading and writing. As soon as a file upload’s contents begins streaming, its data begins buffering to the filesystem and its associated promise resolves. GraphQL resolvers can then create new streams from the buffer by calling [`createReadStream()`](#type-fileupload). The buffer is destroyed once all streams have ended or closed and the server has responded to the request. Any remaining buffer files will be cleaned when the process exits. | ||
## Support | ||
- [Node.js](https://nodejs.org): `^12.20 || >= 14.13` | ||
## API | ||
@@ -109,9 +96,9 @@ | ||
> ```js | ||
> const GraphQLUpload = require('graphql-upload/public/GraphQLUpload'); | ||
> const GraphQLUpload = require('graphql-upload/public/GraphQLUpload.js'); | ||
> ``` | ||
_Setup for a schema built with [`makeExecutableSchema`](https://apollographql.com/docs/graphql-tools/generate-schema#makeExecutableSchema)._ | ||
_A schema built using [`makeExecutableSchema`](https://www.graphql-tools.com/docs/api/modules/schema#makeexecutableschema) from [`@graphql-tools/schema`](https://npm.im/@graphql-tools/schema)._ | ||
> ```js | ||
> const { makeExecutableSchema } = require('graphql-tools'); | ||
> const { makeExecutableSchema } = require('@graphql-tools/schema'); | ||
> const { GraphQLUpload } = require('graphql-upload'); | ||
@@ -168,3 +155,3 @@ > | ||
A file expected to be uploaded as it has been declared in the `map` field of a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec). The [`processRequest`](#function-processrequest) function places references to an instance of this class wherever the file is expected in the [GraphQL operation](#type-graphqloperation). The [`Upload` scalar](#class-graphqlupload) derives it’s value from the [`promise`](#upload-instance-property-promise) property. | ||
A file expected to be uploaded as it has been declared in the `map` field of a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec). The [`processRequest`](#function-processrequest) function places references to an instance of this class wherever the file is expected in the [GraphQL operation](#type-graphqloperation). The [`Upload`](#class-graphqlupload) scalar derives it’s value from the [`promise`](#upload-instance-property-promise) property. | ||
@@ -190,3 +177,3 @@ #### Examples | ||
> ```js | ||
> const Upload = require('graphql-upload/public/Upload'); | ||
> const Upload = require('graphql-upload/public/Upload.js'); | ||
> ``` | ||
@@ -220,3 +207,3 @@ | ||
**Type:** Promise<[FileUpload](#type-fileupload)> | ||
**Type:** Promise<[FileUpload](#type-fileupload)> | ||
@@ -255,3 +242,3 @@ --- | ||
> ```js | ||
> const graphqlUploadExpress = require('graphql-upload/public/graphqlUploadExpress'); | ||
> const graphqlUploadExpress = require('graphql-upload/public/graphqlUploadExpress.js'); | ||
> ``` | ||
@@ -308,3 +295,3 @@ | ||
> ```js | ||
> const graphqlUploadKoa = require('graphql-upload/public/graphqlUploadKoa'); | ||
> const graphqlUploadKoa = require('graphql-upload/public/graphqlUploadKoa.js'); | ||
> ``` | ||
@@ -333,3 +320,3 @@ | ||
Processes a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec). It parses the `operations` and `map` fields to create an [`Upload`](#class-upload) instance for each expected file upload, placing references wherever the file is expected in the [GraphQL operation](#type-graphqloperation) for the [`Upload` scalar](#class-graphqlupload) to derive it’s value. Errors are created with [`http-errors`](https://npm.im/http-errors) to assist in sending responses with appropriate HTTP status codes. Used in [`graphqlUploadExpress`](#function-graphqluploadexpress) and [`graphqlUploadKoa`](#function-graphqluploadkoa) and can be used to create custom middleware. | ||
Processes a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec). It parses the `operations` and `map` fields to create an [`Upload`](#class-upload) instance for each expected file upload, placing references wherever the file is expected in the [GraphQL operation](#type-graphqloperation) for the [`Upload`](#class-graphqlupload) scalar to derive it’s value. Errors are created with [`http-errors`](https://npm.im/http-errors) to assist in sending responses with appropriate HTTP status codes. Used in [`graphqlUploadExpress`](#function-graphqluploadexpress) and [`graphqlUploadKoa`](#function-graphqluploadkoa) and can be used to create custom middleware. | ||
@@ -357,3 +344,3 @@ **Type:** [ProcessRequestFunction](#type-processrequestfunction) | ||
> ```js | ||
> const processRequest = require('graphql-upload/public/processRequest'); | ||
> const processRequest = require('graphql-upload/public/processRequest.js'); | ||
> ``` | ||
@@ -395,3 +382,3 @@ | ||
- [Node.js `Readable` stream constructor docs](https://nodejs.org/api/stream.html#stream_new_stream_readable_options). | ||
- [Node.js stream backpressure guide](https://nodejs.org/es/docs/guides/backpressuring-in-streams). | ||
- [Node.js stream backpressure guide](https://nodejs.org/en/docs/guides/backpressuring-in-streams). | ||
@@ -414,4 +401,4 @@ --- | ||
- [GraphQL over HTTP spec](https://github.com/APIs-guru/graphql-over-http#request-parameters). | ||
- [Apollo Server POST requests](https://www.apollographql.com/docs/apollo-server/requests#postRequests). | ||
- [GraphQL over HTTP spec](https://github.com/graphql/graphql-over-http). | ||
- [Apollo Server POST requests](https://www.apollographql.com/docs/apollo-server/requests/#post-requests). | ||
@@ -432,3 +419,3 @@ --- | ||
**Returns:** Promise<[GraphQLOperation](#type-graphqloperation) | Array<[GraphQLOperation](#type-graphqloperation)>> — GraphQL operation or batch of operations for a GraphQL server to consume (usually as the request body). | ||
**Returns:** Promise<[GraphQLOperation](#type-graphqloperation) | Array<[GraphQLOperation](#type-graphqloperation)>> — GraphQL operation or batch of operations for a GraphQL server to consume (usually as the request body). | ||
@@ -435,0 +422,0 @@ #### See |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
76495
706
1
425
Updatedfs-capacitor@^6.2.0
Updatedhttp-errors@^1.8.0
Updatedobject-path@^0.11.5