@tryloop/oats
Version:
🌾 OATS - OpenAPI TypeScript Sync. The missing link between your OpenAPI specs and TypeScript applications. Automatically watch, generate, and sync TypeScript clients from your API definitions.
96 lines • 2.23 kB
TypeScript
/**
* OATS Development Sync Engine
*
* Optimized file watching and synchronization system
*
* @module @oatsjs/core/dev-sync-optimized
*/
/// <reference types="node" />
import { EventEmitter } from 'events';
import type { RuntimeConfig } from '../types/config.types.js';
export interface SyncEvent {
type: 'spec-changed' | 'generation-started' | 'generation-completed' | 'generation-failed';
timestamp: Date;
file?: string;
changes?: string[];
error?: Error;
}
/**
* Development synchronization engine
*/
export declare class DevSyncEngine extends EventEmitter {
private config;
private watcher?;
private changeDetector;
private debouncedSync;
private isRunning;
private lastSyncTime?;
private syncLock;
private syncRetries;
private readonly MAX_SYNC_RETRIES;
private pollingInterval?;
private lastGeneratedSpecHash?;
private logger;
constructor(config: RuntimeConfig);
/**
* Start watching for changes
*/
start(): Promise<void>;
/**
* Stop watching for changes
*/
stop(): Promise<void>;
/**
* Get current sync status
*/
getStatus(): {
isRunning: boolean;
lastSyncTime?: Date;
watchedPaths: string[];
};
/**
* Handle file change events
*/
private handleFileChange;
/**
* Handle watch errors
*/
private handleWatchError;
/**
* Perform synchronization
*/
private performSync;
/**
* Check for meaningful changes in API spec
*/
private checkForMeaningfulChanges;
/**
* Generate TypeScript client
*/
private generateClient;
/**
* Build client package
*/
private buildClient;
/**
* Update client package.json with OATS metadata
*/
private updateClientVersionMetadata;
/**
* Link packages for local development
*/
private linkPackages;
/**
* Run a shell command
*/
private runCommand;
/**
* Get paths to watch for changes
*/
private getWatchPaths;
/**
* Check if file is relevant for synchronization
*/
private isRelevantFile;
}
//# sourceMappingURL=dev-sync-optimized.d.ts.map