/**
 * GraphQL Parser Module
 * 
 * Main entry point for GraphQL schema parsing and transformation.
 */ export * from './types';
export * from './parser';
export * from './transformer';
import { parseGraphQLSchema, validateGraphQLSchema } from './parser';
import { convertGraphQLToBrainfishCollection, convertGraphQLToCollection } from './transformer';
export const GRAPHQL_INVALID_SCHEMA = 'graphql/invalid_schema';
/**
 * Import a GraphQL schema from SDL string or file content
 * Returns a BrainfishCollection for integration with existing UI
 */ export async function importGraphQLSchema(input, options = {}) {
    const { name = 'GraphQL API', endpoint = '/graphql', description } = options;
    // Validate the schema
    const validation = validateGraphQLSchema(input);
    if (!validation.valid) {
        throw new Error(`${GRAPHQL_INVALID_SCHEMA}: ${validation.error}`);
    }
    // Parse the schema
    const schema = parseGraphQLSchema(input);
    // Convert to BrainfishCollection
    return convertGraphQLToBrainfishCollection(schema, name, endpoint, description);
}
/**
 * Import a GraphQL schema and return the full GraphQL collection
 * with schema information preserved
 */ export async function importGraphQLSchemaFull(input, options = {}) {
    const { name = 'GraphQL API', endpoint = '/graphql', description } = options;
    // Validate the schema
    const validation = validateGraphQLSchema(input);
    if (!validation.valid) {
        throw new Error(`${GRAPHQL_INVALID_SCHEMA}: ${validation.error}`);
    }
    // Parse the schema
    const schema = parseGraphQLSchema(input);
    // Convert to full GraphQL collection
    return convertGraphQLToCollection(schema, name, endpoint, description);
}
/**
 * Parse GraphQL schema without converting to collection
 * Useful for schema exploration and type information
 */ export async function parseGraphQL(input) {
    const validation = validateGraphQLSchema(input);
    if (!validation.valid) {
        throw new Error(`${GRAPHQL_INVALID_SCHEMA}: ${validation.error}`);
    }
    return parseGraphQLSchema(input);
}
