@verdaccio/local-storage
Version:
Local storage implementation
59 lines (58 loc) • 1.89 kB
TypeScript
import { Callback, Config, Logger } from '@verdaccio/types';
import { searchUtils } from '@verdaccio/core';
import { LocalStorage } from './utils';
import LocalDriver from './local-fs';
import TokenActions from './token';
declare class LocalDatabase extends TokenActions {
path: string;
logger: Logger;
data: LocalStorage;
config: Config;
locked: boolean;
constructor(config: Config, logger: Logger);
getSecret(): Promise<string>;
setSecret(secret: string): Promise<Error | null>;
add(name: string, cb: Callback): void;
/**
* Filter and only match those values that the query define.
**/
filterByQuery(results: searchUtils.SearchItemPkg[], query: searchUtils.SearchQuery): Promise<searchUtils.SearchItemPkg[]>;
getScore(_pkg: searchUtils.SearchItemPkg): Promise<searchUtils.Score>;
private _getCustomPackageLocalStorages;
search(query: searchUtils.SearchQuery): Promise<searchUtils.SearchItem[]>;
remove(name: string, cb: Callback): void;
/**
* Return all database elements.
* @return {Array}
*/
get(cb: Callback): void;
getPackageStorage(packageName: string): LocalDriver | undefined;
clean(): void;
private getTime;
/**
* Syncronize {create} database whether does not exist.
* @return {Error|*}
*/
private _sync;
private getBaseConfigPath;
/**
* The field storage could be absolute or relative.
* If relative, it will be resolved against the config path.
* If absolute, it will be returned as is.
**/
private getStoragePath;
/**
* Verify the right local storage location.
* @param {String} path
* @return {String}
* @private
*/
private _getLocalStoragePath;
/**
* Fetch local packages.
* @private
* @return {Object}
*/
private _fetchLocalPackages;
}
export default LocalDatabase;