graphql-constraint-directive
Advanced tools
Comparing version 5.3.0 to 5.4.0
@@ -1,2 +0,2 @@ | ||
import {DocumentNode, GraphQLSchema} from "graphql"; | ||
import {DocumentNode} from "graphql"; | ||
import {ApolloServerPlugin} from '@apollo/server'; | ||
@@ -17,4 +17,4 @@ | ||
* | ||
* @param options to setup plugin. `schema` is deprecated now, not used, as plugins gets schema from the Apollo Server. | ||
* @param options to setup plugin. | ||
*/ | ||
export function createApollo4QueryValidationPlugin ( options: { schema?: GraphQLSchema } ) : ApolloServerPlugin; | ||
export function createApollo4QueryValidationPlugin ( options?: {} ) : ApolloServerPlugin; |
@@ -67,3 +67,3 @@ import {GraphQLSchema, GraphQLError, DocumentNode, ValidationContext} from "graphql"; | ||
*/ | ||
export function validateQuery () : (schema: GraphQLSchema, query: DocumentNode, variables: Record<string, any>, operationName?: string) => Array<GraphQLError>; | ||
export function validateQuery () : (schema: GraphQLSchema, query: DocumentNode, variables: Record<string, any>, operationName?: string, pluginOptions?: {}) => Array<GraphQLError>; | ||
@@ -70,0 +70,0 @@ /** |
@@ -7,3 +7,4 @@ const { | ||
isScalarType, | ||
isListType | ||
isListType, | ||
GraphQLID | ||
} = require('graphql') | ||
@@ -14,3 +15,3 @@ const { ConstraintStringType, validate: validateStringFn } = require('../scalars/string') | ||
function getConstraintTypeObject (fieldName, type, uniqueTypeName, directiveArgumentMap) { | ||
if (type === GraphQLString) { | ||
if (type === GraphQLString || type === GraphQLID) { | ||
return new ConstraintStringType( | ||
@@ -35,3 +36,3 @@ fieldName, | ||
function getConstraintValidateFn (type) { | ||
if (type === GraphQLString) { | ||
if (type === GraphQLString || type === GraphQLID) { | ||
return validateStringFn | ||
@@ -38,0 +39,0 @@ } else if (type === GraphQLFloat || type === GraphQLInt) { |
{ | ||
"name": "graphql-constraint-directive", | ||
"version": "5.3.0", | ||
"version": "5.4.0", | ||
"description": "Validate GraphQL fields", | ||
@@ -37,4 +37,4 @@ "main": "index.js", | ||
"devDependencies": { | ||
"apollo-server-express": "3.12.1", | ||
"@apollo/server": "4.9.3", | ||
"apollo-server-express": "3.13.0", | ||
"@apollo/server": "4.9.5", | ||
"coveralls": "3.1.1", | ||
@@ -46,3 +46,3 @@ "express": "4.18.2", | ||
"standard": "16.0.4", | ||
"supertest": "6.3.3", | ||
"supertest": "6.3.4", | ||
"@graphql-yoga/node": "2.13.13" | ||
@@ -49,0 +49,0 @@ }, |
Sorry, the diff of this file is not supported yet
305444
59
7180