///
import { EventEmitter } from 'events';
import { Fragment, Operation } from 'graphql-tool-utilities';
import { PrintDocumentOptions, PrintSchemaOptions } from './print';
import { EnumFormat } from './types';
export { EnumFormat };
export interface Options extends PrintDocumentOptions, PrintSchemaOptions {
addTypename: boolean;
schemaTypesPath: string;
}
export interface BuilderOptions extends Options {
cwd?: string;
}
export interface RunOptions {
watch?: boolean;
}
export interface SchemaBuild {
schemaPath: string;
schemaTypesPath: string;
}
export interface DocumentBuild {
documentPath: string;
definitionPath: string;
operation?: Operation;
fragments: Fragment[];
}
export declare class Builder extends EventEmitter {
private options;
private readonly config;
private documentMapByProject;
private readonly watchers;
constructor({cwd, ...options}: BuilderOptions);
once(event: 'error', handler: (error: Error) => void): this;
once(event: 'build:docs', handler: (built: DocumentBuild) => void): this;
once(event: 'build:schema', handler: (built: SchemaBuild) => void): this;
once(event: 'start:docs', handler: () => void): this;
once(event: 'end:docs', handler: () => void): this;
once(event: 'start:schema', handler: () => void): this;
once(event: 'end:schema', handler: () => void): this;
on(event: 'error', handler: (error: Error) => void): this;
on(event: 'build:docs', handler: (built: DocumentBuild) => void): this;
on(event: 'build:schema', handler: (built: SchemaBuild) => void): this;
on(event: 'start:docs', handler: () => void): this;
on(event: 'end:docs', handler: () => void): this;
on(event: 'start:schema', handler: () => void): this;
on(event: 'end:schema', handler: () => void): this;
emit(event: 'error', error: Error): boolean;
emit(event: 'build:docs', built: DocumentBuild): boolean;
emit(event: 'build:schema', built: SchemaBuild): boolean;
emit(event: 'start:docs'): boolean;
emit(event: 'end:docs'): boolean;
emit(event: 'start:schema'): boolean;
emit(event: 'end:schema'): boolean;
run({watch: watchGlobs}?: {
watch?: boolean;
}): Promise;
stop(): void;
private setupDocumentWatchers();
private setupSchemaWatcher();
private generateSchemaTypes(schemaPath);
private generateDocumentTypes();
private checkForDuplicateOperations();
private generateDocumentTypesForProject(projectConfig, documents);
private writeDocumentFile(file, ast, projectConfig);
private getDocumentDefinition(file, ast, projectConfig);
private updateDocumentsForProject(projectConfig);
private updateDocumentForFile(filePath, projectConfig);
private setDocumentForFilePath(filePath, projectConfig, contents);
}