UNPKG

simple-graphql

Version:

The simple way to generates GraphQL schemas and Sequelize models from your models definition.

54 lines (53 loc) 1.96 kB
import { BaseSGSchemaOptions, SGColumnFieldConfigMap, SGLinkedFieldConfigMap, SGMutationConfigMap, SGQueryConfigMap, SGSubscriptionConfigMap } from '..'; export declare class BaseSGSchema { name: string; config: { fields: SGColumnFieldConfigMap; links: SGLinkedFieldConfigMap; queries: SGQueryConfigMap; subscriptions: SGSubscriptionConfigMap; mutations: SGMutationConfigMap; methods: { [id: string]: any; }; statics: { [id: string]: any; }; }; options: BaseSGSchemaOptions; constructor(name: string, options?: BaseSGSchemaOptions); /** * Add the model base fields, and each field has a corresponding database column. * In default, each field generate a GraphQL field, unless it config with "hidden:true". */ fields<T extends BaseSGSchema>(this: T, fields: SGColumnFieldConfigMap): T; /** * Add the model link fields, and each link generate a GraphQL field but no corresponding database column. */ links<T extends BaseSGSchema>(this: T, links: SGLinkedFieldConfigMap): T; /** * Add the GraphQL query methods. */ queries<T extends BaseSGSchema>(this: T, queries: SGQueryConfigMap): T; /** * Add the GraphQL subscription methods. */ subscriptions<T extends BaseSGSchema>(this: T, subscriptions: SGSubscriptionConfigMap): T; /** * Add the GraphQL mutataion methods. */ mutations<T extends BaseSGSchema>(this: T, mutations: SGMutationConfigMap): T; /** * Add instance method to current Schema. */ methods<T extends BaseSGSchema>(this: T, methods: { [key: string]: any; }): T; /** * Add statics method to current Schema. */ statics<T extends BaseSGSchema>(this: T, statics: { [key: string]: any; }): T; plugin<E>(plugin: (schema: BaseSGSchema, options: E) => void, options: E): void; }