@envelop/generic-auth
Advanced tools
Comparing version 8.0.0-alpha-20240806125641-9b9885ba to 8.0.0-alpha-20240810114324-912296f8
@@ -78,4 +78,4 @@ "use strict"; | ||
const user = args.contextValue[contextFieldName]; | ||
const handleField = ({ node: fieldNode, path, }, objectType) => { | ||
const field = objectType.getFields()[fieldNode.name.value]; | ||
const handleField = ({ node: fieldNode, path, }, parentType) => { | ||
const field = parentType.getFields()[fieldNode.name.value]; | ||
if (field == null) { | ||
@@ -97,3 +97,3 @@ // field is null/undefined if this is an introspection field | ||
fieldNode, | ||
objectType, | ||
parentType, | ||
fieldAuthDirectiveNode, | ||
@@ -115,16 +115,3 @@ fieldAuthExtension, | ||
} | ||
if ((0, graphql_1.isObjectType)(fieldType)) { | ||
const error = handleField({ | ||
node, | ||
key, | ||
parent, | ||
path, | ||
ancestors, | ||
}, fieldType); | ||
if (error) { | ||
context.reportError(error); | ||
return null; | ||
} | ||
} | ||
else if ((0, graphql_1.isUnionType)(fieldType)) { | ||
if ((0, graphql_1.isUnionType)(fieldType)) { | ||
for (const objectType of fieldType.getTypes()) { | ||
@@ -144,15 +131,13 @@ const error = handleField({ | ||
} | ||
else if ((0, graphql_1.isInterfaceType)(fieldType)) { | ||
for (const objectType of args.schema.getImplementations(fieldType).objects) { | ||
const error = handleField({ | ||
node, | ||
key, | ||
parent, | ||
path, | ||
ancestors, | ||
}, objectType); | ||
if (error) { | ||
context.reportError(error); | ||
return null; | ||
} | ||
else if ((0, graphql_1.isObjectType)(fieldType) || (0, graphql_1.isInterfaceType)(fieldType)) { | ||
const error = handleField({ | ||
node, | ||
key, | ||
parent, | ||
path, | ||
ancestors, | ||
}, fieldType); | ||
if (error) { | ||
context.reportError(error); | ||
return null; | ||
} | ||
@@ -159,0 +144,0 @@ } |
@@ -72,4 +72,4 @@ import { getNamedType, isInterfaceType, isIntrospectionType, isObjectType, isUnionType, } from 'graphql'; | ||
const user = args.contextValue[contextFieldName]; | ||
const handleField = ({ node: fieldNode, path, }, objectType) => { | ||
const field = objectType.getFields()[fieldNode.name.value]; | ||
const handleField = ({ node: fieldNode, path, }, parentType) => { | ||
const field = parentType.getFields()[fieldNode.name.value]; | ||
if (field == null) { | ||
@@ -91,3 +91,3 @@ // field is null/undefined if this is an introspection field | ||
fieldNode, | ||
objectType, | ||
parentType, | ||
fieldAuthDirectiveNode, | ||
@@ -109,16 +109,3 @@ fieldAuthExtension, | ||
} | ||
if (isObjectType(fieldType)) { | ||
const error = handleField({ | ||
node, | ||
key, | ||
parent, | ||
path, | ||
ancestors, | ||
}, fieldType); | ||
if (error) { | ||
context.reportError(error); | ||
return null; | ||
} | ||
} | ||
else if (isUnionType(fieldType)) { | ||
if (isUnionType(fieldType)) { | ||
for (const objectType of fieldType.getTypes()) { | ||
@@ -138,15 +125,13 @@ const error = handleField({ | ||
} | ||
else if (isInterfaceType(fieldType)) { | ||
for (const objectType of args.schema.getImplementations(fieldType).objects) { | ||
const error = handleField({ | ||
node, | ||
key, | ||
parent, | ||
path, | ||
ancestors, | ||
}, objectType); | ||
if (error) { | ||
context.reportError(error); | ||
return null; | ||
} | ||
else if (isObjectType(fieldType) || isInterfaceType(fieldType)) { | ||
const error = handleField({ | ||
node, | ||
key, | ||
parent, | ||
path, | ||
ancestors, | ||
}, fieldType); | ||
if (error) { | ||
context.reportError(error); | ||
return null; | ||
} | ||
@@ -153,0 +138,0 @@ } |
{ | ||
"name": "@envelop/generic-auth", | ||
"version": "8.0.0-alpha-20240806125641-9b9885ba", | ||
"version": "8.0.0-alpha-20240810114324-912296f8", | ||
"sideEffects": false, | ||
@@ -10,3 +10,3 @@ "peerDependencies": { | ||
"dependencies": { | ||
"@envelop/extended-validation": "4.1.0-alpha-20240806125641-9b9885ba", | ||
"@envelop/extended-validation": "4.1.0-alpha-20240810114324-912296f8", | ||
"@graphql-tools/utils": "^10.0.6", | ||
@@ -13,0 +13,0 @@ "tslib": "^2.5.0" |
@@ -1,2 +0,2 @@ | ||
import { DirectiveNode, ExecutionArgs, FieldNode, GraphQLError, GraphQLField, GraphQLObjectType } from 'graphql'; | ||
import { DirectiveNode, ExecutionArgs, FieldNode, GraphQLError, GraphQLField, GraphQLInterfaceType, GraphQLObjectType } from 'graphql'; | ||
import { DefaultContext, Maybe, Plugin, PromiseOrValue } from '@envelop/core'; | ||
@@ -9,4 +9,4 @@ export type ResolveUserFn<UserType, ContextType = DefaultContext> = (context: ContextType) => PromiseOrValue<Maybe<UserType>>; | ||
fieldNode: FieldNode; | ||
/** The object type which has the field that is being validated. */ | ||
objectType: GraphQLObjectType; | ||
/** The parent type which has the field that is being validated. */ | ||
parentType: GraphQLObjectType | GraphQLInterfaceType; | ||
/** The object field */ | ||
@@ -13,0 +13,0 @@ field: GraphQLField<any, any>; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41037
424