import { Table } from '../table/Table'; import { PreInsertStep, TableInitStep } from '../table/CompiledSteps'; import { SchemaDecl } from './SchemaDecl'; import { IndexSchema } from '../table/IndexSchema'; export declare function fromLooseSchema(loose: LooseSchema): Schema; export type LooseSchema = Schema | SchemaDecl; export declare class SchemaAttr { attr: string; isAuto?: boolean; frozen: boolean; constructor(attr: string); freeze(): void; } export type SchemaFuncName = 'insert' | 'preInsert' | 'listAll' | 'getWithIndexKey' | 'listWithIndexKey' | 'group_by' | 'each' | 'eachWithFilter' | 'first' | 'count' | 'getSingleValue' | 'setSingleValue' | 'has' | 'update' | 'updateWithIndexKey' | 'deleteWithIndexKey' | 'deleteItem' | 'deleteAll' | 'replaceAll' | 'itemEquals' | 'upgradeSchema' | 'item_to_uniqueKey' | 'item_matches_uniqueKey' | 'get_using_uniqueKey' | 'delete_using_uniqueKey' | 'listen' | 'listenToStream' | 'getStatus' | 'receiveUpdate' | 'diff'; export interface SchemaFuncParams { funcName: SchemaFuncName; declaredName?: string; publicName?: string; paramAttrs?: string[]; indexName?: string; } export declare class SchemaFunc { publicName: string; declaredName: string; funcName: SchemaFuncName; paramAttrs: string[] | null; indexName: string | null; constructor(params: SchemaFuncParams); findParamIndex(attr: string): number; } export type OnConflictOption = 'error' | 'overwrite'; interface UniqueConstrant { attrs: string[]; onConflict: OnConflictOption; } type Constraint = UniqueConstrant; export declare class Schema = Table> { name: string; decl: SchemaDecl; attrs: SchemaAttr[]; funcs: SchemaFunc[]; funcsByPublicName: Map; funcsByDeclaredName: Map; indexes: IndexSchema[]; indexesByName: Map; primaryUniqueIndex: IndexSchema; primaryUniqueAttr: string | null; defaultIndex: IndexSchema; constraints: Constraint[]; supportsListening: boolean; supportsUpdateEvents: boolean; setupTable: TableInitStep[]; preInsert: PreInsertStep[]; frozen: boolean; constructor(decl: SchemaDecl); freeze(): void; createTable(): TableType; addFuncs(funcs: string[]): Schema>; toSingular({ funcs }: { funcs: string[]; }): SchemaDecl; addIndex(index: IndexSchema): void; getIndexByName(indexName: string): IndexSchema; eachIndex(): Generator; checkSupportsFunc(funcName: string): boolean; assertSupportsFunc(funcName: string): void; checkFitsSchema(schema: Schema): boolean; assertFitsSchema(schema: Schema): void; supportsFunc(funcName: string): boolean; findFuncWithParams(funcName: SchemaFuncName, paramAttrs: string[]): SchemaFunc | null; getPublicFuncNameForDeleteUsingIndex(indexName: string): string; } export {};