Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FieldApi

API for GraphQL FieldNode

Hierarchy

Index

Constructors

constructor

  • new FieldApi(node: FieldNode): FieldApi

Properties

Readonly _arguments

_arguments: Crud<ArgumentNode, ArgumentApi, { name: NameNodeProps | NameNode; value: GQL.ValueNode }, string> = new Crud({parent: this.node,key: 'arguments',api: Api.argumentApi,factory: Ast.argumentNode,matcher: (node): Argname => node.name.value,})

Readonly _directives

_directives: Crud<DirectiveNode, DirectiveApi, string | { arguments?: ReadonlyArray<ArgumentNode | ArgumentNodeProps>; name: NameNodeProps | NameNode }, string> = new Crud({parent: this.node,key: 'directives',api: Api.directiveApi,factory: Ast.directiveNode,matcher: (node): Directivename => node.name.value,})

Readonly _fields

_fields: Crud<FieldNode, FieldApi, string | { alias?: NameNode | NameNodeProps; arguments?: ReadonlyArray<ArgumentNodeProps | ArgumentNode>; directives?: ReadonlyArray<DirectiveNodeProps | DirectiveNode>; name: NameNode | NameNodeProps; selections?: ReadonlyArray<SelectionNodeProps | GQL.SelectionNode> }, string> = new Crud({parent: this.node,key: this.node.kind === Kind.SELECTION_SET ? 'selections' : 'selectionSet',api: Api.fieldApi,factory: Ast.fieldNode,matcher: (node): Fieldname => node.name.value,ref: this._selectionsRef,kindFilter: [Kind.FIELD],})

Readonly _fragmentSpreads

_fragmentSpreads: Crud<FragmentSpreadNode, FragmentSpreadApi, string | { directives?: ReadonlyArray<DirectiveNodeProps | DirectiveNode>; name: NameNodeProps | NameNode }, string> = new Crud({parent: this.node,key: this.node.kind === Kind.SELECTION_SET ? 'selections' : 'selectionSet',api: Api.fragmentSpreadApi,factory: Ast.fragmentSpreadNode,matcher: (node): Fragmentname => node.name.value,ref: this._selectionsRef,kindFilter: [Kind.FRAGMENT_SPREAD],})

Readonly _inlineFragments

_inlineFragments: Crud<InlineFragmentNode, InlineFragmentApi, { directives?: ReadonlyArray<DirectiveNodeProps | DirectiveNode>; selections: ReadonlyArray<SelectionNodeProps | GQL.SelectionNode>; typeCondition?: NamedTypeNodeProps | NamedTypeNode }, undefined | string> = new Crud({parent: this.node,key: this.node.kind === Kind.SELECTION_SET ? 'selections' : 'selectionSet',api: Api.inlineFragmentApi,factory: Ast.inlineFragmentNode,matcher: (node): Typename | undefined => node.typeCondition?.name.value,ref: this._selectionsRef,kindFilter: [Kind.INLINE_FRAGMENT],})

Readonly _selections

_selections: Crud<FieldNode | FragmentSpreadNode | InlineFragmentNode, FieldApi | FragmentSpreadApi | InlineFragmentApi, string | { alias?: NameNode | NameNodeProps; arguments?: ReadonlyArray<ArgumentNodeProps | ArgumentNode>; directives?: ReadonlyArray<DirectiveNodeProps | DirectiveNode>; name: NameNode | NameNodeProps; selections?: ReadonlyArray<SelectionNodeProps | GQL.SelectionNode> } | ({ alias?: NameNode | NameNodeProps; arguments?: ReadonlyArray<ArgumentNodeProps | ArgumentNode>; directives?: ReadonlyArray<DirectiveNodeProps | DirectiveNode>; name: NameNode | NameNodeProps; selections?: ReadonlyArray<SelectionNodeProps | GQL.SelectionNode> } & { kind: K }) | ({ directives?: ReadonlyArray<DirectiveNodeProps | DirectiveNode>; name: NameNodeProps | NameNode } & { kind: K }) | ({ directives?: ReadonlyArray<DirectiveNodeProps | DirectiveNode>; selections: ReadonlyArray<SelectionNodeProps | GQL.SelectionNode>; typeCondition?: NamedTypeNodeProps | NamedTypeNode } & { kind: K }), string> = new Crud({parent: this.node,key: this.node.kind === Kind.SELECTION_SET ? 'selections' : 'selectionSet',api: Api.selectionApi,factory: Ast.selectionNode,matcher: (node): string =>(node.kind !== Kind.INLINE_FRAGMENT ? node.name.value : node.typeCondition?.name.value) ?? '',ref: this._selectionsRef,})

Protected _selectionsRef

_selectionsRef: undefined | (Anonymous function) = this.node.kind === Kind.SELECTION_SET ? undefined: (next?: GQL.SelectionNode[]): GQL.SelectionNode[] => {const _node = this.node as Mutable<Exclude<SelectionSetMixinNode, GQL.SelectionSetNode>>if (!_node.selectionSet) {_node.selectionSet = Ast.selectionSetNode({ selections: [] })}if (!_node.selectionSet.selections) {_node.selectionSet.selections = []}if (next) {_node.selectionSet.selections = next}return _node.selectionSet.selections as GQL.SelectionNode[]}

Readonly node

node: FieldNode

Methods

assertField

assertFragmentSpread

assertInflineFragment

assertKind

createArgument

  • createArgument(props: Ast.ArgumentNodeProps | ArgumentNode): this
  • Parameters

    • props: Ast.ArgumentNodeProps | ArgumentNode

    Returns this

createDirective

  • createDirective(props: Ast.DirectiveNodeProps | DirectiveNode): this
  • Parameters

    • props: Ast.DirectiveNodeProps | DirectiveNode

    Returns this

createField

  • createField(props: Ast.FieldNodeProps | FieldNode): this
  • Parameters

    • props: Ast.FieldNodeProps | FieldNode

    Returns this

createFragmentSpread

  • createFragmentSpread(props: Ast.FragmentSpreadNodeProps | FragmentSpreadNode): this

createInlineFragment

  • createInlineFragment(props: Ast.InlineFragmentNodeProps | InlineFragmentNode): this

getArgument

getArgumentNames

getArguments

getDirective

getDirectiveNames

getDirectives

getField

getFields

getFragmentSpead

getFragmentSpreads

getInlineFragment

getInlineFragments

getName

  • getName(): string
  • Returns string

getSelectionSet

getSelections

  • getSelections(): Api.SelectionApi[]

hasArgument

  • hasArgument(argname: Argname): boolean

hasDirective

hasField

hasFragmentSpread

hasInlineFragment

  • hasInlineFragment(typeCondition?: Typename): boolean

hasSelectionSet

  • hasSelectionSet(): boolean

isField

  • isField(): this is FieldApi

isFragmentSpread

  • isFragmentSpread(): this is FragmentSpreadApi

isInflineFragment

  • isInflineFragment(): this is InlineFragmentApi

isKind

  • isKind<K>(kind: K): this is KindToApiType<K>
  • Type parameters

    • K: GQL.KindEnum

    Parameters

    • kind: K

    Returns this is KindToApiType<K>

removeArgument

  • removeArgument(argname: Argname): this

removeDirective

removeField

removeFragmentSpread

  • removeFragmentSpread(props: Ast.FragmentSpreadNodeProps | FragmentSpreadNode): this

removeInlineFragment

  • removeInlineFragment(typeCondition: Typename): this

removeSelectionSet

  • removeSelectionSet(): this

setName

  • setName(value: string): this
  • Parameters

    • value: string

    Returns this

updateArgument

  • updateArgument(argname: Argname, props: Partial<Ast.ArgumentNodeProps | ArgumentNode>): this
  • Parameters

    • argname: Argname
    • props: Partial<Ast.ArgumentNodeProps | ArgumentNode>

    Returns this

updateDirective

  • updateDirective(directivename: Directivename, props: Ast.DirectiveNodeProps | Partial<Ast.DirectiveNodeProps | DirectiveNode>): this
  • Parameters

    • directivename: Directivename
    • props: Ast.DirectiveNodeProps | Partial<Ast.DirectiveNodeProps | DirectiveNode>

    Returns this

updateField

  • updateField(fieldname: Fieldname, props: Ast.FieldNodeProps | FieldNode): this

updateFragmentSpread

  • updateFragmentSpread(fragmentname: Fragmentname, props: Ast.FragmentSpreadNodeProps | Partial<Ast.FragmentSpreadNodeProps> | FragmentSpreadNode): this

updateInlineFragment

  • updateInlineFragment(typeCondition: Typename | undefined, props: Partial<Ast.InlineFragmentNodeProps | InlineFragmentNode>): this

upsertArgument

  • upsertArgument(props: Ast.ArgumentNodeProps | ArgumentNode): this
  • Parameters

    • props: Ast.ArgumentNodeProps | ArgumentNode

    Returns this

upsertDirective

  • upsertDirective(props: Ast.DirectiveNodeProps | DirectiveNode): this
  • Parameters

    • props: Ast.DirectiveNodeProps | DirectiveNode

    Returns this

upsertField

  • upsertField(props: Ast.FieldNodeProps | FieldNode): this
  • Parameters

    • props: Ast.FieldNodeProps | FieldNode

    Returns this

upsertFragmentSpread

  • upsertFragmentSpread(props: Ast.FragmentSpreadNodeProps | FragmentSpreadNode): this

upsertInlineFragment

  • upsertInlineFragment(props: Ast.InlineFragmentNodeProps | InlineFragmentNode): this

Generated using TypeDoc