UNPKG

@memory-bank/mcp

Version:

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

52 lines 2.29 kB
import { JsonPatchOperation } from './JsonPatchOperation.js'; import { JsonPatchService } from './JsonPatchService.js'; /** * Adapter class for integrating with the rfc6902 library. * Implements the JsonPatchService interface. */ export declare class Rfc6902JsonPatchAdapter implements JsonPatchService { private readonly componentLogger; /** * Apply patch operations to a document using rfc6902. * @param document Target document (will be cloned to ensure immutability). * @param operations Array of operations to apply (JsonPatchOperation format). * @returns New document after applying operations. * @throws DomainError if an error occurs during operation application. */ apply(document: any, operations: JsonPatchOperation[]): any; /** * Validate patch operations against a document. * Note: rfc6902 doesn't provide a direct validation function, so we apply the patch to a clone * and check if any errors are returned. * @param document Target document. * @param operations Array of operations to validate (JsonPatchOperation format). * @returns true if no errors are returned from applyPatch, false otherwise. */ validate(document: any, operations: JsonPatchOperation[]): boolean; /** * Generate patch operations (diff) between two documents. * @param source Source document. * @param target Target document. * @returns Array of JsonPatchOperation representing the diff. */ generatePatch(source: any, target: any): JsonPatchOperation[]; /** * Converts internal JsonPatchOperation format to rfc6902 format. * @param operations Array of JsonPatchOperation. * @returns Array of operations in rfc6902 format. */ private convertOperationsToRfc6902; /** * Converts rfc6902 operation format back to internal JsonPatchOperation format. * @param rfcOp Operation in rfc6902 format. * @returns New JsonPatchOperation instance. */ private convertFromRfc6902Operation; /** * Convert library error to domain-specific error. * @param error Error that occurred. * @throws DomainError Converted domain error. */ private handleLibraryError; } //# sourceMappingURL=Rfc6902JsonPatchAdapter.d.ts.map