UNPKG

polen

Version:

A framework for delightful GraphQL developer portals

52 lines 3.76 kB
/** * Tree-sitter GraphQL Grammar Node Types * * This file defines all possible node types from the tree-sitter-graphql grammar. * These types are used by the tree-sitter parser when parsing GraphQL documents. * * Source: https://github.com/bkegley/tree-sitter-graphql * * Having these as a TypeScript union type enables: * - Type-safe node.type checking * - IntelliSense/autocomplete in IDEs * - Compile-time verification of node type strings * - Better code maintainability and refactoring */ /** * All possible node types that can be returned by tree-sitter-graphql * when parsing GraphQL documents. */ export type TreeSitterGraphQLNodeType = 'document' | 'definition' | 'executable_definition' | 'type_system_definition' | 'type_system_extension' | 'source_file' | 'operation_definition' | 'selection_set' | 'selection' | 'field' | 'alias' | 'fragment_definition' | 'fragment_spread' | 'inline_fragment' | 'fragment_name' | 'type_condition' | 'arguments' | 'argument' | 'variable' | 'variable_definition' | 'variable_definitions' | 'default_value' | 'type' | 'named_type' | 'list_type' | 'non_null_type' | 'type_definition' | 'scalar_type_definition' | 'object_type_definition' | 'interface_type_definition' | 'union_type_definition' | 'enum_type_definition' | 'input_object_type_definition' | 'type_extension' | 'scalar_type_extension' | 'object_type_extension' | 'interface_type_extension' | 'union_type_extension' | 'enum_type_extension' | 'input_object_type_extension' | 'schema_definition' | 'schema_extension' | 'root_operation_type_definition' | 'fields_definition' | 'field_definition' | 'arguments_definition' | 'input_value_definition' | 'input_fields_definition' | 'directives' | 'directive' | 'directive_definition' | 'directive_locations' | 'directive_location' | 'enum_values_definition' | 'enum_value_definition' | 'enum_value' | 'implements_interfaces' | 'union_member_types' | 'description' | 'value' | 'string_value' | 'int_value' | 'float_value' | 'boolean_value' | 'null_value' | 'list_value' | 'object_value' | 'object_field' | 'name' | 'comment' | 'comma' | '{' | '}' | '(' | ')' | '[' | ']' | ':' | '=' | ',' | '!' | '|' | '&' | '@' | '...' | '$' | 'query' | 'mutation' | 'subscription' | 'fragment' | 'on' | 'type' | 'interface' | 'enum' | 'scalar' | 'union' | 'input' | 'schema' | 'directive' | 'implements' | 'extend' | 'true' | 'false' | 'null' | 'error_hint' | 'whitespace'; /** * Subset of node types that are interactive in Polen's GraphQL viewer */ export type InteractiveNodeParentType = 'named_type' | 'field'; /** * Subset of node types that are non-interactive user-defined names */ export type NonInteractiveNodeParentType = 'operation_definition' | 'fragment_definition' | 'variable_definition' | 'argument'; /** * Node types that represent keywords in GraphQL */ export type KeywordNodeType = 'query' | 'mutation' | 'subscription' | 'fragment' | 'on'; /** * Node types that represent literal values */ export type LiteralNodeType = 'string_value' | 'int_value' | 'float_value' | 'boolean_value' | 'null_value' | 'enum_value'; /** * Node types that represent punctuation */ export type PunctuationNodeType = '{' | '}' | '(' | ')' | '[' | ']' | ':' | '=' | ',' | '!' | '|' | '&' | '@' | '...' | '$'; /** * Helper function to check if a node type is a keyword */ export declare function isKeywordNodeType(type: string): type is KeywordNodeType; /** * Helper function to check if a node type is a literal */ export declare function isLiteralNodeType(type: string): type is LiteralNodeType; /** * Helper function to check if a node type is punctuation */ export declare function isPunctuationNodeType(type: string): type is PunctuationNodeType; //# sourceMappingURL=graphql-node-types.d.ts.map