@memory-bank/mcp
Version:
Memory-enabled Co-Pilot (MCP) server for managing project documentation and context
61 lines • 1.71 kB
TypeScript
/**
* Utilities and safety measures for JSON Patch (RFC 6902) operations
*/
export interface JsonPatchOperation {
op: 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test';
path: string;
value?: any;
from?: string;
}
/**
* Generate JSON Patch property definitions, including clear warnings and validation rules
*/
export declare function createEnhancedPatchProperties(): {
patches: {
type: string;
description: string;
items: {
type: string;
properties: {
op: {
type: string;
enum: string[];
description: string;
};
path: {
type: string;
description: string;
};
value: {
description: string;
};
from: {
type: string;
description: string;
};
};
required: string[];
};
warnings: string[];
};
content: {
type: string;
description: string;
};
};
/**
* Function to perform strict validation of JSON Patch
* Use this within tool handlers to validate before applying patches
*/
export declare function validateJsonPatch(operations: JsonPatchOperation[]): {
valid: boolean;
errors: string[];
};
/**
* Helper function to safely apply JSON Patch
* - Handles path escaping
* - Optimizes operation order
* - Checks for potential issues
*/
export declare function sanitizeJsonPatch(operations: JsonPatchOperation[]): JsonPatchOperation[];
//# sourceMappingURL=patch-utils.d.ts.map