export default interface Schema { fields: Field[]; tableName?: string; patterns?: Pattern[]; edges?: Edge[]; edgeGroups?: AssocEdgeGroup[]; actions?: Action[]; enumTable?: boolean; dbRows?: { [key: string]: any; }[]; constraints?: Constraint[]; indices?: Index[]; hideFromGraphQL?: boolean; } export interface AssocEdge { name: string; schemaName: string; symmetric?: boolean; unique?: boolean; inverseEdge?: InverseAssocEdge; tableName?: string; edgeActions?: EdgeAction[]; hideFromGraphQL?: boolean; } export interface EdgeAction { operation: ActionOperation; actionName?: string; hideFromGraphQL?: boolean; graphQLName?: string; actionOnlyFields?: ActionField[]; } export interface InverseAssocEdge { name: string; } export interface EdgeGroupAction { operation: ActionOperation.EdgeGroup; actionName?: string; hideFromGraphQL?: boolean; graphQLName?: string; actionOnlyFields?: ActionField[]; } export interface AssocEdgeGroup { name: string; groupStatusName: string; tableName?: string; assocEdges: AssocEdge[]; statusEnums?: string[]; nullStates: string | string[]; nullStateFn?: string; edgeAction?: EdgeGroupAction; } export declare type Edge = AssocEdge; export interface Pattern { fields: Field[]; } export declare enum DBType { UUID = "UUID", Int64ID = "Int64ID", Boolean = "Boolean", Int = "Int", Float = "Float", String = "String", Timestamp = "Timestamp", Timestamptz = "Timestamptz", JSON = "JSON", Enum = "Enum", StringEnum = "StringEnum", Date = "Date", Time = "Time", Timetz = "Timetz", List = "List" } export interface Type { dbType: DBType; listElemType?: Type; type?: string; graphQLType?: string; values?: string[]; } export interface ForeignKey { schema: string; column: string; name?: string; disableIndex?: boolean; } export interface FieldEdge { schema: string; inverseEdge: string; } export interface FieldOptions { name: string; nullable?: boolean; storageKey?: string; serverDefault?: any; unique?: boolean; hideFromGraphQL?: boolean; private?: boolean; sensitive?: boolean; graphqlName?: string; index?: boolean; foreignKey?: ForeignKey; fieldEdge?: FieldEdge; primaryKey?: boolean; disableUserEditable?: boolean; defaultValueOnCreate?(): any; defaultValueOnEdit?(): any; derivedWhenEmbedded?: boolean; polymorphic?: boolean | PolymorphicOptions; derivedFields?: Field[]; } export interface PolymorphicOptions { types?: string[]; hideFromInverseGraphQL?: boolean; } export interface Field extends FieldOptions { type: Type; valid?(val: any): boolean; format?(val: any): any; logValue(val: any): any; } export interface SchemaConstructor { new (): Schema; } export declare type SchemaInputType = Schema | SchemaConstructor; export declare function getFields(value: SchemaInputType): Map; export declare enum ActionOperation { Create = 1, Edit = 2, Delete = 4, Mutations = 8, AddEdge = 16, RemoveEdge = 32, EdgeGroup = 64 } declare type actionFieldType = "ID" | "Boolean" | "Int" | "Float" | "String" | "Time" | "Object"; declare type NullableListOptions = "contents" | "contentsAndList"; export interface ActionField { name: string; type: actionFieldType; nullable?: boolean | NullableListOptions; list?: boolean; actionName?: string; } export interface Action { operation: ActionOperation; fields?: string[]; actionName?: string; inputName?: string; graphQLName?: string; hideFromGraphQL?: boolean; actionOnlyFields?: ActionField[]; } export declare const NoFields = "__NO_FIELDS__"; export declare function requiredField(field: string): string; export declare function optionalField(field: string): string; export interface Constraint { name: string; type: ConstraintType; columns: string[]; fkey?: ForeignKeyInfo; condition?: string; } export interface Index { name: string; columns: string[]; unique?: boolean; } export interface ForeignKeyInfo { tableName: string; ondelete?: "RESTRICT" | "CASCADE" | "SET NULL" | "SET DEFAULT" | "NO ACTION"; columns: string[]; } export declare enum ConstraintType { PrimaryKey = "primary", ForeignKey = "foreign", Unique = "unique", Check = "check" } export {};