UNPKG

@memory-bank/mcp

Version:

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

74 lines 3.77 kB
import { JsonDocumentRepository } from '../../../domain/repositories/JsonDocumentRepository.js'; import { JsonPatchOperation } from '../../../domain/jsonpatch/JsonPatchOperation.js'; import { JsonPatchService } from '../../../domain/jsonpatch/JsonPatchService.js'; import { JsonDocument } from '../../../domain/entities/JsonDocument.js'; import { DocumentEventEmitter } from '../../../domain/events/DocumentEventEmitter.js'; /** * Use case for partially updating a document using JSON Patch */ export declare class JsonPatchUseCase { private readonly repository; private readonly patchService; private readonly eventEmitter; /** * Constructor * @param repository JSON document repository * @param eventEmitter Document event emitter * @param patchService JsonPatchService (uses Rfc6902JsonPatchAdapter if omitted) */ constructor(repository: JsonDocumentRepository, eventEmitter: DocumentEventEmitter, patchService?: JsonPatchService); /** * Apply patch operations to a document * @param path Document path * @param operations Array of patch operations to apply * @param branch Branch name (uses branch memory bank if specified, global otherwise) * @param updateReason Reason for the update (optional) * @returns Updated JSON document * @throws DomainError if document not found, operation invalid, or other errors */ execute(path: string, operations: JsonPatchOperation[], branch?: string, updateReason?: string): Promise<JsonDocument>; /** * Apply multiple patch operations atomically * @param path Document path * @param operations Array of patch operations to apply * @param branch Branch name (uses branch memory bank if specified, global otherwise) * @param updateReason Reason for the update (optional) * @returns Updated JSON document * @throws DomainError if document not found, operation invalid, or other errors */ executeBatch(path: string, operations: JsonPatchOperation[], branch?: string, updateReason?: string): Promise<JsonDocument>; /** * Generate patch operations representing the difference between two documents * @param sourcePath Path of the source document * @param targetPath Path of the target document * @param sourceBranch Branch of the source document (optional) * @param targetBranch Branch of the target document (optional) * @returns Array of generated patch operations * @throws DomainError if documents are not found */ generatePatch(sourcePath: string, targetPath: string, sourceBranch?: string, targetBranch?: string): Promise<JsonPatchOperation[]>; /** * Apply patch operations after verifying test conditions * @param path Document path * @param operations Array including test and update operations * @param branch Branch name (uses branch memory bank if specified, global otherwise) * @param updateReason Reason for the update (optional) * @returns Updated JSON document * @throws DomainError if document not found, test fails, operation invalid, or other errors */ executeConditional(path: string, operations: JsonPatchOperation[], branch?: string, updateReason?: string): Promise<JsonDocument>; /** * Get a document (uses appropriate repository method based on branch presence) * @param path Document path * @param branch Branch name (optional) * @returns JSON document or null if not found */ private getDocument; /** * Save a document (uses appropriate repository method based on branch presence) * @param document Document to save * @returns Saved document */ private saveDocument; } //# sourceMappingURL=JsonPatchUseCase.d.ts.map