UNPKG

@memory-bank/mcp

Version:

Memory-enabled Co-Pilot (MCP) server for managing project documentation and context

99 lines 4.27 kB
import { BranchInfo } from "../../../domain/entities/BranchInfo.js"; import { DocumentId } from "../../../domain/entities/DocumentId.js"; import { DocumentPath } from "../../../domain/entities/DocumentPath.js"; import { JsonDocument, DocumentType } from "../../../domain/entities/JsonDocument.js"; import type { Tag } from "../../../domain/entities/Tag.js"; import { IJsonDocumentRepository } from "../../../domain/repositories/IJsonDocumentRepository.js"; import type { IIndexService } from "../../index/interfaces/IIndexService.js"; import type { IFileSystemService } from "../../storage/interfaces/IFileSystemService.js"; /** * File system implementation of the JSON document repository * Stores JSON documents as files in a directory structure */ export declare class FileSystemJsonDocumentRepository implements IJsonDocumentRepository { private readonly fileSystemService; private readonly indexService; private readonly rootPath; /** * Create a new FileSystemJsonDocumentRepository * @param fileSystemService File system service for file operations * @param indexService Document index service for efficient lookups * @param rootPath Root path for storing documents */ constructor(fileSystemService: IFileSystemService, indexService: IIndexService, rootPath: string); /** * Get the absolute file path for a document * @param branchInfo Branch information * @param documentPath Document path * @returns Absolute file path */ private getAbsoluteFilePath; /** * Get the directory path for a branch * @param branchInfo Branch information * @returns Absolute directory path */ private getBranchDirectoryPath; /** * Find a document by its ID * @param id Document ID * @returns Promise resolving to the document if found, or null if not found */ findById(id: DocumentId): Promise<JsonDocument | null>; /** * Find a document by its path * @param branchInfo Branch information * @param path Document path * @returns Promise resolving to the document if found, or null if not found */ findByPath(branchInfo: BranchInfo, path: DocumentPath): Promise<JsonDocument | null>; /** * Find documents by tags * @param branchInfo Branch information * @param tags Tags to search for * @param matchAll If true, documents must have all tags; if false, any tag is sufficient * @returns Promise resolving to array of matching documents */ findByTags(branchInfo: BranchInfo, tags: Tag[], matchAll?: boolean): Promise<JsonDocument[]>; /** * Find documents by document type * @param branchInfo Branch information * @param documentType Document type to search for * @returns Promise resolving to array of matching documents */ findByType(branchInfo: BranchInfo, documentType: DocumentType): Promise<JsonDocument[]>; /** * Save a document * @param branchInfo Branch information * @param document Document to save * @returns Promise resolving to the saved document */ save(branchInfo: BranchInfo, document: JsonDocument): Promise<JsonDocument>; /** * Delete a document * @param branchInfo Branch information * @param document Document to delete (or document ID or path) * @returns Promise resolving to boolean indicating success */ delete(branchInfo: BranchInfo, document: JsonDocument | DocumentId | DocumentPath): Promise<boolean>; /** * List all documents * @param branchInfo Branch information * @returns Promise resolving to array of all documents */ listAll(branchInfo: BranchInfo): Promise<JsonDocument[]>; /** * List all documents by scanning the file system * @param branchInfo Branch information * @returns Promise resolving to array of all documents */ private listAllFromFileSystem; /** * Check if a document exists by path * @param branchInfo Branch information * @param path Document path * @returns Promise resolving to boolean indicating existence */ exists(branchInfo: BranchInfo, path: DocumentPath): Promise<boolean>; } //# sourceMappingURL=FileSystemJsonDocumentRepository.d.ts.map