///
import { ProjectFileSystem, FileSystemWatchManager, ProjectEntityReader } from '@sap/artifact-management-base-types';
import { EventEmitter } from 'events';
declare type LoadResult = {
data: T | undefined;
watchPatterns: string[];
watchContent: string[];
} | undefined;
declare type LoadData = () => Promise>;
export default class ProjectEntityInstance extends EventEmitter {
protected readonly watchManager: FileSystemWatchManager;
protected fs: ProjectFileSystem;
private loaded;
private children;
readData?: () => Promise;
private data?;
protected _type?: string;
private observers;
private staleData;
tags: string[];
constructor(watchManager: FileSystemWatchManager, fs: ProjectFileSystem);
/**
* Get child data of an entity
*
* The "load" function is called to receive the data. The resulting data will be cached.
* As there can be multiple children, they need to be distinguished by "name" which is used as cache key.
*
* Call "unloadChildren()" to clear the cache. The method "load" will be called again with the next call
* of "getChildCache()".
*
*/
protected getChildCached({ name, load, extraKey }: {
name: string;
load: () => Promise;
extraKey?: string;
}): Promise;
/**
* Get data of an entity
*
* The "load" function is called to receive the data. The resulting data will be cached.
*
* The "onDataChanged" function is called when the data is changed compared to a previous call. It can
* be used to invalidate depending data, e.g. children by calling "unloadChildren()".
*
* Call "unloadData()" to clear the cache. The method "load" will be called again with the next call
* of "getDataCached()"
*
* An instance must have only one method where "getDataCached()" is called otherwise a call will
* return the previously cached value of a different one.
*
*/
protected getDataCached({ load, onDataChanged }: {
load: LoadData;
onDataChanged?: (newData: T, oldData: T) => void;
}): Promise;
registerWatchPatterns(patterns: string[], watchConent: any[], callback?: (event: string, file: string) => void): Promise;
flagModuleDirty(path: string): Promise;
unRegisterWatchPatterns(): void;
loadByReader(reader: ProjectEntityReader, context?: any): Promise>;
loadByReaders(readers: ProjectEntityReader[], deepSearch?: boolean, context?: any): Promise>;
invalidate(): Promise;
unload(): void;
destroy(): void;
unloadChildren(): void;
getMatchedFiles(pattern: string, isModuleReader: boolean): Promise;
}
export {};