Socket
Socket
Sign inDemoInstall

express-graphql

Package Overview
Dependencies
18
Maintainers
5
Versions
42
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.1 to 0.8.0

29

dist/index.js

@@ -64,3 +64,5 @@ 'use strict';

var pretty = void 0;
var formatErrorFn = void 0;
var formatErrorFn = _graphql.formatError;
var validateFn = _graphql.validate;
var executeFn = _graphql.execute;
var extensionsFn = void 0;

@@ -105,3 +107,2 @@ var showGraphiQL = void 0;

var graphiql = optionsData.graphiql;
context = optionsData.context || request;

@@ -156,3 +157,4 @@

// Validate AST, reporting any errors.
var validationErrors = (0, _graphql.validate)(schema, documentAST, validationRules);
var validationErrors = validateFn(schema, documentAST, validationRules);
if (validationErrors.length > 0) {

@@ -183,3 +185,11 @@ // Return 400: Bad Request if any validation errors exist.

try {
return (0, _graphql.execute)(schema, documentAST, rootValue, context, variables, operationName, fieldResolver);
return executeFn({
schema: schema,
document: documentAST,
rootValue: rootValue,
contextValue: context,
variableValues: variables,
operationName: operationName,
fieldResolver: fieldResolver
});
} catch (contextError) {

@@ -223,3 +233,3 @@ // Return 400: Bad Request if any execution context errors exist.

if (result && result.errors) {
result.errors = result.errors.map(formatErrorFn || _graphql.formatError);
result.errors = result.errors.map(formatErrorFn);
}

@@ -262,3 +272,10 @@

formatErrorFn = optionsData.formatError;
if (optionsData.formatError) {
// eslint-disable-next-line no-console
console.warn('`formatError` is deprecated and replaced by `customFormatErrorFn`. It will be removed in version 1.0.0.');
}
validateFn = optionsData.customValidateFn || validateFn;
executeFn = optionsData.customExecuteFn || executeFn;
formatErrorFn = optionsData.customFormatErrorFn || optionsData.formatError || formatErrorFn;
extensionsFn = optionsData.extensions;

@@ -265,0 +282,0 @@ pretty = optionsData.pretty;

{
"name": "express-graphql",
"version": "0.7.1",
"version": "0.8.0",
"description": "Production ready GraphQL HTTP middleware.",

@@ -65,3 +65,3 @@ "license": "BSD-3-Clause",

"content-type": "^1.0.4",
"http-errors": "^1.7.1",
"http-errors": "^1.7.2",
"raw-body": "^2.3.3"

@@ -82,17 +82,17 @@ },

"connect": "3.6.6",
"coveralls": "3.0.2",
"eslint": "5.6.1",
"eslint-plugin-flowtype": "2.50.3",
"eslint-plugin-prettier": "3.0.0",
"coveralls": "3.0.3",
"eslint": "5.16.0",
"eslint-plugin-flowtype": "3.5.1",
"eslint-plugin-prettier": "3.0.1",
"express": "4.16.4",
"flow-bin": "0.83.0",
"graphql": "14.0.2",
"isparta": "4.1.0",
"mocha": "5.2.0",
"flow-bin": "0.96.0",
"graphql": "14.2.1",
"isparta": "4.1.1",
"mocha": "6.0.2",
"multer": "1.4.1",
"prettier": "1.14.3",
"prettier": "1.16.4",
"restify": "4.3.2",
"sane": "4.0.1",
"sinon": "6.3.5",
"supertest": "3.3.0"
"sane": "4.1.0",
"sinon": "7.3.1",
"supertest": "4.0.2"
},

@@ -99,0 +99,0 @@ "peerDependencies": {

@@ -80,6 +80,2 @@ GraphQL HTTP Server Middleware

* **`formatError`**: An optional function which will be used to format any
errors produced by fulfilling a GraphQL operation. If no function is
provided, GraphQL's default spec-compliant [`formatError`][] function will be used.
* **`extensions`**: An optional function for adding additional metadata to the

@@ -95,2 +91,15 @@ GraphQL response as a key-value object. The result will be added to

* **`customValidateFn`**: An optional function which will be used to validate
instead of default `validate` from `graphql-js`.
* **`customExecuteFn`**: An optional function which will be used to execute
instead of default `execute` from `graphql-js`.
* **`customFormatErrorFn`**: An optional function which will be used to format any
errors produced by fulfilling a GraphQL operation. If no function is
provided, GraphQL's default spec-compliant [`formatError`][] function will be used.
* **`formatError`**: is deprecated and replaced by `customFormatErrorFn`. It will be
removed in version 1.0.0.
In addition to an object defining each option, options can also be provided as

@@ -293,6 +302,6 @@ a function (or async function) which returns this options object. This function

During development, it's useful to get more information from errors, such as
stack traces. Providing a function to `formatError` enables this:
stack traces. Providing a function to `customFormatErrorFn` enables this:
```js
formatError: error => ({
customFormatErrorFn: error => ({
message: error.message,

@@ -299,0 +308,0 @@ locations: error.locations,

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc