git-goose
Version:
a mongoose plugin that enables git like change tracking
30 lines (29 loc) • 1.3 kB
TypeScript
import { HydratedDocument } from 'mongoose';
import { Commit, CommittableDocument, Nullable, Patch, PatcherName, RefId } from '../types';
import { GitBase } from './base';
import { GitFromDocument } from './from_document';
import { GitFromRefId } from './from_refId';
/**
* Git manager with the knowledge of its target referenceId, enabling contextually aware operations
*
* @template TargetDocType - The type of the document to be generated
* @template TPatcherName - The inferred name of the patcher to use (used for type hinting patches)
*/
export declare class GitDetached<TargetDocType, TPatcherName extends PatcherName> extends GitBase<TargetDocType, TPatcherName> {
checkout(): Promise<Nullable<HydratedDocument<TargetDocType>>>;
diff(): Promise<Patch<TPatcherName>>;
log(): Promise<Commit[]>;
/**
* Create a new Git context with reference to the provided reference id
*
* @param refId - The reference object id
*/
withRefId(refId: RefId): GitFromRefId<TargetDocType, TPatcherName>;
/**
* Create a new Git context with reference to the provided reference id
*
* @param doc - The reference object
*/
withDocument<T>(doc: CommittableDocument<T>): GitFromDocument<T, TPatcherName>;
protected commit(): Promise<void>;
}