alinea
Version:
[](https://npmjs.org/package/alinea) [](https://packagephobia.com/result?p=alinea)
51 lines (50 loc) • 1.76 kB
TypeScript
import { Config, PageSeed, SyncResponse, Syncable } from 'alinea/core';
import { EntryRecord } from 'alinea/core/EntryRecord';
import { Mutation } from 'alinea/core/Mutation';
import { Driver, Select } from 'rado';
import { EntryRow } from '../core/EntryRow.js';
import { Source } from './Source.js';
import { Store } from './Store.js';
import { Target } from './Target.js';
interface Seed {
type: string;
workspace: string;
root: string;
filePath: string;
page: PageSeed;
}
export declare class Database implements Syncable {
config: Config;
store: Store;
seed: Map<string, Seed>;
constructor(config: Config, store: Store);
syncRequired(contentHash: string): Promise<boolean>;
sync(contentHashes: Array<string>): Promise<SyncResponse>;
contentHashes(): Promise<string[]>;
syncWith(remote: Syncable, force?: boolean): Promise<Array<string>>;
applyMutations(mutations: Array<Mutation>, commitHash?: string): Promise<string[]>;
private applyPublish;
private updateChildren;
logEntries(): Promise<void>;
private applyMutation;
updateHash(tx: Driver.Async, selection: Select<EntryRow>): Promise<string[]>;
meta(): Promise<{
commitHash: string;
contentHash: string;
modifiedAt: number;
}>;
static index(tx: Driver.Async): Promise<{
rowsAffected: number;
}>;
private writeMeta;
inited: boolean;
init(): Promise<void>;
computeEntry(record: EntryRecord, meta: {
workspace: string;
root: string;
filePath: string;
}, seed?: Seed): Omit<EntryRow, 'rowHash' | 'fileHash'>;
seedData(): Map<string, Seed>;
fill(source: Source, commitHash: string, target?: Target): Promise<void>;
}
export {};