/**
 * 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 this source tree.
 */
import { ILogObject, Logger, TLogLevelName } from 'tslog';
import { Collection } from './collection';
import { Validator } from './validator';
import { CollectionOptions, CollectionPath, ColoredLogger, DatabaseCloseOption, DatabaseOpenResult, DatabaseOptions, DeleteOptions, DeleteResult, DeleteResultJsonDoc, Doc, DocType, FatDoc, FindOptions, GetOptions, HistoryOptions, JsonDoc, NormalizedCommit, OpenOptions, PutOptions, PutResult, PutResultJsonDoc, RemoteOptions, Schema, SyncCallback, SyncEvent, SyncResult } from './types';
import { GitDDBInterface } from './types_gitddb';
import { Sync } from './remote/sync';
import { TaskQueue } from './task_queue';
import { SyncEventInterface, SyncInterface } from './types_sync';
import { CRUDInterface } from './types_crud_interface';
import { CollectionInterface, ICollection } from './types_collection';
import { SerializeFormatFrontMatter, SerializeFormatJSON } from './serialize_format';
/**
 * Get database ID
 *
 * @internal
 */
export declare function generateDatabaseId(): string;
/**
 * Main class of GitDocumentDB
 *
 * @remarks
 * Call open() before using DB.
 *
 * @public
 */
export declare class GitDocumentDB implements GitDDBInterface, CRUDInterface, CollectionInterface, SyncEventInterface {
    static plugin(obj: any): void;
    /***********************************************
     * Private properties
     ***********************************************/
    private _synchronizers;
    private _dbOpenResult;
    /***********************************************
     * Public properties (readonly)
     ***********************************************/
    /**
     * Serialize format for json object
     */
    private _serializeFormat;
    get serializeFormat(): SerializeFormatJSON | SerializeFormatFrontMatter;
    /**
     * Default Git branch
     *
     * @readonly
     * @public
     */
    readonly defaultBranch = "main";
    private _localDir;
    /**
     * A local directory path that stores repositories of GitDocumentDB
     *
     * @readonly
     * @public
     */
    get localDir(): string;
    private _dbName;
    /**
     * A name of a Git repository
     *
     * @readonly
     * @public
     */
    get dbName(): string;
    private _workingDir;
    /**
     * Get a full path of the current Git working directory
     *
     * @returns A full path whose trailing slash is omitted
     *
     * @readonly
     * @public
     */
    get workingDir(): string;
    /**
     * Get dbId
     *
     * @readonly
     * @public
     */
    get dbId(): string;
    private _tsLogger;
    /**
     * Get logger
     *
     * @readonly
     * @public
     */
    get tsLogger(): Logger;
    private _logger;
    /**
     * Get logger
     *
     * @readonly
     * @public
     */
    get logger(): ColoredLogger;
    private _schema;
    /**
     * Schema for specific document type
     *
     * @readonly
     * @public
     */
    get schema(): Schema;
    private _logToTransport;
    /**
     * logToTransport function for all log levels. See https://tslog.js.org/#/?id=transports
     *
     * @readonly
     * @public
     */
    get logToTransport(): ((logObject: ILogObject) => void) | undefined;
    private _taskQueue;
    /**
     * Task queue
     *
     * @readonly
     * @public
     */
    get taskQueue(): TaskQueue;
    private _isClosing;
    /**
     * DB is going to close
     *
     * @readonly
     * @public
     */
    get isClosing(): boolean;
    private _validator;
    /**
     * Name validator
     *
     * @readonly
     * @public
     */
    get validator(): Validator;
    private _rootCollection;
    /**
     * Default collection whose collectionPath is ''.
     *
     * @readonly
     * @public
     */
    get rootCollection(): ICollection;
    private _logColorEnabled;
    /***********************************************
     * Public properties
     ***********************************************/
    private _logLevel;
    /**
     * logLevel ('silly' | 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal')
     *
     * @public
     */
    get logLevel(): TLogLevelName;
    set logLevel(level: TLogLevelName);
    /**
     * Author name and email for commit
     *
     * @public
     */
    author: {
        name: string;
        email: string;
    };
    /**
     * Committer name and email for commit
     *
     * @public
     */
    committer: {
        name: string;
        email: string;
    };
    /**
     * Constructor
     *
     * @remarks
     * - The Git working directory will be `${options.localDir}/${options.dbName}`.
     *
     * @throws {@link Err.InvalidWorkingDirectoryPathLengthError}
     * @throws {@link Err.UndefinedDatabaseNameError}
     *
     * @public
     */
    constructor(options: DatabaseOptions & CollectionOptions);
    /***********************************************
     * Private methods
     ***********************************************/
    /**
     * Create local repository
     *
     * @throws {@link Err.CannotCreateDirectoryError}
     *
     * @throws # from putWorker
     * @throws - {@link Err.UndefinedDBError}
     * @throws - {@link Err.CannotCreateDirectoryError}
     * @throws - {@link Err.SameIdExistsError}
     * @throws - {@link Err.DocumentNotFoundError}
     * @throws - {@link Err.CannotWriteDataError}
  
     * @internal
     */
    private _createRepository;
    /***********************************************
     * Public methods
     ***********************************************/
    /**
     * Open or create a Git repository
     *
     * @remarks
     * - Create a new Git repository if a dbName specified in the constructor does not exist.
     *
     * - GitDocumentDB creates a legitimate Git repository and unique metadata under '.gitddb/'.
     *
     * - '.gitddb/' keeps {@link git-documentdb#DatabaseInfo} for combining databases, checking schema and migration.
     *
     * - GitDocumentDB can also load a Git repository that is created by other apps. It almost works; however, correct behavior is not guaranteed if it does not have a valid '.gitddb/'.
     *
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.RepositoryNotFoundError} may occurs when openOptions.createIfNotExists is false.
     *
     * @throws # Errors from _createRepository
     * @throws - {@link Err.CannotCreateDirectoryError}
     *
     * @throws # Errors from putWorker
     * @throws - {@link Err.UndefinedDBError}
     * @throws - {@link Err.CannotCreateDirectoryError}
     * @throws - {@link Err.SameIdExistsError}
     * @throws - {@link Err.DocumentNotFoundError}
     * @throws - {@link Err.CannotWriteDataError}
     *
     * @public
     */
    open(openOptions?: OpenOptions): Promise<DatabaseOpenResult>;
    /**
     * Close a database
     *
     * @remarks
     * - New CRUD operations are not available while closing.
     *
     * - Queued operations are executed before the database is closed unless it times out.
     *
     * @param options - The options specify how to close database.
     *
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.DatabaseCloseTimeoutError}
     *
     * @public
     */
    close(options?: DatabaseCloseOption): Promise<void>;
    /**
     * Destroy a database
     *
     * @remarks
     * - {@link GitDocumentDB.close} is called automatically before destroying.
     *
     * - Default value of options.force is true.
     *
     * - destroy() removes the Git repository and the working directory from the filesystem.
     *
     * - destroy() does not remove localDir (which is specified in constructor).
     *
     * @param options - The options specify how to close database.
     *
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.DatabaseCloseTimeoutError}
     * @throws {@link Err.FileRemoveTimeoutError}
     *
     * @public
     */
    destroy(options?: DatabaseCloseOption): Promise<{
        ok: true;
    }>;
    /**
     * Test if a database is opened
     *
     * @public
     */
    get isOpened(): boolean;
    /**
     * Get a collection
     *
     * @param collectionPath - relative path from localDir. Sub-directories are also permitted. e.g. 'pages', 'pages/works'.
     *
     * @remarks
     * - Notice that this function just read an existing directory. It does not make a new sub-directory.
     *
     * @returns A child collection of {@link git-documentdb#GitDocumentDB.rootCollection}
     *
     * @public
     */
    collection(collectionPath: CollectionPath, options?: CollectionOptions): Collection;
    /**
     * Get collections
     *
     * @param dirPath - Get collections directly under the dirPath. dirPath is a relative path from localDir. Default is ''.
     * @returns Promise\<Collection[]\>
     *
     * @public
     */
    getCollections(dirPath?: string): Promise<ICollection[]>;
    /**
     * getRemoteURLs
     *
     * @public
     */
    getRemoteURLs(): string[];
    /**
     * Get synchronizer
     *
     * @public
     */
    getSync(remoteURL: string): Sync;
    /**
     * Stop and unregister remote synchronization
     *
     * @public
     */
    removeSync(remoteURL: string): void;
    /**
     * Synchronize with a remote repository
     *
     * @remarks
     * Register and synchronize with a remote repository. Do not register the same remote repository again. Call unregisterRemote() before register it again.
     *
     * @throws {@link Err.RemoteAlreadyRegisteredError}
     *
     * @privateRemarks # from Sync#syncAndGetResultImpl
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.RepositoryNotOpenError}
     *
     * @throws Errors from constructor of {@link Sync} class.
     * @throws Errors from {@link Sync.init}
     *
     * @public
     */
    sync(options: RemoteOptions): Promise<Sync>;
    /**
     * Synchronize with a remote repository
     *
     * @remarks
     * Register and synchronize with a remote repository. Do not register the same remote repository again. Call unregisterRemote() before register it again.
     *
     * @throws {@link Err.RemoteAlreadyRegisteredError}
     *
     * @privateRemarks # from Sync#syncAndGetResultImpl
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.RepositoryNotOpenError}
     *
     * @throws Errors from constructor of {@link Sync} class.
     * @throws Errors from {@link Sync.init}
     *
     *
     * @public
     */
    sync(options: RemoteOptions, getSyncResult: boolean): Promise<[Sync, SyncResult]>;
    /**
     * Get a commit object
     *
     * @public
     */
    getCommit(oid: string): Promise<NormalizedCommit>;
    /**
     * Save current author to .git/config
     *
     * @remarks
     * Save GitDocumentDB#author. to user.name and user.email in .git/config
     *
     * @public
     */
    saveAuthor(): Promise<void>;
    /**
     * Load author from .git/config
     *
     * @remarks
     * Load user.name and user.email to GitDocumentDB#author.
     * If not defined in .git/config, do nothing.
     *
     * @public
     */
    loadAuthor(): Promise<void>;
    /**
     * Load DatabaseInfo from .gitddb/info.json
     *
     * @throws # Errors from putWorker
     * @throws - {@link Err.UndefinedDBError}
     * @throws - {@link Err.CannotCreateDirectoryError}
     * @throws - {@link Err.SameIdExistsError}
     * @throws - {@link Err.DocumentNotFoundError}
     * @throws - {@link Err.CannotWriteDataError}
     *
     * @internal
     */
    loadDbInfo(): Promise<void>;
    /***********************************************
     * Public method (Implementation of CRUDInterface)
     ***********************************************/
    /**
     * Insert a JSON document if not exists. Otherwise, update it.
     *
     * @param jsonDoc - JsonDoc whose _id is shortId. shortId is a file path whose collectionPath and extension are omitted.
     *
     * @remarks
     * - The saved file path is `${GitDocumentDB#workingDir}/${jsonDoc._id}${extension}` on the file system.
     *
     * - If _id is undefined, it is automatically generated.
     *
     * - This is an alias of GitDocumentDB#rootCollection.put()
     *
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @privateRemarks # Errors from putImpl
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.TaskCancelError}
     *
     * @throws # Errors from validateDocument, validateId
     * @throws - {@link Err.InvalidIdCharacterError}
     * @throws - {@link Err.InvalidIdLengthError}
     *
     * @throws # Errors from putWorker
     * @throws - {@link Err.UndefinedDBError}
     * @throws - {@link Err.CannotCreateDirectoryError}
     * @throws - {@link Err.CannotWriteDataError}
     *
     * @public
     */
    put(jsonDoc: JsonDoc, options?: PutOptions): Promise<PutResultJsonDoc>;
    /**
     * Insert a JSON document if not exists. Otherwise, update it.
     *
     * @param _id - _id is a file path whose extension is omitted.
     *
     * @remarks
     * - The saved file path is `${GitDocumentDB#workingDir}/${_id}${extension}` on the file system.
     *
     * - If _id is undefined, it is automatically generated.
     *
     * - _id property of a JsonDoc is automatically set or overwritten by _id parameter.
     *
     * - An update operation is not skipped even if no change occurred on a specified document.
     *
     * - This is an alias of GitDocumentDB#rootCollection.put()
     *
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @privateRemarks # Errors from putImpl
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.TaskCancelError}
     *
     * @throws # Errors from validateDocument, validateId
     * @throws - {@link Err.InvalidIdCharacterError}
     * @throws - {@link Err.InvalidIdLengthError}
     *
     * @throws # Errors from putWorker
     * @throws - {@link Err.UndefinedDBError}
     * @throws - {@link Err.CannotCreateDirectoryError}
     * @throws - {@link Err.CannotWriteDataError}
     *
     * @public
     */
    put(_id: string | undefined | null, jsonDoc: JsonDoc, options?: PutOptions): Promise<PutResultJsonDoc>;
    /**
     * Insert a JSON document
     *
     * @param jsonDoc - JsonDoc whose _id is shortId. shortId is a file path whose collectionPath and extension are omitted.
     *
     * @remarks
     * - Throws SameIdExistsError when a document that has the same _id exists. It might be better to use put() instead of insert().
     *
     * - If _id is undefined, it is automatically generated.
     *
     * - The saved file path is `${GitDocumentDB#workingDir}/${jsonDoc._id}${extension}` on the file system.
     *
     * - This is an alias of GitDocumentDB#rootCollection.insert()
     *
     * @param jsonDoc - See {@link JsonDoc} for restriction.
     *
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @privateRemarks # Errors from putImpl
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.TaskCancelError}
     *
     * @throws # Errors from validateDocument, validateId
     * @throws - {@link Err.InvalidIdCharacterError}
     * @throws - {@link Err.InvalidIdLengthError}
     *
     * @throws # Errors from putWorker
     * @throws - {@link Err.UndefinedDBError}
     * @throws - {@link Err.CannotCreateDirectoryError}
     * @throws - {@link Err.CannotWriteDataError}
     *
     * @throws - {@link Err.SameIdExistsError}
     *
     * @public
     */
    insert(jsonDoc: JsonDoc, options?: PutOptions): Promise<PutResultJsonDoc>;
    /**
     * Insert a JSON document
     *
     * @param _id - _id is a file path whose extension is omitted.
     *
     * @remarks
     * - Throws SameIdExistsError when a document that has the same id exists. It might be better to use put() instead of insert().
     *
     * - The saved file path is `${GitDocumentDB#workingDir}/${_id}${extension}` on the file system.
     *
     * - If _id is undefined, it is automatically generated.
     *
     * - _id property of a JsonDoc is automatically set or overwritten by _id parameter.
     *
     *  - This is an alias of GitDocumentDB#rootCollection.insert()
     *
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @privateRemarks # Errors from putImpl
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.TaskCancelError}
     *
     * @throws # Errors from validateDocument, validateId
     * @throws - {@link Err.InvalidIdCharacterError}
     * @throws - {@link Err.InvalidIdLengthError}
     *
     * @throws # Errors from putWorker
     * @throws - {@link Err.UndefinedDBError}
     * @throws - {@link Err.CannotCreateDirectoryError}
     * @throws - {@link Err.CannotWriteDataError}
     *
     * @throws - {@link Err.SameIdExistsError}
     *
     * @public
     */
    insert(_id: string | undefined | null, jsonDoc: JsonDoc, options?: PutOptions): Promise<PutResultJsonDoc>;
    /**
     * Update a JSON document
     *
     * @param jsonDoc - JsonDoc whose _id is shortId. shortId is a file path whose collectionPath and extension are omitted.
     *
     * @remarks
     * - Throws DocumentNotFoundError if a specified document does not exist. It might be better to use put() instead of update().
     *
     * - If _id is undefined, it is automatically generated.
     *
     * - The saved file path is `${GitDocumentDB#workingDir}/${_id}extension` on the file system.
     *
     * - This is an alias of GitDocumentDB#rootCollection.update()
     *
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @privateRemarks # Errors from putImpl
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.TaskCancelError}
     *
     * @throws # Errors from validateDocument, validateId
     * @throws - {@link Err.InvalidIdCharacterError}
     * @throws - {@link Err.InvalidIdLengthError}
     *
     * @throws # Errors from putWorker
     * @throws - {@link Err.UndefinedDBError}
     * @throws - {@link Err.CannotCreateDirectoryError}
     * @throws - {@link Err.CannotWriteDataError}
     *
     * @throws - {@link Err.DocumentNotFoundError}
     *
     * @public
     */
    update(jsonDoc: JsonDoc, options?: PutOptions): Promise<PutResultJsonDoc>;
    /**
     * Update a JSON document
     *
     * @param _id - _id is a file path whose extension is omitted.
     *
     * @remarks
     * - Throws DocumentNotFoundError if a specified document does not exist. It might be better to use put() instead of update().
     *
     * - The saved file path is `${GitDocumentDB#workingDir}/${_id}extension` on the file system.
     *
     * - An update operation is not skipped even if no change occurred on a specified document.
     *
     * - This is an alias of GitDocumentDB#rootCollection.update()
     *
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @privateRemarks # Errors from putImpl
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.TaskCancelError}
     *
     * @throws # Errors from validateDocument, validateId
     * @throws - {@link Err.InvalidIdCharacterError}
     * @throws - {@link Err.InvalidIdLengthError}
     *
     * @throws # Errors from putWorker
     * @throws - {@link Err.UndefinedDBError}
     * @throws - {@link Err.CannotCreateDirectoryError}
     * @throws - {@link Err.CannotWriteDataError}
     *
     * @throws - {@link Err.DocumentNotFoundError}
     *
     * @public
     */
    update(_id: string | undefined | null, jsonDoc: JsonDoc, options?: PutOptions): Promise<PutResultJsonDoc>;
    /**
     * Insert data if not exists. Otherwise, update it.
     *
     * @param name - name is a file path.
     *
     * @remarks
     * - The saved file path is `${GitDocumentDB#workingDir}/${name}extension`.
     *
     * - If a name parameter is undefined, it is automatically generated.
     *
     * - _id property of a JsonDoc is automatically set or overwritten by name parameter whose extension is removed.
     *
     * - An update operation is not skipped even if no change occurred on a specified data.
     *
     * - This is an alias of GitDocumentDB#rootCollection.putFatDoc()
     *
     * @throws {@link Err.InvalidJsonFileExtensionError}
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @privateRemarks # Errors from putImpl
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.TaskCancelError}
     *
     * @throws # Errors from validateDocument, validateId
     * @throws - {@link Err.InvalidIdCharacterError}
     * @throws - {@link Err.InvalidIdLengthError}
     *
     * @throws # Errors from putWorker
     * @throws - {@link Err.UndefinedDBError}
     * @throws - {@link Err.CannotCreateDirectoryError}
     * @throws - {@link Err.CannotWriteDataError}
     *
     * @public
     */
    putFatDoc(name: string | undefined | null, doc: JsonDoc | Uint8Array | string, options?: PutOptions): Promise<PutResult>;
    /**
     * Insert a data
     *
     * @param name - name is a file path.
     *
     * @remarks
     * - Throws SameIdExistsError when data that has the same _id exists. It might be better to use put() instead of insert().
     *
     * - The saved file path is `${GitDocumentDB#workingDir}/${name}extension`.
     *
     * - If a name parameter is undefined, it is automatically generated.
     *
     * - _id property of a JsonDoc is automatically set or overwritten by name parameter whose extension is omitted.
     *
     * - This is an alias of GitDocumentDB#rootCollection.insertFatDoc()
     *
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @privateRemarks # Errors from putImpl
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.TaskCancelError}
     *
     * @throws # Errors from validateDocument, validateId
     * @throws - {@link Err.InvalidIdCharacterError}
     * @throws - {@link Err.InvalidIdLengthError}
     *
     * @throws # Errors from putWorker
     * @throws - {@link Err.UndefinedDBError}
     * @throws - {@link Err.CannotCreateDirectoryError}
     * @throws - {@link Err.CannotWriteDataError}
     *
     * @throws - {@link Err.SameIdExistsError}
     *
     * @public
     */
    insertFatDoc(name: string | undefined | null, doc: JsonDoc | string | Uint8Array, options?: PutOptions): Promise<PutResult>;
    /**
     * Update a data
     *
     * @param name - name is a file path.
     *
     * @remarks
     * - Throws DocumentNotFoundError if a specified data does not exist. It might be better to use put() instead of update().
     *
     * - The saved file path is `${GitDocumentDB#workingDir}/${name}extension`.
     *
     * - _id property of a JsonDoc is automatically set or overwritten by name parameter whose extension is omitted.
     *
     * - An update operation is not skipped even if no change occurred on a specified data.
     *
     * - This is an alias of GitDocumentDB#rootCollection.updateFatDoc()
     *
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @privateRemarks # Errors from putImpl
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.TaskCancelError}
     *
     * @throws # Errors from validateDocument, validateId
     * @throws - {@link Err.InvalidIdCharacterError}
     * @throws - {@link Err.InvalidIdLengthError}
     *
     * @throws # Errors from putWorker
     * @throws - {@link Err.UndefinedDBError}
     * @throws - {@link Err.CannotCreateDirectoryError}
     * @throws - {@link Err.CannotWriteDataError}
     *
     * @throws - {@link Err.DocumentNotFoundError}
     *
     * @public
     */
    updateFatDoc(name: string | undefined | null, doc: JsonDoc | string | Uint8Array, options?: PutOptions): Promise<PutResult>;
    /**
     * Get a JSON document
     *
     * @param _id - _id is a file path whose extension is omitted.
     *
     * @returns
     * - undefined if a specified document does not exist.
     *
     * - JsonDoc may not have _id property when an app other than GitDocumentDB creates it.
     *
     * - This is an alias of GitDocumentDB#rootCollection.get()
     *
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @public
     */
    get(_id: string): Promise<JsonDoc | undefined>;
    /**
     * Get a FatDoc data
     *
     * @param name - name is a file path.
     *
     * @returns
     *  - undefined if a specified data does not exist.
     *
     *  - FatJsonDoc if the file extension is SerializeFormat.extension. Be careful that JsonDoc may not have _id property when an app other than GitDocumentDB creates it.
     *
     *  - FatBinaryDoc if described in .gitattribtues, otherwise FatTextDoc.
     *
     *  - getOptions.forceDocType always overwrite return type.
     *
     *  - This is an alias of GitDocumentDB#rootCollection.getFatDoc()
     *
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @public
     */
    getFatDoc(name: string, getOptions?: GetOptions): Promise<FatDoc | undefined>;
    /**
     * Get a Doc which has specified oid
     *
     * @param fileOid - Object ID (SHA-1 hash) that represents a Git object. (See https://git-scm.com/docs/git-hash-object )
     *
     * @remarks
     * - undefined if a specified oid does not exist.
     *
     *  - This is an alias of GitDocumentDB#rootCollection.getDocByOid()
     *
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @public
     */
    getDocByOid(fileOid: string, docType?: DocType): Promise<Doc | undefined>;
    /**
     * Get an old revision of a document
     *
     * @param _id - _id is a file path whose extension is omitted.
     * @param revision - Specify a number to go back to old revision. Default is 0.
     * See {@link git-documentdb#GitDocumentDB.getHistory} for the array of revisions.
     * @param historyOptions - The array of revisions is filtered by HistoryOptions.filter.
     *
     * @remarks
     *  - undefined if a specified document does not exist or it is deleted.
     *
     *  - This is an alias of GitDocumentDB#rootCollection.getOldRevision()
     *
     * @example
     * ```
     * db.getOldRevision(_id, 0); // returns the latest document.
     * db.getOldRevision(_id, 2); // returns a document two revisions older than the latest.
     * ```
     *
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @public
     */
    getOldRevision(_id: string, revision: number, historyOptions?: HistoryOptions): Promise<JsonDoc | undefined>;
    /**
     * Get an old revision of a FatDoc data
     *
     * @param name - name is a file path.
     * @param revision - Specify a number to go back to old revision. Default is 0.
     * See {@link git-documentdb#GitDocumentDB.getHistory} for the array of revisions.
     * @param historyOptions - The array of revisions is filtered by HistoryOptions.filter.
     *
     * @remarks
     *  - undefined if a specified data does not exist or it is deleted.
     *
     *  - JsonDoc if the file extension is SerializeFormat.extension.  Be careful that JsonDoc may not have _id property when an app other than GitDocumentDB creates it.
     *
     *  - FatBinaryDoc if described in .gitattribtues, otherwise FatTextDoc.
     *
     *  - getOptions.forceDocType always overwrite return type.
     *
     *  - This is an alias of GitDocumentDB#rootCollection.getFatDocOldRevision()
     *
     * @example
     * ```
     * db.getFatDocOldRevision(name, 0); // returns the latest FatDoc.
     * db.getFatDocOldRevision(name, 2); // returns a FatDoc two revisions older than the latest.
     * ```
     *
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @public
     */
    getFatDocOldRevision(name: string, revision: number, historyOptions?: HistoryOptions, getOptions?: GetOptions): Promise<FatDoc | undefined>;
    /**
     * Get revision history of a document
     *
     * @param _id - _id is a file path whose extension is omitted.
     * @param historyOptions - The array of revisions is filtered by HistoryOptions.filter.
     *
     * @remarks
     * - By default, revisions are sorted by reverse chronological order. However, keep in mind that Git dates may not be consistent across repositories.
     *
     * - This is an alias of GitDocumentDB.rootCollection.getHistory().
     *
     * @returns Array of FatDoc or undefined.
     *  - undefined if a specified document does not exist or it is deleted.
     *
     *  - JsonDoc if isJsonDocCollection is true or the file extension is SerializeFormat.extension.
     *
     *  - Uint8Array or string if isJsonDocCollection is false.
     *
     *  - getOptions.forceDocType always overwrite return type.
     *
     * @example
     * ```
     * Commit-01 to 08 were committed in order. file_v1 and file_v2 are two revisions of a file.
     *
     * - Commit-08: Not exists
     * - Commit-07: deleted
     * - Commit-06: file_v2
     * - Commit-05: deleted
     * - Commit-04: file_v2
     * - Commit-03: file_v1
     * - Commit-02: file_v1
     * - Commit-01: Not exists
     *
     * Commit-02 newly inserted a file (file_v1).
     * Commit-03 did not change about the file.
     * Commit-04 updated the file from file_v1 to file_v2.
     * Commit-05 deleted the file.
     * Commit-06 inserted the deleted file (file_v2) again.
     * Commit-07 deleted the file again.
     * Commit-08 did not change about the file.
     *
     * Here, getHistory() will return [undefined, file_v2, undefined, file_v2, file_v1] as a history.
     *
     * NOTE:
     * - Consecutive same values (commit-02 and commit-03) are combined into one.
     * - getHistory() ignores commit-01 because it was committed before the first insert.
     * Thus, a history is not [undefined, undefined, file_v2, undefined, file_v2, file_v1, file_v1, undefined].
     * ```
     *
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @public
     */
    getHistory(_id: string, historyOptions?: HistoryOptions): Promise<(JsonDoc | undefined)[]>;
    /**
     * Get revision history of a FatDoc data
     *
     * @param name - name is a file path.
     *
     * @remarks
     *  - This is an alias of GitDocumentDB#rootCollection.getFatDocHistory()
     *
     *  - See {@link git-documentdb#GitDocumentDB.getHistory} for detailed examples.
     *
     * @returns Array of FatDoc or undefined.
     *  - undefined if a specified data does not exist or it is deleted.
     *
     *  - Array of FatJsonDoc if isJsonDocCollection is true or the file extension is SerializeFormat.extension. Be careful that JsonDoc may not have _id property when an app other than GitDocumentDB creates it.
     *
     *  - Array of FatBinaryDoc if described in .gitattribtues, otherwise array of FatTextDoc.
     *
     *  - getOptions.forceDocType always overwrite return type.
     *
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @public
     */
    getFatDocHistory(name: string, historyOptions?: HistoryOptions, getOptions?: GetOptions): Promise<(FatDoc | undefined)[]>;
    /**
     * Delete a JSON document
     *
     * @param _id - _id is a file path whose extension is omitted.
     *
     * @remarks
     *  - This is an alias of GitDocumentDB#rootCollection.delete()
     *
     * @throws {@link Err.UndefinedDocumentIdError}
     *
     * @privateRemarks # Errors from deleteImpl
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.TaskCancelError}
     *
     * @throws # Errors from deleteWorker
     * @throws - {@link Err.UndefinedDBError}
     * @throws - {@link Err.DocumentNotFoundError}
     * @throws - {@link Err.CannotDeleteDataError}
     *
     * @public
     */
    delete(_id: string, options?: DeleteOptions): Promise<DeleteResultJsonDoc>;
    /**
     * Delete a document by _id property in JsonDoc
     *
     * @param jsonDoc - Only the _id property of the JsonDoc is referenced. _id is a file path whose extension is omitted.
     *
     * @remarks
     *  - This is an alias of GitDocumentDB#rootCollection.delete()
     *
     * @throws {@link Err.UndefinedDocumentIdError}
     *
     * @privateRemarks # Errors from deleteImpl
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.TaskCancelError}
     *
     * @throws # Errors from deleteWorker
     * @throws - {@link Err.UndefinedDBError}
     * @throws - {@link Err.DocumentNotFoundError}
     * @throws - {@link Err.CannotDeleteDataError}
     *
     * @public
     */
    delete(jsonDoc: JsonDoc, options?: DeleteOptions): Promise<DeleteResultJsonDoc>;
    /**
     * Delete a data
     *
     * @param name - name is a file path
     *
     * @remarks
     *  - This is an alias of GitDocumentDB#rootCollection.deleteFatDoc()
     *
     * @throws {@link Err.UndefinedDocumentIdError}
     *
     * @privateRemarks # Errors from deleteImpl
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.TaskCancelError}
     *
     * @throws # Errors from deleteWorker
     * @throws - {@link Err.UndefinedDBError}
     * @throws - {@link Err.DocumentNotFoundError}
     * @throws - {@link Err.CannotDeleteDataError}
     *
     * @public
     */
    deleteFatDoc(name: string, options?: DeleteOptions): Promise<DeleteResult>;
    /**
     * Get all the JSON documents
     *
     * @remarks
     *  - This is an alias of GitDocumentDB#rootCollection.find()
     *
     * @param options - The options specify how to get documents.
     *
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @public
     */
    find(options?: FindOptions): Promise<JsonDoc[]>;
    /**
     * Get all the FatDoc data
     *
     * @param options - The options specify how to get documents.
     *
     * @remarks
     *  - This is an alias of GitDocumentDB#rootCollection.findFatDoc()
     *
     * @throws {@link Err.DatabaseClosingError}
     * @throws {@link Err.InvalidJsonObjectError}
     *
     * @public
     */
    findFatDoc(options?: FindOptions): Promise<FatDoc[]>;
    /***********************************************
     * Public method (Implementation of SyncEventInterface)
     ***********************************************/
    /**
     * Add SyncEvent handler
     *
     * @eventProperty
     * @public
     */
    onSyncEvent(remoteURL: string, event: SyncEvent, callback: SyncCallback): SyncInterface;
    /**
     * Add SyncEvent handler
     *
     * @eventProperty
     * @public
     */
    onSyncEvent(sync: SyncInterface, event: SyncEvent, callback: SyncCallback): SyncInterface;
    /**
     * Remove SyncEvent handler
     *
     * @eventProperty
     * @public
     */
    offSyncEvent(remoteURL: string, event: SyncEvent, callback: SyncCallback): void;
    /**
     * Remove SyncEvent handler
     *
     * @eventProperty
     * @public
     */
    offSyncEvent(sync: SyncInterface, event: SyncEvent, callback: SyncCallback): void;
}
//# sourceMappingURL=git_documentdb.d.ts.map