const s="error";class o{#e=new Set;#t;#i;#s=0;#a=0;#n=new Set;#o=new Set;#r=new Map;resetForRun(){this.#e.clear(),this.#t=void 0,this.#i=void 0,this.#s=0,this.#a=0,this.#n.clear(),this.#o.clear(),this.#r.clear()}addExtractor(e){this.#e.add(e)}increaseSkippedFilesCount(){this.#s++}increaseProcessedFilesCount(){this.#a++}markSourceFileAsChanged(e){this.#n.add(e)}markSourceFileAsRemoved(e){this.#o.add(e)}getPublishDelta(){return{changedSourceFiles:Array.from(this.#n),removedSourceFiles:Array.from(this.#o)}}markFileHashPendingConfirmation(e){const t=`${e.fileType}::${e.filePath}`;this.#r.set(t,e)}getFileHashConfirmations(){return Array.from(this.#r.values())}async getCatalogEntitiesData(e){this.#t=this.#l(e),this.#i=this.#u(e);const[t,i]=await Promise.allSettled([this.#t,this.#i]);return{totalEntitiesCount:t.status==="fulfilled"?t.value:s,countOfEntitiesByType:i.status==="fulfilled"?i.value:s,extractors:Array.from(this.#e),totalFilesSkippedByHash:this.#s,totalProcessedFiles:this.#a}}async#l(e){return(await e.getEntities({paginationParams:{limit:1,filter:{field:"is_deleted",operator:"equal",value:!1}}})).page.total}async#u(e){return(await e.getEntitiesCountByTypes()).reduce((i,{type:a,count:n})=>(i[a]=n,i),{})}}const l=new o;export{o as CatalogDataCollector,l as catalogDataCollector};
