import { DocumentNode , GraphQLFieldResolver } from 'graphql' ; import { GraphQLGenie } from '.' ; import { GraphQLSchemaBuilder } from './GraphQLSchemaBuilder' ; export interface TypeGenerator { getResolvers ( ) : Map < string , Map < string , GraphQLFieldResolver < any , any > > > ; getFieldsOnObject ( ) : Map < string , object > ; } export interface Aggregate { count : number ; } export interface PageInfo { hasNextPage : boolean ; hasPreviousPage : boolean ; startCursor ? : string ; endCursor ? : string ; } export class Connection { edges : any [ ] ; aggregate : Aggregate ; pageInfo : PageInfo ; constructor ( ) { this . aggregate = { count : - 1 } ; this . pageInfo = { hasNextPage : false , hasPreviousPage : false , startCursor : '' , endCursor : '' } ; } } export interface Features { logicalOperators : boolean ; } export interface DataResolver { create ( graphQLTypeName , records , meta ? ) : Promise < any > ; find ( graphQLTypeName , ids ? , options ? , meta ? ) : Promise < any > ; update ( graphQLTypeName , updates , meta ? , options ? ) : Promise < any > ; delete ( graphQLTypeName , ids ? , meta ? ) : Promise < any > ; addOutputHook ( graphQLTypeName , hook ) ; addInputHook ( graphQLTypeName , hook ) ; getValueByUnique ( returnTypeName , args , meta ) : Promise < Object > ; canAdd ( graphQLTypeName , records , meta ) : Promise < boolean > ; getConnection ( allEdges , before , after , first , last ) : Connection ; getFeatures ( ) : Features ; applyOptions ( graphQLTypeName , records , options , meta ? ) ; getStore ( ) : any ; beginTransaction ( ) : Promise < void > ; endTransaction ( ) : Promise < void > ; computeId ( graphType , id ? ) : string ; getTypeFromId ( inputId ) : string ; getOriginalIdFromObjectId ( inputId ) : string ; getLink ( graphQLTypeName , field ) : string ; } export interface GenerateConfig { generateGetOne ? : boolean ; generateGetAll ? : boolean ; generateCreate ? : boolean ; generateUpdate ? : boolean ; generateDelete ? : boolean ; generateUpsert ? : boolean ; generateConnections ? : boolean ; generateMigrations ? : boolean ; } export interface GraphQLGenieOptions { schemaBuilder ? : GraphQLSchemaBuilder ; typeDefs ? : string | DocumentNode ; generatorOptions ? : GenerateConfig ; fortuneOptions ? : FortuneOptions ; fortuneRecordTypeDefinitions ? : FortuneRecordTypeDefinitions ; plugins ? : GeniePlugin [ ] | GeniePlugin ; } export interface FortuneSettings { enforceLinks ? : boolean ; name ? : string ; description ? : string ; } export interface FortuneOptions { adapter ? : any ; hooks ? : object ; documentation ? : object ; settings ? : FortuneSettings ; } export interface FortuneRecordTypeDefinitions { [ key ] : { [ property ] : any ; } ; } export interface GeniePlugin { ( genie ) : any ; } export interface DataResolverInputHook { ( context ? , record ? , update ? ) : any ; } export interface DataResolverOutputHook { ( context ? , record ? ) : any ; } export type GenericObject = { [ key ] : any ; } ;