Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade fs-capacitor@^7.0.1 #290

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "13.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.",
"license": "MIT",
"type": "module",
"author": {
"name": "Jayden Seric",
"email": "me@jaydenseric.com",
Expand Down Expand Up @@ -48,7 +49,7 @@
},
"dependencies": {
"busboy": "^0.3.1",
"fs-capacitor": "^6.2.0",
"fs-capacitor": "^7.0.1",
"http-errors": "^1.8.1",
"object-path": "^0.11.8"
},
Expand All @@ -64,7 +65,7 @@
"express": "^4.17.1",
"form-data-encoder": "^1.7.1",
"formdata-node": "^4.3.1",
"graphql": "^16.0.1",
"graphql": "^16.2.0",
"hard-rejection": "^2.1.0",
"jsdoc-md": "^11.0.2",
"koa": "^2.13.4",
Expand Down
5 changes: 1 addition & 4 deletions private/GRAPHQL_MULTIPART_REQUEST_SPEC_URL.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use strict";

/**
* [GraphQL multipart request spec](https://github.com/jaydenseric/graphql-multipart-request-spec)
* URL. Useful for error messages, etc.
Expand All @@ -8,5 +6,4 @@
* @type {string}
* @ignore
*/
module.exports =
"https://github.com/jaydenseric/graphql-multipart-request-spec";
export default "https://github.com/jaydenseric/graphql-multipart-request-spec";
6 changes: 2 additions & 4 deletions private/ignoreStream.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
"use strict";

/**
* Safely ignores a Node.js readable stream.
* @kind function
* @name ignoreStream
* @param {ReadableStream} stream Node.js readable stream.
* @ignore
*/
module.exports = function ignoreStream(stream) {
export default function ignoreStream(stream) {
// Prevent an unhandled error from crashing the process.
stream.on("error", () => {});

// Waste the stream.
stream.resume();
};
}
8 changes: 3 additions & 5 deletions public/GraphQLUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
// https://github.com/gajus/eslint-plugin-jsdoc/issues/710
/* eslint-disable jsdoc/check-examples */

"use strict";

const { GraphQLScalarType, GraphQLError } = require("graphql");
const Upload = require("./Upload");
import { GraphQLError, GraphQLScalarType } from "graphql";
import Upload from "./Upload.js";

/**
* A GraphQL `Upload` scalar that can be used in a
Expand Down Expand Up @@ -74,7 +72,7 @@ const Upload = require("./Upload");
* });
* ```
*/
module.exports = new GraphQLScalarType({
export default new GraphQLScalarType({
name: "Upload",
description: "The `Upload` scalar type represents a file upload.",
parseValue(value) {
Expand Down
6 changes: 2 additions & 4 deletions public/Upload.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use strict";

/**
* 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).
Expand Down Expand Up @@ -27,7 +25,7 @@
* const Upload = require("graphql-upload/public/Upload.js");
* ```
*/
module.exports = class Upload {
export default class Upload {
constructor() {
/**
* Promise that resolves file upload details. This should only be utilized
Expand Down Expand Up @@ -72,4 +70,4 @@ module.exports = class Upload {
// https://github.com/nodejs/node/issues/20392
this.promise.catch(() => {});
}
};
}
8 changes: 3 additions & 5 deletions public/graphqlUploadExpress.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"use strict";

const defaultProcessRequest = require("./processRequest");
import defaultProcessRequest from "./processRequest.js";

/**
* Creates [Express](https://expressjs.com) middleware that processes
Expand Down Expand Up @@ -46,7 +44,7 @@ const defaultProcessRequest = require("./processRequest");
* .listen(3000);
* ```
*/
module.exports = function graphqlUploadExpress({
export default function graphqlUploadExpress({
processRequest = defaultProcessRequest,
...processRequestOptions
} = {}) {
Expand All @@ -73,4 +71,4 @@ module.exports = function graphqlUploadExpress({
next(error);
});
};
};
}
8 changes: 3 additions & 5 deletions public/graphqlUploadKoa.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"use strict";

const defaultProcessRequest = require("./processRequest");
import defaultProcessRequest from "./processRequest.js";

/**
* Creates [Koa](https://koajs.com) middleware that processes
Expand Down Expand Up @@ -46,7 +44,7 @@ const defaultProcessRequest = require("./processRequest");
* .listen(3000);
* ```
*/
module.exports = function graphqlUploadKoa({
export default function graphqlUploadKoa({
processRequest = defaultProcessRequest,
...processRequestOptions
} = {}) {
Expand All @@ -66,4 +64,4 @@ module.exports = function graphqlUploadKoa({
await finished;
}
};
};
}
18 changes: 12 additions & 6 deletions public/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
"use strict";
import GraphQLUpload from "./GraphQLUpload.js";
import Upload from "./Upload.js";
import graphqlUploadExpress from "./graphqlUploadExpress.js";
import graphqlUploadKoa from "./graphqlUploadKoa.js";
import processRequest from "./processRequest.js";

exports.GraphQLUpload = require("./GraphQLUpload");
exports.processRequest = require("./processRequest");
exports.graphqlUploadKoa = require("./graphqlUploadKoa");
exports.graphqlUploadExpress = require("./graphqlUploadExpress");
exports.Upload = require("./Upload");
export {
GraphQLUpload,
processRequest,
graphqlUploadKoa,
graphqlUploadExpress,
Upload,
};

/**
* File upload details that are only available after the file’s field in the
Expand Down
20 changes: 9 additions & 11 deletions public/processRequest.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"use strict";

const Busboy = require("busboy");
const { WriteStream } = require("fs-capacitor");
const createError = require("http-errors");
const objectPath = require("object-path");
const GRAPHQL_MULTIPART_REQUEST_SPEC_URL = require("../private/GRAPHQL_MULTIPART_REQUEST_SPEC_URL");
const ignoreStream = require("../private/ignoreStream");
const Upload = require("./Upload");
import Busboy from "busboy";
import { WriteStream } from "fs-capacitor";
import createError from "http-errors";
import objectPath from "object-path";
import GRAPHQL_MULTIPART_REQUEST_SPEC_URL from "../private/GRAPHQL_MULTIPART_REQUEST_SPEC_URL.js";
import ignoreStream from "../private/ignoreStream.js";
import Upload from "./Upload.js";

/**
* Processes a
Expand Down Expand Up @@ -41,7 +39,7 @@ const Upload = require("./Upload");
* const processRequest = require("graphql-upload/public/processRequest.js");
* ```
*/
module.exports = function processRequest(
export default function processRequest(
request,
response,
{
Expand Down Expand Up @@ -345,4 +343,4 @@ module.exports = function processRequest(

request.pipe(parser);
});
};
}