How to use the graphql-zeus.TypeSystemDefinition.DirectiveDefinition function in graphql-zeus

To help you get started, we’ve selected a few graphql-zeus 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 graphql-editor / graphql-editor / src / NodesToTree / templates / TemplateUtils.ts View on Github external
static resolverForConnection = (f: ParserField): string => {
    if (f.data) {
      const { type = '' } = f.data;
      if (type === TypeDefinition.UnionTypeDefinition) {
        return TypeDefinitionsTemplates.resolveUnion(f);
      }
      if (type in Value) {
        return ValueTemplate.resolve(f);
      }
      if (type in TypeDefinition) {
        return TypeDefinitionsTemplates.resolve(f);
      }
      switch (type) {
        case TypeSystemDefinition.FieldDefinition:
          return FieldTemplate.resolve(f);
        case TypeSystemDefinition.DirectiveDefinition:
          return TypeDefinitionsTemplates.resolveDirective(f);
        case TypeSystemDefinition.UnionMemberDefinition:
          return UnionMemberTemplate.resolve(f);
        case ValueDefinition.EnumValueDefinition:
          return EnumValueDefinitionTemplate.resolve(f);
        case ValueDefinition.InputValueDefinition:
          return InputValueTemplate.resolve(f);
        case Instances.Argument:
          return ArgumentTemplate.resolve(f);
        case Instances.Directive:
          return DirectiveTemplate.resolve(f);
        default:
          return '';
      }
    }
    return '';
github graphql-editor / graphql-editor / src / Graph / definitions / TypeDefintions.ts View on Github external
acceptsInputs: (d, defs, _) =>
        Utils.displayAsCategories(
          Utils.sortByParentType(Utils.dataForTypes(defs, [TypeSystemDefinition.DirectiveDefinition])),
        ),
      instances: [
github graphql-editor / graphql-editor / src / NodesToTree / index.ts View on Github external
static resolveObjectNode = (n: Node) => {
    const templateField: ParserField = {
      name: n.name,
      description: n.description,
      type: {
        name: n.definition.type,
        options: n.options && (n.options.filter((o) => o in Options) as Options[]),
        operations: n.options && (n.options.filter((o) => o in OperationType) as OperationType[]),
        directiveOptions:
          n.definition.data!.type! === TypeSystemDefinition.DirectiveDefinition
            ? (n.options as Directive[])
            : undefined,
      },
      data: n.definition.data,
      directives: n.inputs
        ? n.inputs
            .filter((i) => i.definition.type === Helpers.Directives)
            .map((i) => i.inputs || [])
            .reduce((a, b) => a.concat(b), [])
            .map(NodesToTree.resolveFieldNode)
        : undefined,
      interfaces: n.inputs
        ? n.inputs
            .filter((i) => i.definition.type === Helpers.Implements)
            .map((i) => (i.inputs ? i.inputs.map((n) => n.definition.type) : []))
            .reduce((a, b) => a.concat(b), [])
github graphql-editor / graphql-editor / src / Graph / definitions / TypeDefintions.ts View on Github external
static DirectiveDefinition = (stitchNodes: Array>) =>
    generateTypeDefinition({
      help: help.directive,
      type: TypeSystemDefinitionDisplayMap[TypeSystemDefinition.DirectiveDefinition],
      dataType: TypeSystemDefinition.DirectiveDefinition,
      options: Object.keys(Directive).map((d) => ({ name: d, help: d })),
      acceptsInputs: (d, defs, _) =>
        Utils.displayAsCategories(
          Utils.sortByParentType(Utils.dataForTypes(defs, [TypeSystemDefinition.DirectiveDefinition])),
        ),
      instances: [
        {
          data: {
            type: Instances.Directive,
            for: [Helpers.Directives],
          },
          node: {
            notEditable: true,
            name: undefined,
          },
github graphql-editor / graphql-editor / src / Graph / definitions / TypeDefintions.ts View on Github external
static DirectiveDefinition = (stitchNodes: Array>) =>
    generateTypeDefinition({
      help: help.directive,
      type: TypeSystemDefinitionDisplayMap[TypeSystemDefinition.DirectiveDefinition],
      dataType: TypeSystemDefinition.DirectiveDefinition,
      options: Object.keys(Directive).map((d) => ({ name: d, help: d })),
      acceptsInputs: (d, defs, _) =>
        Utils.displayAsCategories(
          Utils.sortByParentType(Utils.dataForTypes(defs, [TypeSystemDefinition.DirectiveDefinition])),
        ),
      instances: [
        {
          data: {
            type: Instances.Directive,
            for: [Helpers.Directives],
          },
          node: {
            notEditable: true,
            name: undefined,
          },
          options: undefined,
github graphql-editor / graphql-editor / src / Graph / definitions / InputValue.ts View on Github external
import { TypeDefinition, TypeSystemDefinition, Value, ValueDefinition } from 'graphql-zeus';
import { EditorNodeDefinition } from '../../Models';
import { Utils } from './Utils';

export const InputValueInstance: Partial & Pick = {
  options: Utils.ArrayNonNullOptions,
  data: {
    type: ValueDefinition.InputValueDefinition,
    for: [
      TypeDefinition.InputObjectTypeDefinition,
      TypeSystemDefinition.FieldDefinition,
      TypeSystemDefinition.DirectiveDefinition,
      Value.ObjectValue,
    ],
  },
  node: {
    ...Utils.createOND(),
    outputs: [],
  },
};