git-documentdb
Version:
Offline-first database that syncs with Git
77 lines • 2.89 kB
TypeScript
/**
* GitDocumentDB
* Copyright (c) Hidekazu Kubota
*
* This source code is licensed under the Mozilla Public License Version 2.0
* found in the LICENSE file in the root directory of gitDDB source tree.
*/
import { ReadBlobResult } from 'isomorphic-git';
import { DocType, FatDoc, NormalizedCommit, SerializeFormat } from '../types';
/**
* Write blob to file system
*
* @throws {@link Err.CannotCreateDirectoryError}
*/
export declare function writeBlobToFile(workingDir: string, name: string, data: string | Uint8Array): Promise<void>;
/**
* getFatDocFromData
*
* @throws {@link Err.InvalidJsonObjectError}
*/
export declare function getFatDocFromData(data: string | Uint8Array, fullDocPath: string, docType: DocType, serializeFormat: SerializeFormat): Promise<FatDoc>;
/**
* getFatDocFromOid
*
* @throws {@link Err.InvalidJsonObjectError} (from getFatDocFromReadBlobResult)
*/
export declare function getFatDocFromOid(workingDir: string, fullDocPath: string, fileOid: string, docType: DocType, serializeFormat: SerializeFormat): Promise<FatDoc>;
/**
* getFatDocFromReadBlobResult
*
* @throws {@link Err.InvalidJsonObjectError}
*/
export declare function getFatDocFromReadBlobResult(fullDocPath: string, readBlobResult: ReadBlobResult, docType: DocType, serializeFormat: SerializeFormat): FatDoc;
/**
* Get changed files
*
* @throws {@link Err.InvalidJsonObjectError} (from getFatDocFromOid)
*
* @internal
*/
export declare function getChanges(workingDir: string, oldCommitOid: string | undefined, newCommitOid: string, serializeFormat: SerializeFormat): Promise<any>;
/**
* Get and write changed files on local
*
* @throws {@link Err.InvalidJsonObjectError} (from getFatDocFromOid)
* @throws {@link Err.CannotCreateDirectoryError} (from writeBlobToFile)
*
* @internal
*/
export declare function getAndWriteLocalChanges(workingDir: string, oldCommitOid: string, newCommitOid: string, serializeFormat: SerializeFormat): Promise<any>;
/**
* Get commit logs by walking backward
*
* @remarks
*
* - Logs are sorted by topology. Ancestors are placed before descendants. Topic branches are placed before the main branch.
*
* - Walking stops when it reaches to walkToCommitOid or walkToCommitOid2.
*
* - Use walkToCommitOid2 when walkFromCommit has two parents.
*
* - walkToCommit is not included to return value.
*
* @internal
*/
export declare function getCommitLogs(workingDir: string, walkFromCommitOid: string, walkToCommitOid?: string, walkToCommitOid2?: string): Promise<NormalizedCommit[]>;
/**
* Calc distance
*/
export declare function calcDistance(baseCommitOid: string, localCommitOid: string, remoteCommitOid: string): {
ahead: undefined;
behind: undefined;
} | {
ahead: number;
behind: number;
};
//# sourceMappingURL=worker_utils.d.ts.map