How to use the @graphql-box/helpers.getKind function in @graphql-box/helpers

To help you get started, we’ve selected a few @graphql-box/helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github badbatch / graphql-box / packages / request-parser / src / main / index.ts View on Github external
enter(
          node: ASTNode,
          key: string | number | undefined,
          parent: any | ReadonlyArray | undefined,
          path: ReadonlyArray,
          ancestors: ReadonlyArray,
        ): ValueNode | undefined {
          typeInfo.enter(node);
          const kind = getKind(node);

          if (kind === DOCUMENT) {
            fragmentDefinitions = RequestParser._getFragmentDefinitions(node as DocumentNode, options);
            return undefined;
          }

          if (kind === FIELD) {
            return _this._updateFieldNode(
              node as FieldNode,
              ancestors,
              typeInfo,
              fragmentDefinitions,
              options,
              context,
            );
          }
github badbatch / graphql-box / packages / request-parser / src / main / index.ts View on Github external
ancestors,
              typeInfo,
              fragmentDefinitions,
              options,
              context,
            );
          }

          if (kind === INLINE_FRAGMENT) {
            return _this._updateInlineFragmentNode(node as InlineFragmentNode, ancestors, typeInfo, options, context);
          }

          if (kind === VARIABLE) {
            const variableName = getName(node) as string;

            if (getKind(parent) === VARIABLE_DEFINITION) {
              variableTypes[variableName] = _this._schema.getType(getVariableDefinitionType(parent));
            }

            return RequestParser._updateVariableNode(node as VariableNode, variableTypes[variableName], options);
          }

          return undefined;
        },
        leave(node: ASTNode): any {
github badbatch / graphql-box / packages / request-parser / src / main / index.ts View on Github external
ancestors.forEach(ancestor => {
      if (isPlainObject(ancestor) && getKind(ancestor as ASTNode) === FIELD) {
        const ancestorFieldNode = ancestor as FieldNode;
        ancestorRequestFieldPath.push(getAlias(ancestorFieldNode) || (getName(ancestorFieldNode) as string));
      }
    });