verdaccio
Version:
A lightweight private npm proxy registry
106 lines (104 loc) • 4.01 kB
TypeScript
import { parseConfigFile } from '@verdaccio/config';
import { errorUtils, validationUtils } from '@verdaccio/core';
import { StringValue } from '@verdaccio/types';
import { Config, Manifest, Version } from '@verdaccio/types';
import { buildToken as buildTokenUtil } from '@verdaccio/utils';
/**
* Check whether an element is an Object
* @param {*} obj the element
* @return {Boolean}
*/
export declare const isObject: typeof validationUtils.isObject;
/**
* @deprecated not used un v6
*/
export declare function isObjectOrArray(obj: any): boolean;
export declare function tagVersion(data: Manifest, version: string, tag: StringValue): boolean;
/**
* Gets version from a package object taking into account semver weirdness.
* @return {String} return the semantic version of a package
*/
export declare function getVersion(pkg: Manifest, version: any): Version | void;
/**
* Parse an internet address
* Allow:
- https:localhost:1234 - protocol + host + port
- localhost:1234 - host + port
- 1234 - port
- http::1234 - protocol + port
- https://localhost:443/ - full url + https
- http://[::1]:443/ - ipv6
- unix:/tmp/http.sock - unix sockets
- https://unix:/tmp/http.sock - unix sockets (https)
* @param {*} urlAddress the internet address definition
* @return {Object|Null} literal object that represent the address parsed
*/
export declare function parseAddress(urlAddress: any): any;
/**
* Function filters out bad semver versions and sorts the array.
* @return {Array} sorted Array
*/
export declare function semverSort(listVersions: string[]): string[];
/**
* Flatten arrays of tags.
* @param {*} data
*/
export declare function normalizeDistTags(pkg: Manifest): void;
/**
* Parse an internal string to number
* @param {*} interval
* @return {Number}
*/
export declare function parseInterval(interval: any): number;
export declare const ErrorCode: {
getConflict: typeof errorUtils.getConflict;
getBadData: typeof errorUtils.getBadData;
getBadRequest: typeof errorUtils.getBadRequest;
getInternalError: typeof errorUtils.getInternalError;
getUnauthorized: typeof errorUtils.getUnauthorized;
getForbidden: typeof errorUtils.getForbidden;
getServiceUnavailable: typeof errorUtils.getServiceUnavailable;
getNotFound: typeof errorUtils.getNotFound;
getCode: typeof errorUtils.getCode;
};
/**
* Check whether the path already exist.
* @param {String} path
* @return {Boolean}
*/
export declare function folderExists(path: string): boolean;
/**
* Check whether the file already exist.
* @param {String} path
* @return {Boolean}
*/
export declare function fileExists(path: string): boolean;
export declare function sortByName(packages: any[], orderAscending?: boolean | void): string[];
export declare function addScope(scope: string, packageName: string): string;
export declare function deleteProperties(propertiesToDelete: string[], objectItem: any): any;
/**
* parse package readme - markdown/ascii
* @param {String} packageName name of package
* @param {String} readme package readme
* @return {String} converted html template
*/
export declare function parseReadme(packageName: string, readme: string): string | void;
/**
* return a masquerade string with its first and last {charNum} and three dots in between.
* @param {String} str
* @param {Number} charNum
* @returns {String}
*/
export declare function mask(str: string, charNum?: number): string;
export declare function encodeScopedUri(packageName: any): string;
export declare function hasDiffOneKey(versions: any): boolean;
export declare function isVersionValid(packageMeta: any, packageVersion: any): boolean;
export declare function isRelatedToDeprecation(pkgInfo: Manifest): boolean;
/**
*
* @param config
* @deprecated use @verdaccio/middleware
* @returns
*/
export declare function hasLogin(config: Config): boolean;
export { buildTokenUtil as buildToken, parseConfigFile };