import { Mutex } from 'async-mutex'; import { LaneId } from '@teambit/lane-id'; import type BitObject from './object'; import type Ref from './ref'; export interface IndexItem { hash: string; toIdentifierString(): string; } export declare class ComponentItem implements IndexItem { id: { scope: string | null; name: string; }; isSymlink: boolean; hash: string; constructor(id: { scope: string | null; name: string; }, isSymlink: boolean, hash: string); toIdentifierString(): string; } export declare class LaneItem implements IndexItem { id: { scope: string; name: string; }; hash: string; constructor(id: { scope: string; name: string; }, hash: string); toIdentifierString(): string; toLaneId(): LaneId; } export declare enum IndexType { components = "components", lanes = "lanes" } type Index = { [IndexType.components]: ComponentItem[]; [IndexType.lanes]: LaneItem[]; }; export declare class ScopeIndex { indexPath: string; index: Index; _writeIndexMutex?: Mutex; constructor(indexPath: string, index?: Index); get writeIndexMutex(): Mutex; static load(basePath: string): Promise; static create(basePath: string): ScopeIndex; static reset(basePath: string): Promise; write(): Promise; getAll(): IndexItem[]; getHashes(indexType: IndexType): string[]; getHashesByQuery(indexType: IndexType, filter: Function): string[]; getHashesIncludeSymlinks(): string[]; addMany(bitObjects: BitObject[]): boolean; addOne(bitObject: BitObject): boolean; removeMany(refs: Ref[]): boolean; removeOne(hash: string): boolean; deleteFile(): Promise; getPath(): string; /** * it's obviously not accurate. a local path might include 'bithub' as part of the path as well. * however, it's needed only for suppressing the error message when the indexJson is outdate, * so if it happens on a local scope it's okay. * for other purposes, don't rely on this. */ isFileOnBitHub(): boolean; find(hash: string): IndexItem | null; _exist(hash: string): boolean; static _composePath(basePath: string): string; } export {};