@terabits/grapi
Version:
Grapi Schema Generator For GraphQL Server
31 lines (30 loc) • 1.14 kB
TypeScript
import Field from './field';
import Model from './model';
import { RelationShip, RelationType } from './relation/types';
export declare type ModelOrThunk = Model | (() => Model);
export declare type RelationConfigOrThunk = Record<string, any> | (() => Record<string, any>);
export default class RelationField extends Field {
private relationTo;
private relationConfig?;
private relationName?;
private relationType?;
private relation?;
constructor({ relationTo, relationConfig, nonNull, list, nonNullItem, readOnly, }: {
relationTo: ModelOrThunk;
relationConfig?: RelationConfigOrThunk;
nonNull?: boolean;
list?: boolean;
nonNullItem?: boolean;
readOnly?: boolean;
});
getTypename(): string;
getRelationTo(): Model;
getRelationConfig(): Record<string, any>;
getFields(): Record<string, Field>;
getRelationName(): string;
setRelationName(name: string): void;
getRelationType(): RelationType;
setRelationType(relationType: RelationType): void;
getRelation(): RelationShip;
setRelation(relationShip: RelationShip): void;
}