@winninjs/graphql-io-utils
Advanced tools
Comparing version 1.4.1 to 1.5.0
{ | ||
"name": "@winninjs/graphql-io-utils", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"description": "Utilities directives and scalar types to help on graphql input/output validation and sanitization.", | ||
@@ -18,2 +18,3 @@ "main": "src/index.js", | ||
"email-validator": "^2.0.4", | ||
"graphql": "^15.5.1", | ||
"redact-pii": "^3.2.3" | ||
@@ -26,5 +27,2 @@ }, | ||
}, | ||
"peerDependencies": { | ||
"graphql": "^15.5.1" | ||
}, | ||
"directories": { | ||
@@ -31,0 +29,0 @@ "test": "test" |
const { SchemaDirectiveVisitor } = require("graphql-tools") | ||
const { GraphQLScalarType, GraphQLNonNull } = require("graphql") | ||
const { GraphQLScalarType, GraphQLNonNull, isNonNullType, isScalarType } = require("graphql") | ||
@@ -15,5 +15,5 @@ class StringUtilsDirective extends SchemaDirectiveVisitor { | ||
wrapType(field) { | ||
if ( field.type instanceof GraphQLNonNull && field.type.ofType instanceof GraphQLScalarType) { | ||
if ( isNonNullType(field.type) && isScalarType(field.type.ofType)) { | ||
field.type = new GraphQLNonNull(new StringUtilsScalarType(field.type.ofType, this.args)) | ||
} else if (field.type instanceof GraphQLScalarType) { | ||
} else if (isScalarType(field.type)) { | ||
field.type = new StringUtilsScalarType(field.type, this.args) | ||
@@ -20,0 +20,0 @@ } else { |
const { SchemaDirectiveVisitor } = require("graphql-tools") | ||
const { GraphQLScalarType, GraphQLNonNull } = require("graphql") | ||
const { GraphQLScalarType, GraphQLNonNull, isNonNullType, isScalarType } = require("graphql") | ||
const emailValidator = require("email-validator") | ||
@@ -103,5 +103,5 @@ | ||
wrapType(type,name) { | ||
if ( type instanceof GraphQLNonNull && type.ofType instanceof GraphQLScalarType) { | ||
if ( isNonNullType(type) && isScalarType(type.ofType)) { | ||
return new GraphQLNonNull(new ValidateScalarType(type.ofType,name, this.args)) | ||
} else if (type instanceof GraphQLScalarType) { | ||
} else if (isScalarType(type)) { | ||
return new ValidateScalarType(type,name, this.args) | ||
@@ -108,0 +108,0 @@ } else { |
35362
+ Addedgraphql@^15.5.1
+ Added@types/node@22.13.1(transitive)
+ Addedsemver@7.7.1(transitive)
- Removed@types/node@22.12.0(transitive)
- Removedsemver@7.7.0(transitive)