/** * GraphQL AST Parser for URL State Management * * Extracts variable definitions from GraphQL DocumentNode at runtime * to automatically generate URL parameter handling. */ import { DocumentNode } from 'graphql'; /** * JavaScript type that can be represented in URL parameters */ export type JSType = 'string' | 'number' | 'boolean' | 'array' | 'object'; /** * Variable definition extracted from GraphQL query */ export interface VariableDefinition { /** Variable name (e.g., "search", "filter") */ name: string; /** JavaScript type for URL parameter handling */ type: JSType; /** Whether the variable is required (non-null in GraphQL) */ required: boolean; /** Whether the variable is an array/list */ isArray: boolean; /** Original GraphQL type name (e.g., "String", "LogFilterInput") */ graphqlTypeName: string; } /** * Extract all variable definitions from a GraphQL query * * @param query - GraphQL DocumentNode (from gql template tag) * @returns Record of variable definitions keyed by variable name * * @example * const LOGS_QUERY = gql` * query GetLogs($search: String, $filter: LogFilterInput) { ... } * ` * * const variables = extractVariablesFromQuery(LOGS_QUERY) * // { * // search: { name: 'search', type: 'string', ... }, * // filter: { name: 'filter', type: 'object', graphqlTypeName: 'LogFilterInput' } * // } */ export declare function extractVariablesFromQuery(query: DocumentNode): Record; /** * Check if a GraphQL type is a scalar type */ export declare function isScalarType(graphqlTypeName: string): boolean; /** * Check if a GraphQL type is an input object type */ export declare function isInputObjectType(graphqlTypeName: string): boolean; //# sourceMappingURL=graphql-parser.d.ts.map