Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-http

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-http - npm Package Compare versions

Comparing version 1.13.0 to 1.14.0

15

lib/handler.d.ts

@@ -6,3 +6,3 @@ /**

*/
import { ExecutionArgs, ExecutionResult, GraphQLSchema, validate as graphqlValidate, execute as graphqlExecute, parse as graphqlParse, getOperationAST as graphqlGetOperationAST, GraphQLError } from 'graphql';
import { ExecutionArgs, ExecutionResult, GraphQLSchema, validate as graphqlValidate, ValidationRule, execute as graphqlExecute, parse as graphqlParse, getOperationAST as graphqlGetOperationAST, GraphQLError } from 'graphql';
import { RequestParams } from './common';

@@ -142,2 +142,15 @@ /**

/**
* The validation rules for running GraphQL validate.
*
* When providing an array, the rules will be APPENDED to the default
* `specifiedRules` array provided by the graphql-js module.
*
* Alternatively, providing a function instead will OVERWRITE the defaults
* and use exclusively the rules returned by the function. The third (last)
* argument of the function are the default `specifiedRules` array provided
* by the graphql-js module, you're free to prepend/append the defaults to
* your rule set, or omit them altogether.
*/
validationRules?: readonly ValidationRule[] | ((req: Request<RequestRaw, RequestContext>, args: OperationArgs<Context>, specifiedRules: readonly ValidationRule[]) => Promise<readonly ValidationRule[]> | readonly ValidationRule[]);
/**
* Is the `execute` function from GraphQL which is

@@ -144,0 +157,0 @@ * used to execute the query and mutation operations.

@@ -79,3 +79,3 @@ "use strict";

function createHandler(options) {
const { schema, context, validate = graphql_1.validate, execute = graphql_1.execute, parse = graphql_1.parse, getOperationAST = graphql_1.getOperationAST, rootValue, onSubscribe, onOperation, } = options;
const { schema, context, validate = graphql_1.validate, validationRules = [], execute = graphql_1.execute, parse = graphql_1.parse, getOperationAST = graphql_1.getOperationAST, rootValue, onSubscribe, onOperation, } = options;
return async function handler(req) {

@@ -230,3 +230,10 @@ var _a, _b;

}
const validationErrs = validate(args.schema, args.document);
let rules = graphql_1.specifiedRules;
if (typeof validationRules === 'function') {
rules = await validationRules(req, args, graphql_1.specifiedRules);
}
else {
rules = [...rules, ...validationRules];
}
const validationErrs = validate(args.schema, args.document, rules);
if (validationErrs.length) {

@@ -233,0 +240,0 @@ return makeResponse(validationErrs, acceptedMediaType);

30

package.json
{
"name": "graphql-http",
"version": "1.13.0",
"version": "1.14.0",
"description": "Simple, pluggable, zero-dependency, GraphQL over HTTP Protocol compliant server and client",

@@ -27,3 +27,3 @@ "keywords": [

},
"packageManager": "yarn@3.3.1",
"packageManager": "yarn@3.4.1",
"main": "lib/index.js",

@@ -110,4 +110,4 @@ "module": "lib/index.mjs",

"@semantic-release/git": "^10.0.1",
"@types/eslint": "^8.4.10",
"@types/express": "^4.17.16",
"@types/eslint": "^8.21.0",
"@types/express": "^4.17.17",
"@types/glob": "^8.0.1",

@@ -117,7 +117,7 @@ "@types/jest": "^29.4.0",

"@types/koa-mount": "^4.0.2",
"@typescript-eslint/eslint-plugin": "^5.49.0",
"@typescript-eslint/parser": "^5.49.0",
"@whatwg-node/fetch": "^0.6.2",
"babel-jest": "^29.4.0",
"eslint": "^8.32.0",
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@typescript-eslint/parser": "^5.51.0",
"@whatwg-node/fetch": "^0.7.0",
"babel-jest": "^29.4.2",
"eslint": "^8.33.0",
"eslint-config-prettier": "^8.6.0",

@@ -127,14 +127,14 @@ "express": "^4.18.2",

"graphql": "^16.6.0",
"jest": "^29.4.0",
"jest-jasmine2": "^29.4.0",
"jest": "^29.4.2",
"jest-jasmine2": "^29.4.2",
"koa": "^2.14.1",
"koa-mount": "^4.0.0",
"node-fetch": "^3.3.0",
"prettier": "^2.8.3",
"rollup": "^3.11.0",
"prettier": "^2.8.4",
"rollup": "^3.14.0",
"semantic-release": "^20.1.0",
"tslib": "^2.4.1",
"tslib": "^2.5.0",
"typedoc": "^0.23.24",
"typedoc-plugin-markdown": "^3.14.0",
"typescript": "^4.9.4"
"typescript": "^4.9.5"
},

@@ -141,0 +141,0 @@ "resolutions": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc