@terabits/grapi
Version:
Grapi Schema Generator For GraphQL Server
45 lines (44 loc) • 1.58 kB
TypeScript
import { IObjectTypeResolver } from 'graphql-tools';
import { DataSource } from '..';
import { MutationFactory } from '../plugins/mutation';
import Field from './field';
import { DirectiveModelAction } from './type';
export default class Model {
private readonly name;
private readonly fields;
private readonly namings;
private dataSource;
private resolver;
private metadata;
private createMutationFactory;
private updateMutationFactory;
private readonly isObject;
constructor({ name, fields, isObject, }: {
name: string;
fields?: Record<string, Field>;
isObject?: boolean;
});
appendField(name: string, field: Field): void;
getField(name: string): Field;
getFields(): Record<string, Field>;
getName(): string;
getNamings(): {
plural: string;
singular: string;
capitalSingular: string;
};
getTypename(): string;
getUniqueFields(): Record<string, Field>;
getMetadata(key: string): Record<string, any>;
setMetadata(key: string, value: any): Record<string, any>;
setFieldResolver(field: string, resolver: any): void;
overrideResolver(resolver: any): void;
mergeResolver(resolver: any): void;
getResolver(): IObjectTypeResolver;
setDataSource(dataSource: DataSource): void;
getDataSource(): DataSource;
getDirectives(action: DirectiveModelAction, directivesOnAction?: string): string;
getCreateMutationFactory: () => MutationFactory;
getUpdateMutationFactory: () => MutationFactory;
isObjectType: () => boolean;
}