@envelop/generic-auth
Advanced tools
Comparing version 8.0.0 to 8.0.1-alpha-20241211101407-78d40a8bc4c78d160a9672d90b9f0715fac8f6bb
@@ -126,2 +126,14 @@ "use strict"; | ||
const user = args.contextValue[contextFieldName]; | ||
const schema = context.getSchema(); | ||
const operationAST = (0, graphql_1.getOperationAST)(args.document, args.operationName); | ||
const variableDefinitions = operationAST?.variableDefinitions; | ||
let variableValues; | ||
if (variableDefinitions?.length) { | ||
const { coerced } = (0, graphql_1.getVariableValues)(schema, variableDefinitions, args.variableValues || {}); | ||
variableValues = coerced; | ||
} | ||
else { | ||
variableValues = args.variableValues; | ||
} | ||
const operationType = operationAST?.operation ?? 'query'; | ||
const handleField = ({ node: fieldNode, path, }, parentType) => { | ||
@@ -133,3 +145,2 @@ const field = parentType.getFields()[fieldNode.name.value]; | ||
} | ||
const schema = context.getSchema(); | ||
// @ts-expect-error - Fix this | ||
@@ -148,4 +159,2 @@ const typeDirectives = parentType && (0, utils_1.getDirectiveExtensions)(parentType, schema); | ||
let curr = args.document; | ||
const operationAST = (0, graphql_1.getOperationAST)(args.document, args.operationName); | ||
const operationType = operationAST?.operation ?? 'query'; | ||
let currType = (0, utils_1.getDefinedRootType)(schema, operationType); | ||
@@ -199,3 +208,3 @@ for (const pathItem of path) { | ||
Field(node, key, parent, path, ancestors) { | ||
if (!(0, utils_1.shouldIncludeNode)(args.variableValues, node)) { | ||
if (variableValues && !(0, utils_1.shouldIncludeNode)(variableValues, node)) { | ||
return; | ||
@@ -202,0 +211,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { getNamedType, getOperationAST, isAbstractType, isInterfaceType, isIntrospectionType, isListType, isObjectType, isUnionType, } from 'graphql'; | ||
import { getNamedType, getOperationAST, getVariableValues, isAbstractType, isInterfaceType, isIntrospectionType, isListType, isObjectType, isUnionType, } from 'graphql'; | ||
import { useExtendedValidation } from '@envelop/extended-validation'; | ||
@@ -119,2 +119,14 @@ import { createGraphQLError, getDefinedRootType, getDirectiveExtensions, shouldIncludeNode, } from '@graphql-tools/utils'; | ||
const user = args.contextValue[contextFieldName]; | ||
const schema = context.getSchema(); | ||
const operationAST = getOperationAST(args.document, args.operationName); | ||
const variableDefinitions = operationAST?.variableDefinitions; | ||
let variableValues; | ||
if (variableDefinitions?.length) { | ||
const { coerced } = getVariableValues(schema, variableDefinitions, args.variableValues || {}); | ||
variableValues = coerced; | ||
} | ||
else { | ||
variableValues = args.variableValues; | ||
} | ||
const operationType = operationAST?.operation ?? 'query'; | ||
const handleField = ({ node: fieldNode, path, }, parentType) => { | ||
@@ -126,3 +138,2 @@ const field = parentType.getFields()[fieldNode.name.value]; | ||
} | ||
const schema = context.getSchema(); | ||
// @ts-expect-error - Fix this | ||
@@ -141,4 +152,2 @@ const typeDirectives = parentType && getDirectiveExtensions(parentType, schema); | ||
let curr = args.document; | ||
const operationAST = getOperationAST(args.document, args.operationName); | ||
const operationType = operationAST?.operation ?? 'query'; | ||
let currType = getDefinedRootType(schema, operationType); | ||
@@ -192,3 +201,3 @@ for (const pathItem of path) { | ||
Field(node, key, parent, path, ancestors) { | ||
if (!shouldIncludeNode(args.variableValues, node)) { | ||
if (variableValues && !shouldIncludeNode(variableValues, node)) { | ||
return; | ||
@@ -195,0 +204,0 @@ } |
{ | ||
"name": "@envelop/generic-auth", | ||
"version": "8.0.0", | ||
"version": "8.0.1-alpha-20241211101407-78d40a8bc4c78d160a9672d90b9f0715fac8f6bb", | ||
"sideEffects": false, | ||
@@ -5,0 +5,0 @@ "peerDependencies": { |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
56589
680
2