UNPKG

@gati-framework/runtime

Version:

Gati runtime execution engine for running handler-based applications

98 lines 2.54 kB
export interface DiffOperation { op: 'add' | 'remove' | 'replace'; path: string; value?: unknown; oldValue?: unknown; } export type ChangeType = 'breaking' | 'non-breaking'; export interface SchemaChange { type: ChangeType; operation: 'add' | 'remove' | 'modify'; path: string; description: string; oldValue?: unknown; newValue?: unknown; } export interface SchemaDiff { breaking: SchemaChange[]; nonBreaking: SchemaChange[]; requiresTransformer: boolean; summary: string; hash: string; } export interface HandlerSchema { request?: { params?: Record<string, FieldSchema>; query?: Record<string, FieldSchema>; body?: Record<string, FieldSchema>; headers?: Record<string, FieldSchema>; }; response?: { status?: number; body?: Record<string, FieldSchema>; headers?: Record<string, FieldSchema>; }; } export interface FieldSchema { type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'null' | 'undefined'; required?: boolean; nullable?: boolean; items?: FieldSchema; properties?: Record<string, FieldSchema>; enum?: unknown[]; default?: unknown; } export declare class DiffEngine { private diffCache; private readonly maxCacheSize; /** * Compare two handler schemas and detect breaking changes */ diffSchemas(oldSchema: HandlerSchema, newSchema: HandlerSchema): SchemaDiff; /** * Compare request schemas */ private compareRequest; /** * Compare response schemas */ private compareResponse; /** * Compare field schemas */ private compareFields; /** * Compare individual field schemas */ private compareField; /** * Generate human-readable summary */ private generateSummary; /** * Calculates the structural difference between two objects. * Returns a list of operations to transform obj1 into obj2. */ diff(obj1: unknown, obj2: unknown, path?: string): DiffOperation[]; /** * Calculates a content hash for an object or string. * Useful for detecting if a module's code has changed. */ hash(content: unknown): string; /** * Cache a diff result */ private cacheDiff; /** * Clear diff cache */ clearCache(): void; /** * Get cache statistics */ getCacheStats(): { size: number; maxSize: number; }; } //# sourceMappingURL=diff-engine.d.ts.map