import { default as DBrowser } from './DBrowser'; import { default as Loader } from './Loader'; import { default as IntegrityChecker } from './IntegrityChecker'; import { JsonjsdbConfig, PartialJsonjsdbConfig, IntegrityResult, Schema, DatabaseMetadata, DatabaseRow, TableCollection, FilterBuilder } from './types'; type InitOption = { filterBuilder?: FilterBuilder; useCache?: boolean; version?: number | string; limit?: number; validIdChars?: string; }; type LoadOption = { useCache?: boolean; version?: number | string; shouldStandardizeIds?: boolean; shouldTransformKeys?: boolean; }; type ForeignTableObj = { [tableName: string]: string | number | { id: string | number; } | undefined; }; export type AddRelationOptions = { ifExists?: 'throw' | 'ignore'; }; export type AddRelationsResult = { added: Array; ignored: Array; }; export default class Jsonjsdb = Record> { defaultConfig: JsonjsdbConfig; config: JsonjsdbConfig; browser: DBrowser; loader: Loader; integrityChecker: IntegrityChecker; tables: TableCollection; metadata: DatabaseMetadata; private idSuffix; private usageCache; private recursiveUsageCache; private relationTableNames; constructor(config?: string | PartialJsonjsdbConfig); private getHtmlConfig; private setConfig; init(option?: InitOption): Promise>; load(filePath: string, name: string, option?: boolean | LoadOption): Promise; get(table: K & string, id: string | number): TEntityTypeMap[K] | undefined; getAll(table: K & string, foreignTableObj?: ForeignTableObj, option?: InitOption): TEntityTypeMap[K][]; private resolveRelationIndexField; getAllChilds(table: K & string, itemId: string | number): TEntityTypeMap[K][]; foreach(table: K & string, callback: (row: TEntityTypeMap[K]) => void): void; exists(table: K & string, id: string | number): boolean; getConfig(id: string | number): string | number | undefined; countRelated(table: K & string, id: string | number, relatedTable: string, relationKey?: string): number; update(table: K & string, id: string | number, patch: Partial): TEntityTypeMap[K] | undefined; insert(table: K & string, row: TEntityTypeMap[K]): TEntityTypeMap[K]; addRelation(table: K & string, id: string | number, relationField: string, relatedId: string | number, options?: AddRelationOptions): boolean; addRelations(table: K & string, id: string | number, relationField: string, relatedIds: Array, options?: AddRelationOptions): AddRelationsResult; addForeignKey(table: K & string, id: string | number, relationField: string, relatedId: string | number): boolean; getParents(from: K & string, id: string | number): TEntityTypeMap[K][]; addMeta(userData?: Record, dbSchema?: Record[]): void; getLastModifTimestamp(): number; get use(): Partial>; get useRecursive(): Partial>; private computeUsage; getSchema(): Schema; checkIntegrity(): Promise; private getMutableTable; private ensureTableIndex; private assertPatchAllowed; private addInsertedRowIndexes; private ensureIndex; private addPositionToIndex; private pushPositionToIndex; private relationFieldToTable; private resolveRelationField; private getRelationTableNames; private relationTableName; private appendRelation; private ensureRelationTable; private getRowPosition; private hasRelation; private planRelations; private appendRelationFieldValue; private appendRelationFieldValues; private sameId; private parseIds; private serializeIds; } export {};