UNPKG

@memory-bank/mcp

Version:

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

70 lines 2.25 kB
import { Operation as Rfc6902Operation } from 'rfc6902'; import { JsonPath } from './JsonPath.js'; export type JsonPatchOperationType = 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test'; /** * Class encapsulating a JSON Patch operation * Implementation of JSON Patch operations compliant with RFC 6902 */ export declare class JsonPatchOperation { private readonly _op; private readonly _path; private readonly _value?; private readonly _from?; /** * Constructor - Do not use directly, use the static factory method instead */ private constructor(); /** * Create a patch operation object * @param op Operation type * @param path Target path * @param value Value to set (required for add/replace/test) * @param from Source path (required for move/copy) * @returns New JsonPatchOperation instance * @throws DomainError if operation type is invalid or required parameters are missing */ static create(op: JsonPatchOperationType, path: string, value?: any, from?: string): JsonPatchOperation; /** * Create a patch operation object from a JSON representation * @param json JSON string or already parsed object * @returns New JsonPatchOperation instance */ static fromJSON(json: string | any): JsonPatchOperation; /** * Get the operation type */ get op(): JsonPatchOperationType; /** * Get the target path */ get path(): JsonPath; /** * Get the value */ get value(): any; /** * Get the source path */ get from(): JsonPath | undefined; /** * Validate the operation's validity * @throws DomainError if the operation is invalid */ validate(): void; /** * Convert to JSON representation * @returns JSON-serializable object */ toJSON(): any; /** * Convert to rfc6902 format operation object * @returns rfc6902 compatible object */ toRfc6902Operation(): Rfc6902Operation; /** * @deprecated Use toRfc6902Operation instead * Legacy adapter method - kept for compatibility with existing code */ toFastJsonPatchOperation(): any; } //# sourceMappingURL=JsonPatchOperation.d.ts.map