diff --git a/.eslintrc b/.eslintrc index 9b481ed08..6489d323d 100644 --- a/.eslintrc +++ b/.eslintrc @@ -64,7 +64,9 @@ "jsxBracketSameLine": true, "trailingComma": "es5", "semi": true, - "parser": "typescript" + "parser": "typescript", + "importOrder": ["^@verdaccio/(.*)$", "^[./]"], + "importOrderSeparation": true } ], "react/prop-types": 0, diff --git a/.nvmrc b/.nvmrc index 48082f72f..da2d3988d 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -12 +14 \ No newline at end of file diff --git a/debug/.babelrc b/debug/.babelrc index 9c3626dfd..714601ae2 100644 --- a/debug/.babelrc +++ b/debug/.babelrc @@ -1,4 +1,4 @@ { - "presets": [["@verdaccio"]], + "extends": "../.babelrc", "debug": true } diff --git a/debug/bootstrap.js b/debug/bootstrap.js index 3f05abbed..6409d3e3b 100644 --- a/debug/bootstrap.js +++ b/debug/bootstrap.js @@ -1,6 +1,6 @@ // this file aims to help local debugging with hot transpilation -// it requires BABEL_ENV=registry set as env variable require('@babel/register')({ extensions: ['.ts', '.js'], }); + require('../packages/cli/src/index'); diff --git a/package.json b/package.json index 838da8efc..3f9dcd4aa 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,8 @@ "@types/supertest": "2.0.9", "@typescript-eslint/eslint-plugin": "^3.9.1", "@typescript-eslint/parser": "^3.9.1", - "@verdaccio/types": "9.5.0", + "@verdaccio/types": "workspace:*", + "@verdaccio/ui-theme": "latest", "babel-core": "7.0.0-bridge.0", "babel-eslint": "10.1.0", "babel-jest": "26.1.0", @@ -90,10 +91,12 @@ "selfsigned": "1.10.7", "standard-version": "8.0.0", "supertest": "4.0.2", - "typescript": "3.9.7", - "verdaccio": "4.7.1", - "verdaccio-auth-memory": "9.7.0", - "verdaccio-memory": "9.7.0" + "typescript": "4.0.2", + "verdaccio": "latest", + "verdaccio-audit": "latest", + "verdaccio-auth-memory": "latest", + "verdaccio-htpasswd": "latest", + "verdaccio-memory": "latest" }, "scripts": { "debug": "node debug/bootstrap.js", diff --git a/packages/api/package.json b/packages/api/package.json index 977c9bf22..1c51bbedf 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -34,15 +34,17 @@ "debug": "^4.1.1", "cookies": "0.8.0", "express": "4.17.1", - "lodash": "4.17.15", + "semver": "7.3.2", + "lodash": "^4.17.15", "mime": "2.4.4" }, "devDependencies": { "@verdaccio/config": "5.0.0-alpha.0", "@verdaccio/server": "5.0.0-alpha.0", "@verdaccio/dev-types": "5.0.0-alpha.0", - "@verdaccio/types": "9.5.0", + "@verdaccio/types": "workspace:*", "body-parser": "1.19.0", + "lodash": "^4.17.20", "supertest": "next" }, "gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982" diff --git a/packages/auth/package.json b/packages/auth/package.json index 6880c62b5..dadd24af0 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -29,13 +29,14 @@ "@verdaccio/logger": "5.0.0-alpha.0", "@verdaccio/utils": "5.0.0-alpha.0", "express": "4.17.1", - "lodash": "4.17.15" + "lodash": "4.17.15", + "debug": "^4.1.1" }, "devDependencies": { "@verdaccio/config": "workspace:5.0.0-alpha.0", "@verdaccio/mock": "workspace:5.0.0-alpha.0", "@verdaccio/dev-types": "workspace:5.0.0-alpha.0", - "@verdaccio/types": "9.5.0" + "@verdaccio/types": "workspace:*" }, "gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982" } diff --git a/packages/auth/src/auth.ts b/packages/auth/src/auth.ts index 0043289b5..a78e5e71a 100644 --- a/packages/auth/src/auth.ts +++ b/packages/auth/src/auth.ts @@ -1,13 +1,22 @@ import _ from 'lodash'; import { NextFunction } from 'express'; +import buildDebug from 'debug'; import { VerdaccioError, getBadRequest, getInternalError, getForbidden } from '@verdaccio/commons-api'; import { API_ERROR, SUPPORT_ERRORS, TOKEN_BASIC, TOKEN_BEARER } from '@verdaccio/dev-commons'; import { loadPlugin } from '@verdaccio/loaders'; -import { aesEncrypt, signPayload } from '@verdaccio/utils'; -import { getDefaultPlugins, createAnonymousRemoteUser, convertPayloadToBase64, createRemoteUser } from '@verdaccio/utils'; +import { + aesEncrypt, + signPayload, + isNil, + isFunction, + getMatchedPackagesSpec, + getDefaultPlugins, + createAnonymousRemoteUser, + convertPayloadToBase64, + createRemoteUser, +} from '@verdaccio/utils'; -import { getMatchedPackagesSpec } from '@verdaccio/utils'; import { Config, Logger, Callback, IPluginAuth, RemoteUser, JWTSignOptions, Security, AuthPluginPackage, AllowAccess, PackageAccess } from '@verdaccio/types'; import { $RequestExtend, $ResponseExtend, IAuth, AESPayload } from '@verdaccio/dev-types'; import { getMiddlewareCredentials, getSecurity, verifyJWTPayload, parseBasicPayload, parseAuthTokenHeader, isAuthHeaderValid, isAESLegacy } from './utils'; @@ -15,6 +24,8 @@ import { getMiddlewareCredentials, getSecurity, verifyJWTPayload, parseBasicPayl /* eslint-disable @typescript-eslint/no-var-requires */ const LoggerApi = require('@verdaccio/logger'); +const debug = buildDebug('verdaccio:auth'); + class Auth implements IAuth { public config: Config; public logger: Logger; @@ -48,18 +59,18 @@ class Auth implements IAuth { } public changePassword(username: string, password: string, newPassword: string, cb: Callback): void { - const validPlugins = _.filter(this.plugins, (plugin) => _.isFunction(plugin.changePassword)); + const validPlugins = _.filter(this.plugins, (plugin) => isFunction(plugin.changePassword)); if (_.isEmpty(validPlugins)) { return cb(getInternalError(SUPPORT_ERRORS.PLUGIN_MISSING_INTERFACE)); } for (const plugin of validPlugins) { - if (_.isNil(plugin) || _.isFunction(plugin.changePassword) === false) { - this.logger.trace('auth plugin does not implement changePassword, trying next one'); + if (isNil(plugin) || isFunction(plugin.changePassword) === false) { + debug('auth plugin does not implement changePassword, trying next one'); continue; } else { - this.logger.trace({ username }, 'updating password for @{username}'); + debug('updating password for %o', username); plugin.changePassword!(username, password, newPassword, (err, profile): void => { if (err) { this.logger.error( @@ -70,7 +81,7 @@ class Auth implements IAuth { return cb(err); } - this.logger.trace({ username }, 'updated password for @{username} was successful'); + debug('updated password for %o was successful', username); return cb(null, profile); }); } @@ -83,14 +94,14 @@ class Auth implements IAuth { (function next(): void { const plugin = plugins.shift() as IPluginAuth; - if (_.isFunction(plugin.authenticate) === false) { + if (isFunction(plugin.authenticate) === false) { return next(); } - self.logger.trace({ username }, 'authenticating @{username}'); + debug('authenticating %o', username); plugin.authenticate(username, password, function (err, groups): void { if (err) { - self.logger.trace({ username, err }, 'authenticating for user @{username} failed. Error: @{err.message}'); + debug('authenticating for user %o failed. Error: %o', username, err?.message); return cb(err); } @@ -111,7 +122,7 @@ class Auth implements IAuth { throw new TypeError(API_ERROR.BAD_FORMAT_USER_GROUP); } - self.logger.trace({ username, groups }, 'authentication for user @{username} was successfully. Groups: @{groups}'); + debug('authentication for user %o was successfully. Groups: %o', username, groups); return cb(err, createRemoteUser(username, groups)); } next(); @@ -122,27 +133,27 @@ class Auth implements IAuth { public add_user(user: string, password: string, cb: Callback): void { const self = this; const plugins = this.plugins.slice(0); - this.logger.trace({ user }, 'add user @{user}'); + debug('add user %o', user); (function next(): void { const plugin = plugins.shift() as IPluginAuth; let method = 'adduser'; - if (_.isFunction(plugin[method]) === false) { + if (isFunction(plugin[method]) === false) { method = 'add_user'; self.logger.warn('the plugin method add_user in the auth plugin is deprecated and will be removed in next major release, notify to the plugin author'); } - if (_.isFunction(plugin[method]) === false) { + if (isFunction(plugin[method]) === false) { next(); } else { // p.add_user() execution plugin[method](user, password, function (err, ok): void { if (err) { - self.logger.trace({ user, err: err.message }, 'the user @{user} could not being added. Error: @{err}'); + debug('the user %o could not being added. Error: %o', user, err?.message); return cb(err); } if (ok) { - self.logger.trace({ user }, 'the user @{user} has been added'); + debug('the user %o has been added', user); return self.authenticate(user, password, cb); } next(); @@ -159,23 +170,23 @@ class Auth implements IAuth { const pkgAllowAcces: AllowAccess = { name: packageName, version: packageVersion }; const pkg = Object.assign({}, pkgAllowAcces, getMatchedPackagesSpec(packageName, this.config.packages)) as AllowAccess & PackageAccess; const self = this; - this.logger.trace({ packageName }, 'allow access for @{packageName}'); + debug('allow access for %o', packageName); (function next(): void { const plugin: IPluginAuth = plugins.shift() as IPluginAuth; - if (_.isNil(plugin) || _.isFunction(plugin.allow_access) === false) { + if (_.isNil(plugin) || isFunction(plugin.allow_access) === false) { return next(); } plugin.allow_access!(user, pkg, function (err, ok: boolean): void { if (err) { - self.logger.trace({ packageName, err }, 'forbidden access for @{packageName}. Error: @{err.message}'); + debug('aforbidden access for %o. Error: %o', packageName, err?.message); return callback(err); } if (ok) { - self.logger.trace({ packageName }, 'allowed access for @{packageName}'); + debug('allowed access for %o', packageName); return callback(null, ok); } @@ -186,28 +197,28 @@ class Auth implements IAuth { public allow_unpublish({ packageName, packageVersion }: AuthPluginPackage, user: RemoteUser, callback: Callback): void { const pkg = Object.assign({ name: packageName, version: packageVersion }, getMatchedPackagesSpec(packageName, this.config.packages)); - this.logger.trace({ packageName }, 'allow unpublish for @{packageName}'); + debug('allow unpublish for %o', packageName); for (const plugin of this.plugins) { - if (_.isNil(plugin) || _.isFunction(plugin.allow_unpublish) === false) { - this.logger.trace({ packageName }, 'allow unpublish for @{packageName} plugin does not implement allow_unpublish'); + if (_.isNil(plugin) || isFunction(plugin.allow_unpublish) === false) { + debug('allow unpublish for %o plugin does not implement allow_unpublish', packageName); continue; } else { plugin.allow_unpublish!(user, pkg, (err, ok: boolean): void => { if (err) { - this.logger.trace({ packageName }, 'forbidden publish for @{packageName}, it will fallback on unpublish permissions'); + debug('forbidden publish for %o, it will fallback on unpublish permissions', packageName); return callback(err); } if (_.isNil(ok) === true) { - this.logger.trace({ packageName }, 'we bypass unpublish for @{packageName}, publish will handle the access'); + debug('bypass unpublish for %o, publish will handle the access', packageName); // @ts-ignore // eslint-disable-next-line return this.allow_publish(...arguments); } if (ok) { - this.logger.trace({ packageName }, 'allowed unpublish for @{packageName}'); + debug('allowed unpublish for %o', packageName); return callback(null, ok); } }); @@ -222,13 +233,13 @@ class Auth implements IAuth { const plugins = this.plugins.slice(0); const self = this; const pkg = Object.assign({ name: packageName, version: packageVersion }, getMatchedPackagesSpec(packageName, this.config.packages)); - this.logger.trace({ packageName, plugins: this.plugins.length }, 'allow publish for @{packageName} init | plugins: @{plugins}'); + debug('allow publish for %o init | plugins: %o', packageName, plugins.length); (function next(): void { const plugin = plugins.shift(); - if (_.isNil(plugin) || _.isFunction(plugin.allow_publish) === false) { - self.logger.trace({ packageName }, 'allow publish for @{packageName} plugin does not implement allow_publish'); + if (_.isNil(plugin) || isFunction(plugin.allow_publish) === false) { + debug('allow publish for %o plugin does not implement allow_publish', packageName); return next(); } @@ -239,16 +250,16 @@ class Auth implements IAuth { // @ts-ignore (err: VerdaccioError, ok: boolean): void => { if (_.isNil(err) === false && _.isError(err)) { - self.logger.trace({ packageName }, 'forbidden publish for @{packageName}'); + debug('forbidden publish for %o', packageName); return callback(err); } if (ok) { - self.logger.trace({ packageName }, 'allowed publish for @{packageName}'); + debug('allowed publish for %o', packageName); return callback(null, ok); } - self.logger.trace({ packageName }, 'allow publish skip validation for @{packageName}'); + debug('allow publish skip validation for %o', packageName); next(); // cb(null, false) causes next plugin to roll } ); @@ -292,7 +303,7 @@ class Auth implements IAuth { } if (!isAuthHeaderValid(authorization)) { - this.logger.trace('api middleware auth heather is not valid'); + debug('api middleware auth heather is not valid'); return next(getBadRequest(API_ERROR.BAD_AUTH_HEADER)); } @@ -300,10 +311,10 @@ class Auth implements IAuth { const { secret } = this.config; if (isAESLegacy(security)) { - this.logger.trace('api middleware using legacy auth token'); + debug('api middleware using legacy auth token'); this._handleAESMiddleware(req, security, secret, authorization, next); } else { - this.logger.trace('api middleware using JWT auth token'); + debug('api middleware using JWT auth token'); this._handleJWTAPIMiddleware(req, security, secret, authorization, next); } }; diff --git a/packages/cli/src/.eslintrc b/packages/cli/.eslintrc similarity index 100% rename from packages/cli/src/.eslintrc rename to packages/cli/.eslintrc diff --git a/packages/cli/package.json b/packages/cli/package.json index 5469dc28e..16f3fb43a 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -33,6 +33,7 @@ "@verdaccio/node-api": "5.0.0-alpha.0", "@verdaccio/utils": "5.0.0-alpha.0", "commander": "5.1.0", + "lodash": "^4.17.20", "envinfo": "7.4.0", "kleur": "3.0.3", "semver": "7.3.2" diff --git a/packages/commons/package.json b/packages/commons/package.json index 2e180d2b5..b4eba6aed 100644 --- a/packages/commons/package.json +++ b/packages/commons/package.json @@ -14,6 +14,9 @@ }, "homepage": "https://verdaccio.org", "license": "MIT", + "devDependencies": { + "@verdaccio/types": "workspace:10.0.0-beta" + }, "scripts": { "clean": "rimraf ./build", "type-check": "tsc --noEmit", diff --git a/packages/config/package.json b/packages/config/package.json index 40c01a8ce..a9300bb10 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -29,7 +29,8 @@ "@verdaccio/dev-commons": "workspace:5.0.0-alpha.0", "@verdaccio/logger": "workspace:5.0.0-alpha.0", "@verdaccio/utils": "workspace:5.0.0-alpha.0", - "mkdirp": "0.5.5" + "mkdirp": "0.5.5", + "lodash": "^4.17.20" }, "gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982" } diff --git a/packages/core/file-locking/tsconfig.json b/packages/core/file-locking/tsconfig.json index 537522270..9af75b8b4 100644 --- a/packages/core/file-locking/tsconfig.json +++ b/packages/core/file-locking/tsconfig.json @@ -1,9 +1,9 @@ { "extends": "../../../tsconfig", "compilerOptions": { - "rootDir": "./src", + "rootDir": "./", "outDir": "./build" }, - "include": ["src/**/*"], + "include": ["src/**/*", "types/*.d.ts"], "exclude": ["src/**/*.test.ts"] } diff --git a/packages/core/local-storage/package.json b/packages/core/local-storage/package.json index 6cd482154..edf25bbd0 100644 --- a/packages/core/local-storage/package.json +++ b/packages/core/local-storage/package.json @@ -37,7 +37,8 @@ "async": "^3.2.0", "level": "5.0.1", "lodash": "^4.17.19", - "mkdirp": "^0.5.5" + "mkdirp": "^0.5.5", + "debug": "^4.1.1" }, "devDependencies": { "@types/minimatch": "^3.0.3", diff --git a/packages/core/local-storage/src/local-database.ts b/packages/core/local-storage/src/local-database.ts index 2a52a868e..0374816ce 100644 --- a/packages/core/local-storage/src/local-database.ts +++ b/packages/core/local-storage/src/local-database.ts @@ -1,6 +1,7 @@ import fs from 'fs'; import Path from 'path'; import stream from 'stream'; +import buildDebug from 'debug'; import _ from 'lodash'; import async from 'async'; @@ -26,6 +27,8 @@ interface Level { createReadStream(options?: object): stream.Readable; } +const debug = buildDebug('verdaccio:plugin:local-storage'); + /** * Handle local database. */ @@ -47,9 +50,6 @@ class LocalDatabase implements IPluginStorage<{}> { this.logger = logger; this.locked = false; this.data = this._fetchLocalPackages(); - - this.logger.trace({ config: this.config }, '[local-storage]: configuration: @{config}'); - this._sync(); } @@ -74,20 +74,21 @@ class LocalDatabase implements IPluginStorage<{}> { if (this.data.list.indexOf(name) === -1) { this.data.list.push(name); - this.logger.debug({ name }, '[local-storage]: the private package @{name} has been added'); + debug('the private package %o has been added', name); cb(this._sync()); } else { + debug('the private package %o was not added', name); cb(null); } } public search(onPackage: Callback, onEnd: Callback, validateName: (name: string) => boolean): void { const storages = this._getCustomPackageLocalStorages(); - this.logger.trace(`local-storage: [search]: ${JSON.stringify(storages)}`); + debug(`search custom local packages: %o`, JSON.stringify(storages)); const base = Path.dirname(this.config.self_path); const self = this; const storageKeys = Object.keys(storages); - this.logger.trace(`local-storage: [search] base: ${base} keys ${storageKeys}`); + debug(`search base: %o keys: %o`, base, storageKeys); async.eachSeries( storageKeys, @@ -95,7 +96,7 @@ class LocalDatabase implements IPluginStorage<{}> { const position = storageKeys.indexOf(storage); const base2 = Path.join(position !== 0 ? storageKeys[0] : ''); const storagePath: string = Path.resolve(base, base2, storage); - self.logger.trace({ storagePath, storage }, 'local-storage: [search] search path: @{storagePath} : @{storage}'); + debug('search path: %o : %o', storagePath, storage); fs.readdir(storagePath, (err, files) => { if (err) { return cb(err); @@ -104,7 +105,7 @@ class LocalDatabase implements IPluginStorage<{}> { async.eachSeries( files, function (file, cb) { - self.logger.trace({ file }, 'local-storage: [search] search file path: @{file}'); + debug('local-storage: [search] search file path: %o', file); if (storageKeys.includes(file)) { return cb(); } @@ -112,7 +113,7 @@ class LocalDatabase implements IPluginStorage<{}> { if (file.match(/^@/)) { // scoped const fileLocation = Path.resolve(base, storage, file); - self.logger.trace({ fileLocation }, 'local-storage: [search] search scoped file location: @{fileLocation}'); + debug('search scoped file location: %o', fileLocation); fs.readdir(fileLocation, function (err, files) { if (err) { return cb(err); @@ -145,7 +146,7 @@ class LocalDatabase implements IPluginStorage<{}> { } else if (validateName(file)) { const base2 = Path.join(position !== 0 ? storageKeys[0] : ''); const packagePath = Path.resolve(base, base2, storage, file); - self.logger.trace({ packagePath }, 'local-storage: [search] search file location: @{packagePath}'); + debug('search file location: %o', packagePath); fs.stat(packagePath, (err, stats) => { if (_.isNil(err) === false) { return cb(err); @@ -182,13 +183,14 @@ class LocalDatabase implements IPluginStorage<{}> { if (err) { cb(getInternalError('error remove private package')); this.logger.error({ err }, '[local-storage/remove]: remove the private package has failed @{err}'); + debug('error on remove package %o', name); } const pkgName = data.indexOf(name); if (pkgName !== -1) { this.data.list.splice(pkgName, 1); - this.logger.trace({ name }, 'local-storage: [remove] package @{name} has been removed'); + debug('remove package %o has been removed', name); } cb(this._sync()); @@ -205,23 +207,23 @@ class LocalDatabase implements IPluginStorage<{}> { cb(null, list); - this.logger.trace({ totalItems }, 'local-storage: [get] full list of packages (@{totalItems}) has been fetched'); + debug('get full list of packages (%o) has been fetched', totalItems); } public getPackageStorage(packageName: string): IPackageStorage { const packageAccess = this.config.getMatchedPackagesSpec(packageName); const packagePath: string = this._getLocalStoragePath(packageAccess ? packageAccess.storage : undefined); - this.logger.trace({ packagePath }, '[local-storage/getPackageStorage]: storage selected: @{packagePath}'); + debug('storage path selected: ', packagePath); if (_.isString(packagePath) === false) { - this.logger.debug({ name: packageName }, 'this package has no storage defined: @{name}'); + debug('the package %o has no storage defined ', packageName); return; } const packageStoragePath: string = Path.join(Path.resolve(Path.dirname(this.config.self_path || ''), packagePath), packageName); - this.logger.trace({ packageStoragePath }, '[local-storage/getPackageStorage]: storage path: @{packageStoragePath}'); + debug('storage absolute path: ', packageStoragePath); return new LocalDriver(packageStoragePath, this.logger); } @@ -312,7 +314,7 @@ class LocalDatabase implements IPluginStorage<{}> { * @return {Error|*} */ private _sync(): Error | null { - this.logger.debug('[local-storage/_sync]: init sync database'); + debug('sync database started'); if (this.locked) { this.logger.error('Database is locked, please check error message printed during startup to prevent data loss.'); @@ -323,21 +325,19 @@ class LocalDatabase implements IPluginStorage<{}> { // https://www.npmjs.com/package/mkdirp#mkdirpsyncdir-opts const folderName = Path.dirname(this.path); mkdirp.sync(folderName); - this.logger.debug({ folderName }, '[local-storage/_sync]: folder @{folderName} created succeed'); + debug('sync folder %o created succeed', folderName); } catch (err) { - // perhaps a logger instance? - this.logger.debug({ err }, '[local-storage/_sync/mkdirp.sync]: sync failed @{err}'); - + debug('sync create folder has failed with error: %o', err); return null; } try { fs.writeFileSync(this.path, JSON.stringify(this.data)); - this.logger.debug('[local-storage/_sync/writeFileSync]: sync write succeed'); + debug('sync write succeed'); return null; } catch (err) { - this.logger.debug({ err }, '[local-storage/_sync/writeFileSync]: sync failed @{err}'); + debug('sync failed %o', err); return err; } diff --git a/packages/core/local-storage/src/local-fs.ts b/packages/core/local-storage/src/local-fs.ts index c3edfe041..f743e7d54 100644 --- a/packages/core/local-storage/src/local-fs.ts +++ b/packages/core/local-storage/src/local-fs.ts @@ -1,5 +1,6 @@ import fs from 'fs'; import path from 'path'; +import buildDebug from 'debug'; import _ from 'lodash'; import mkdirp from 'mkdirp'; @@ -13,6 +14,8 @@ export const noSuchFile = 'ENOENT'; export const resourceNotAvailable = 'EAGAIN'; export const pkgFileName = 'package.json'; +const debug = buildDebug('verdaccio:plugin:local-storage:fs'); + export const fSError = function (message: string, code = 409): VerdaccioError { const err: VerdaccioError = getCode(code, message); // FIXME: we should return http-status codes here instead, future improvement @@ -88,32 +91,20 @@ export default class LocalFS implements ILocalFSPackageManager { self._unlockJSON(pkgFileName, () => { // ignore any error from the unlock if (lockError !== null) { - self.logger.trace( - { - name, - lockError, - }, - '[local-storage/updatePackage/unLockCallback] file: @{name} lock has failed lockError: @{lockError}' - ); + debug('lock file: %o has failed with error %o', name, lockError); } onEnd.apply(lockError, _args); }); } else { - self.logger.trace({ name }, '[local-storage/updatePackage/unLockCallback] file: @{name} has been updated'); - + debug('file: %o has been updated', name); onEnd(..._args); } }; if (!err) { locked = true; - this.logger.trace( - { - name, - }, - '[local-storage/updatePackage] file: @{name} has been locked' - ); + debug('file: %o has been locked', name); } if (_.isNil(err) === false) { @@ -137,46 +128,46 @@ export default class LocalFS implements ILocalFSPackageManager { } public deletePackage(packageName: string, callback: (err: NodeJS.ErrnoException | null) => void): void { - this.logger.debug({ packageName }, '[local-storage/deletePackage] delete a package @{packageName}'); + debug('delete a package %o', packageName); return fs.unlink(this._getStorage(packageName), callback); } public removePackage(callback: (err: NodeJS.ErrnoException | null) => void): void { - this.logger.debug({ packageName: this.path }, '[local-storage/removePackage] remove a package: @{packageName}'); + debug('remove a package %o', this.path); fs.rmdir(this._getStorage('.'), callback); } public createPackage(name: string, value: Package, cb: Callback): void { - this.logger.debug({ packageName: name }, '[local-storage/createPackage] create a package: @{packageName}'); + debug('create a package %o', name); this._createFile(this._getStorage(pkgFileName), this._convertToString(value), cb); } public savePackage(name: string, value: Package, cb: Callback): void { - this.logger.debug({ packageName: name }, '[local-storage/savePackage] save a package: @{packageName}'); + debug('save a package %o', name); this._writeFile(this._getStorage(pkgFileName), this._convertToString(value), cb); } public readPackage(name: string, cb: Callback): void { - this.logger.debug({ packageName: name }, '[local-storage/readPackage] read a package: @{packageName}'); + debug('read a package %o', name); this._readStorageFile(this._getStorage(pkgFileName)).then( (res) => { try { const data: any = JSON.parse(res.toString('utf8')); - this.logger.trace({ packageName: name }, '[local-storage/readPackage/_readStorageFile] read a package succeed: @{packageName}'); + debug('read storage file %o has succeed', name); cb(null, data); } catch (err) { - this.logger.trace({ err }, '[local-storage/readPackage/_readStorageFile] error on read a package: @{err}'); + debug('parse storage file %o has failed with error %o', name, err); cb(err); } }, (err) => { - this.logger.trace({ err }, '[local-storage/readPackage/_readStorageFile] error on read a package: @{err}'); + debug('read storage file %o has failed with error %o', name, err); return cb(err); } @@ -185,7 +176,7 @@ export default class LocalFS implements ILocalFSPackageManager { public writeTarball(name: string): IUploadTarball { const uploadStream = new UploadTarball({}); - this.logger.debug({ packageName: name }, '[local-storage/writeTarball] write a tarball for package: @{packageName}'); + debug('write a tarball for a package %o', name); let _ended = 0; uploadStream.on('end', function () { @@ -200,6 +191,7 @@ export default class LocalFS implements ILocalFSPackageManager { uploadStream.emit('error', fSError(fileExist)); } else { const temporalName = path.join(this.path, `${name}.tmp-${String(Math.random()).replace(/^0\./, '')}`); + debug('write a temporal name %o', temporalName); const file = fs.createWriteStream(temporalName); const removeTempFile = (): void => fs.unlink(temporalName, () => {}); let opened = false; @@ -255,28 +247,32 @@ export default class LocalFS implements ILocalFSPackageManager { public readTarball(name: string): ReadTarball { const pathName: string = this._getStorage(name); - this.logger.debug({ packageName: name }, '[local-storage/readTarball] read a tarball for package: @{packageName}'); + debug('read a a tarball %o on path %o', name, pathName); const readTarballStream = new ReadTarball({}); const readStream = fs.createReadStream(pathName); readStream.on('error', function (err) { + debug('error on read a tarball %o with error %o', name, err); readTarballStream.emit('error', err); }); readStream.on('open', function (fd) { fs.fstat(fd, function (err, stats) { if (_.isNil(err) === false) { + debug('error on read a tarball %o with error %o', name, err); return readTarballStream.emit('error', err); } readTarballStream.emit('content-length', stats.size); readTarballStream.emit('open'); + debug('open on read a tarball %o', name); readStream.pipe(readTarballStream); }); }); readTarballStream.abort = function (): void { + debug('abort on read a tarball %o', name); readStream.close(); }; @@ -284,13 +280,13 @@ export default class LocalFS implements ILocalFSPackageManager { } private _createFile(name: string, contents: any, callback: Function): void { - this.logger.trace({ name }, '[local-storage/_createFile] create a new file: @{name}'); + debug(' create a new file: %o', name); fs.open(name, 'wx', (err) => { if (err) { // native EEXIST used here to check exception on fs.open if (err.code === 'EEXIST') { - this.logger.trace({ name }, '[local-storage/_createFile] file cannot be created, it already exists: @{name}'); + debug('file %o cannot be created, it already exists: %o', name); return callback(fSError(fileExist)); } } @@ -301,14 +297,14 @@ export default class LocalFS implements ILocalFSPackageManager { private _readStorageFile(name: string): Promise { return new Promise((resolve, reject): void => { - this.logger.trace({ name }, '[local-storage/_readStorageFile] read a file: @{name}'); + debug('reading the file: %o', name); fs.readFile(name, (err, data) => { if (err) { - this.logger.trace({ err }, '[local-storage/_readStorageFile] error on read the file: @{name}'); + debug('error reading the file: %o with error %o', name, err); reject(err); } else { - this.logger.trace({ name }, '[local-storage/_readStorageFile] read file succeed: @{name}'); + debug('read file %o succeed', name); resolve(data); } @@ -332,12 +328,11 @@ export default class LocalFS implements ILocalFSPackageManager { fs.writeFile(tempFilePath, data, (err) => { if (err) { - this.logger.trace({ name: dest }, '[local-storage/_writeFile] new file: @{name} has been created'); - + debug('error on write the file: %o', dest); return cb(err); } - this.logger.trace({ name: dest }, '[local-storage/_writeFile] creating a new file: @{name}'); + debug('creating a new file:: %o', dest); renameTmp(tempFilePath, dest, cb); }); }; @@ -367,12 +362,12 @@ export default class LocalFS implements ILocalFSPackageManager { }, (err, res) => { if (err) { - this.logger.trace({ name }, '[local-storage/_lockAndReadJSON] read new file: @{name} has failed'); + debug('error on lock and read json for file: %o', name); return cb(err); } + debug('lock and read json for file: %o', name); - this.logger.trace({ name }, '[local-storage/_lockAndReadJSON] file: @{name} read'); return cb(null, res); } ); diff --git a/packages/core/types/.eslintrc.json b/packages/core/types/.eslintrc.json index 20672e236..70b81bc7d 100644 --- a/packages/core/types/.eslintrc.json +++ b/packages/core/types/.eslintrc.json @@ -1,5 +1,6 @@ { "rules": { + "spaced-comment": 0, "@typescript-eslint/adjacent-overload-signatures": "off", "@typescript-eslint/explicit-member-accessibility": "off", "@typescript-eslint/interface-name-prefix": "off", diff --git a/packages/core/types/index.d.ts b/packages/core/types/index.d.ts new file mode 100644 index 000000000..07a97a6a9 --- /dev/null +++ b/packages/core/types/index.d.ts @@ -0,0 +1,537 @@ +/// + +import { PassThrough } from 'stream'; + +declare module '@verdaccio/types' { + type StringValue = string | void | null; + + type StorageList = string[]; + type Callback = Function; + // FIXME: err should be something flexible enough for any implementation + type CallbackAction = (err: any | null) => void; + type CallbackError = (err: NodeJS.ErrnoException) => void; + interface Author { + name: string; + email?: string; + url?: string; + } + + interface Dist { + integrity?: string; + shasum: string; + tarball: string; + } + + interface RemoteUser { + real_groups: string[]; + groups: string[]; + name: string | void; + error?: string; + } + + interface LocalStorage { + list: any; + secret: string; + } + + interface Version { + name: string; + version: string; + devDependencies?: string; + directories?: any; + dist: Dist; + author: string | Author; + main: string; + homemage?: string; + license?: string; + readme: string; + readmeFileName?: string; + readmeFilename?: string; + description: string; + bin?: string; + bugs?: any; + files?: string[]; + gitHead?: string; + maintainers?: Author[]; + contributors?: Author[]; + repository?: string | any; + scripts?: any; + homepage?: string; + etag?: string; + dependencies: any; + keywords?: string | string[]; + nodeVersion?: string; + _id: string; + _npmVersion?: string; + _npmUser: Author; + _hasShrinkwrap?: boolean; + deprecated?: string; + } + + interface Logger { + child: (conf: any) => any; + debug: (conf: any, template?: string) => void; + error: (conf: any, template?: string) => void; + http: (conf: any, template?: string) => void; + trace: (conf: any, template?: string) => void; + warn: (conf: any, template?: string) => void; + info: (conf: any, template?: string) => void; + } + + interface Versions { + [key: string]: Version; + } + + interface DistFile { + url: string; + sha: string; + registry?: string; + } + + interface MergeTags { + [key: string]: string; + } + + interface DistFiles { + [key: string]: DistFile; + } + + interface AttachMents { + [key: string]: AttachMentsItem; + } + + interface AttachMentsItem { + content_type?: string; + data?: string; + length?: number; + shasum?: string; + version?: string; + } + + interface GenericBody { + [key: string]: string; + } + + interface UpLinkMetadata { + etag: string; + fetched: number; + } + + interface UpLinks { + [key: string]: UpLinkMetadata; + } + + interface Tags { + [key: string]: Version; + } + + interface Headers { + [key: string]: string; + } + + interface PackageUsers { + [key: string]: boolean; + } + + interface Package { + _id?: string; + name: string; + versions: Versions; + 'dist-tags': GenericBody; + time?: GenericBody; + readme?: string; + users?: PackageUsers; + _distfiles: DistFiles; + _attachments: AttachMents; + _uplinks: UpLinks; + _rev: string; + } + + interface IUploadTarball extends PassThrough { + abort(): void; + done(): void; + } + + interface IReadTarball extends PassThrough { + abort(): void; + } + + interface UpLinkTokenConf { + type: 'Bearer' | 'Basic'; + token?: string; + token_env?: boolean | string; + } + + interface UpLinkConf { + url: string; + ca?: string; + cache?: boolean; + timeout?: string | void; + maxage?: string | void; + max_fails?: number | void; + fail_timeout?: string | void; + headers?: Headers; + auth?: UpLinkTokenConf; + strict_ssl?: boolean | void; + _autogenerated?: boolean; + } + + interface AuthPluginPackage { + packageName: string; + packageVersion?: string; + tag?: string; + } + + interface PackageAccess { + storage?: string; + publish?: string[]; + proxy?: string[]; + access?: string[]; + } + + interface PackageList { + [key: string]: PackageAccess; + } + + interface UpLinksConfList { + [key: string]: UpLinkConf; + } + + type LoggerType = 'stdout' | 'stderr' | 'file'; + type LoggerFormat = 'pretty' | 'pretty-timestamped' | 'file'; + type LoggerLevel = 'http' | 'fatal' | 'warn' | 'info' | 'debug' | 'trace'; + + interface LoggerConfItem { + type: LoggerType; + format: LoggerFormat; + level: LoggerLevel; + } + + interface PublishOptions { + allow_offline: boolean; + } + + type AuthConf = any | AuthHtpasswd; + + interface AuthHtpasswd { + file: string; + max_users: number; + } + + interface Notifications { + method: string; + packagePattern: RegExp; + packagePatternFlags: string; + endpoint: string; + content: string; + headers: Headers; + } + + interface ConfigFile { + storage: string; + plugins: string; + self_path: string; + packages: PackageList; + uplinks: UpLinksConfList; + logs: LoggerConf[]; + web: WebConf; + auth: AuthConf; + publish?: PublishOptions; + url_prefix?: string; + listen?: ListenAddress; + https?: HttpsConf; + http_proxy?: string; + https_proxy?: string; + no_proxy?: string; + max_body_size?: string; + notifications: Notifications; + } + + interface Token { + user: string; + token: string; + key: string; + cidr?: string[]; + readonly: boolean; + created: number | string; + updated?: number | string; + } + + interface TokenFilter { + user: string; + } + + type SyncReturn = Error | void; + type IPackageStorage = ILocalPackageManager | void; + type IPackageStorageManager = ILocalPackageManager; + type IPluginStorage = ILocalData; + + interface AuthHtpasswd { + file: string; + max_users: number; + } + + interface ILocalStorage { + add(name: string): void; + remove(name: string): void; + get(): StorageList; + sync(): void; + } + + interface LoggerConf { + [key: string]: LoggerConfItem; + } + + interface ListenAddress { + [key: string]: string; + } + + interface WebConf { + enable?: boolean; + title?: string; + logo?: string; + favicon?: string; + gravatar?: boolean; + sort_packages?: string; + } + + interface HttpsConfKeyCert { + key: string; + cert: string; + ca?: string; + } + + interface HttpsConfPfx { + pfx: string; + passphrase?: string; + } + + type HttpsConf = HttpsConfKeyCert | HttpsConfPfx; + + interface JWTOptions { + sign: JWTSignOptions; + verify: JWTVerifyOptions; + } + + interface JWTVerifyOptions { + algorithm?: string; + expiresIn?: string; + notBefore?: string | number; + ignoreExpiration?: boolean; + maxAge?: string | number; + clockTimestamp?: number; + } + + interface JWTSignOptions { + algorithm?: string; + expiresIn?: string; + notBefore?: string; + ignoreExpiration?: boolean; + maxAge?: string | number; + clockTimestamp?: number; + } + + interface APITokenOptions { + legacy: boolean; + jwt?: JWTOptions; + } + + interface Security { + web: JWTOptions; + api: APITokenOptions; + } + + interface Config { + user_agent: string; + server_id: any; + _debug?: boolean; + storage?: string | void; + plugins?: string | void; + secret: string; + self_path: string; + packages: PackageList; + uplinks: UpLinksConfList; + logs?: LoggerConf[]; + web?: WebConf; + auth?: AuthConf; + security: Security; + publish?: PublishOptions; + url_prefix?: string; + store?: any; + listen?: ListenAddress; + https?: HttpsConf; + http_proxy?: string; + https_proxy?: string; + no_proxy?: string; + max_body_size?: string; + notifications?: Notifications; + middlewares?: any; + filters?: any; + checkSecretKey(token: string): string; + getMatchedPackagesSpec(storage: string): PackageAccess | void; + [key: string]: any; + } + + interface ConfigWithHttps extends Config { + https: HttpsConf; + } + + interface ITokenActions { + saveToken(token: Token): Promise; + deleteToken(user: string, tokenKey: string): Promise; + readTokens(filter: TokenFilter): Promise; + } + + /** + * This method expect return a Package object + * eg: + * { + * name: string; + * time: number; + * ... and other props + * } + * + * The `cb` callback object will be executed if: + * - it might return object (truly) + * - it might reutrn null + */ + type onSearchPackage = (item: Package, cb: CallbackAction) => void; + // FIXME: error should be export type `VerdaccioError = HttpError & { code: number };` + // but this type is on @verdaccio/commons-api and cannot be used here yet + type onEndSearchPackage = (error?: any) => void; + type onValidatePackage = (name: string) => boolean; + + interface ILocalData extends IPlugin, ITokenActions { + logger: Logger; + config: T & Config; + add(name: string, callback: Callback): void; + remove(name: string, callback: Callback): void; + get(callback: Callback): void; + getSecret(): Promise; + setSecret(secret: string): Promise; + getPackageStorage(packageInfo: string): IPackageStorage; + search(onPackage: onSearchPackage, onEnd: onEndSearchPackage, validateName: onValidatePackage): void; + } + + type StorageUpdateCallback = (data: Package, cb: CallbackAction) => void; + type StorageUpdateHandler = (name: string, cb: StorageUpdateCallback) => void; + type StorageWriteCallback = (name: string, json: Package, callback: Callback) => void; + type PackageTransformer = (pkg: Package) => Package; + type ReadPackageCallback = (err: any | null, data?: Package) => void; + + interface ILocalPackageManager { + logger: Logger; + writeTarball(pkgName: string): IUploadTarball; + readTarball(pkgName: string): IReadTarball; + readPackage(fileName: string, callback: ReadPackageCallback): void; + createPackage(pkgName: string, value: Package, cb: CallbackAction): void; + deletePackage(fileName: string, callback: CallbackAction): void; + removePackage(callback: CallbackAction): void; + updatePackage( + pkgFileName: string, + updateHandler: StorageUpdateCallback, + onWrite: StorageWriteCallback, + transformPackage: PackageTransformer, + onEnd: CallbackAction + ): void; + savePackage(fileName: string, json: Package, callback: CallbackAction): void; + } + + interface TarballActions { + addTarball(name: string, filename: string): IUploadTarball; + getTarball(name: string, filename: string): IReadTarball; + removeTarball(name: string, filename: string, revision: string, callback: Callback): void; + } + + interface StoragePackageActions extends TarballActions { + addVersion(name: string, version: string, metadata: Version, tag: StringValue, callback: Callback): void; + mergeTags(name: string, tags: MergeTags, callback: Callback): void; + removePackage(name: string, callback: Callback): void; + changePackage(name: string, metadata: Package, revision: string, callback: Callback): void; + } + + interface IStorageManager extends StoragePackageActions { + config: T & Config; + logger: Logger; + init(config: T & Config, filters: any): Promise; + addPackage(name: string, metadata: any, callback: Callback): Promise; + getPackage(options: any): void; + search(startkey: string, options: any): IReadTarball; + getLocalDatabase(callback: Callback): void; + } + + interface IBasicStorage extends StoragePackageActions { + addPackage(name: string, info: Package, callback: Callback): void; + updateVersions(name: string, packageInfo: Package, callback: Callback): void; + getPackageMetadata(name: string, callback: Callback): void; + search(startKey: string, options: any): IReadTarball; + getSecret(config: T & Config): Promise; + } + + interface IBasicAuth { + config: T & Config; + aesEncrypt(buf: Buffer): Buffer; + authenticate(user: string, password: string, cb: Callback): void; + changePassword(user: string, password: string, newPassword: string, cb: Callback): void; + allow_access(pkg: AuthPluginPackage, user: RemoteUser, callback: Callback): void; + add_user(user: string, password: string, cb: Callback): any; + } + + export interface Plugin { + new (config: T, options: PluginOptions): T; + } + + interface IPlugin { + version?: string; + // In case a plugin needs to be cleaned up/removed + close?(): void; + } + + interface PluginOptions { + config: T & Config; + logger: Logger; + } + + interface AllowAccess { + name: string; + version?: string; + tag?: string; + } + + // FIXME: error should be export type `VerdaccioError = HttpError & { code: number };` instead of AuthError + // but this type is on @verdaccio/commons-api and cannot be used here yet (I don't know why) + interface HttpError extends Error { + status: number; + statusCode: number; + expose: boolean; + headers?: { + [key: string]: string; + }; + [key: string]: any; + } + + type AuthError = HttpError & { code: number }; + type AuthAccessCallback = (error: AuthError | null, access: boolean) => void; + type AuthCallback = (error: AuthError | null, groups: string[] | false) => void; + + interface IPluginAuth extends IPlugin { + authenticate(user: string, password: string, cb: AuthCallback): void; + adduser?(user: string, password: string, cb: AuthCallback): void; + changePassword?(user: string, password: string, newPassword: string, cb: AuthCallback): void; + allow_publish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void; + allow_access?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void; + allow_unpublish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void; + allow_publish?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AuthAccessCallback): void; + allow_access?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AuthAccessCallback): void; + allow_unpublish?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AuthAccessCallback): void; + apiJWTmiddleware?(helpers: any): Function; + } + + interface IPluginMiddleware extends IPlugin { + register_middlewares(app: any, auth: IBasicAuth, storage: IStorageManager): void; + } + + interface IPluginStorageFilter extends IPlugin { + filter_metadata(packageInfo: Package): Promise; + } +} diff --git a/packages/core/types/package.json b/packages/core/types/package.json index 8e9ec54c0..ff903835e 100644 --- a/packages/core/types/package.json +++ b/packages/core/types/package.json @@ -21,11 +21,14 @@ "publishConfig": { "access": "public" }, - "main": "lib/index.js", - "typings": "lib/index.d.ts", + "main": "index.d.ts", + "types": "index.d.ts", "scripts": { - "test": "tsc --noEmit", - "build": "rimraf lib tsconfig.tsbuildinfo && tsc --build" + "test": "exit 0", + "build": "exit 0" + }, + "devDependencies": { + "@types/node": "14.6.0" }, "funding": { "type": "opencollective", diff --git a/packages/core/types/src/index.ts b/packages/core/types/src/index.ts deleted file mode 100644 index 698b29a94..000000000 --- a/packages/core/types/src/index.ts +++ /dev/null @@ -1,533 +0,0 @@ -import { PassThrough } from 'stream'; - -type StringValue = string | void | null; - -type StorageList = string[]; -type Callback = Function; -// FIXME: err should be something flexible enough for any implementation -type CallbackAction = (err: any | null) => void; -type CallbackError = (err: NodeJS.ErrnoException) => void; -interface Author { - name: string; - email?: string; - url?: string; -} - -interface Dist { - integrity?: string; - shasum: string; - tarball: string; -} - -interface RemoteUser { - real_groups: string[]; - groups: string[]; - name: string | void; - error?: string; -} - -interface LocalStorage { - list: any; - secret: string; -} - -interface Version { - name: string; - version: string; - devDependencies?: string; - directories?: any; - dist: Dist; - author: string | Author; - main: string; - homemage?: string; - license?: string; - readme: string; - readmeFileName?: string; - readmeFilename?: string; - description: string; - bin?: string; - bugs?: any; - files?: string[]; - gitHead?: string; - maintainers?: Author[]; - contributors?: Author[]; - repository?: string | any; - scripts?: any; - homepage?: string; - etag?: string; - dependencies: any; - keywords?: string | string[]; - nodeVersion?: string; - _id: string; - _npmVersion?: string; - _npmUser: Author; - _hasShrinkwrap?: boolean; - deprecated?: string; -} - -interface Logger { - child: (conf: any) => any; - debug: (conf: any, template?: string) => void; - error: (conf: any, template?: string) => void; - http: (conf: any, template?: string) => void; - trace: (conf: any, template?: string) => void; - warn: (conf: any, template?: string) => void; - info: (conf: any, template?: string) => void; -} - -interface Versions { - [key: string]: Version; -} - -interface DistFile { - url: string; - sha: string; - registry?: string; -} - -interface MergeTags { - [key: string]: string; -} - -interface DistFiles { - [key: string]: DistFile; -} - -interface AttachMents { - [key: string]: AttachMentsItem; -} - -interface AttachMentsItem { - content_type?: string; - data?: string; - length?: number; - shasum?: string; - version?: string; -} - -interface GenericBody { - [key: string]: string; -} - -interface UpLinkMetadata { - etag: string; - fetched: number; -} - -interface UpLinks { - [key: string]: UpLinkMetadata; -} - -interface Tags { - [key: string]: Version; -} - -interface Headers { - [key: string]: string; -} - -interface PackageUsers { - [key: string]: boolean; -} - -interface Package { - _id?: string; - name: string; - versions: Versions; - 'dist-tags': GenericBody; - time?: GenericBody; - readme?: string; - users?: PackageUsers; - _distfiles: DistFiles; - _attachments: AttachMents; - _uplinks: UpLinks; - _rev: string; -} - -interface IUploadTarball extends PassThrough { - abort(): void; - done(): void; -} - -interface IReadTarball extends PassThrough { - abort(): void; -} - -interface UpLinkTokenConf { - type: 'Bearer' | 'Basic'; - token?: string; - token_env?: boolean | string; -} - -interface UpLinkConf { - url: string; - ca?: string; - cache?: boolean; - timeout?: string | void; - maxage?: string | void; - max_fails?: number | void; - fail_timeout?: string | void; - headers?: Headers; - auth?: UpLinkTokenConf; - strict_ssl?: boolean | void; - _autogenerated?: boolean; -} - -interface AuthPluginPackage { - packageName: string; - packageVersion?: string; - tag?: string; -} - -interface PackageAccess { - storage?: string; - publish?: string[]; - proxy?: string[]; - access?: string[]; -} - -interface PackageList { - [key: string]: PackageAccess; -} - -interface UpLinksConfList { - [key: string]: UpLinkConf; -} - -type LoggerType = 'stdout' | 'stderr' | 'file'; -type LoggerFormat = 'pretty' | 'pretty-timestamped' | 'file'; -type LoggerLevel = 'http' | 'fatal' | 'warn' | 'info' | 'debug' | 'trace'; - -interface LoggerConfItem { - type: LoggerType; - format: LoggerFormat; - level: LoggerLevel; -} - -interface PublishOptions { - allow_offline: boolean; -} - -type AuthConf = any | AuthHtpasswd; - -interface AuthHtpasswd { - file: string; - max_users: number; -} - -interface Notifications { - method: string; - packagePattern: RegExp; - packagePatternFlags: string; - endpoint: string; - content: string; - headers: Headers; -} - -interface ConfigFile { - storage: string; - plugins: string; - self_path: string; - packages: PackageList; - uplinks: UpLinksConfList; - logs: LoggerConf[]; - web: WebConf; - auth: AuthConf; - publish?: PublishOptions; - url_prefix?: string; - listen?: ListenAddress; - https?: HttpsConf; - http_proxy?: string; - https_proxy?: string; - no_proxy?: string; - max_body_size?: string; - notifications: Notifications; -} - -interface Token { - user: string; - token: string; - key: string; - cidr?: string[]; - readonly: boolean; - created: number | string; - updated?: number | string; -} - -interface TokenFilter { - user: string; -} - -type SyncReturn = Error | void; -type IPackageStorage = ILocalPackageManager | void; -type IPackageStorageManager = ILocalPackageManager; -type IPluginStorage = ILocalData; - -interface AuthHtpasswd { - file: string; - max_users: number; -} - -interface ILocalStorage { - add(name: string): void; - remove(name: string): void; - get(): StorageList; - sync(): void; -} - -interface LoggerConf { - [key: string]: LoggerConfItem; -} - -interface ListenAddress { - [key: string]: string; -} - -interface WebConf { - enable?: boolean; - title?: string; - logo?: string; - favicon?: string; - gravatar?: boolean; - sort_packages?: string; -} - -interface HttpsConfKeyCert { - key: string; - cert: string; - ca?: string; -} - -interface HttpsConfPfx { - pfx: string; - passphrase?: string; -} - -type HttpsConf = HttpsConfKeyCert | HttpsConfPfx; - -interface JWTOptions { - sign: JWTSignOptions; - verify: JWTVerifyOptions; -} - -interface JWTVerifyOptions { - algorithm?: string; - expiresIn?: string; - notBefore?: string | number; - ignoreExpiration?: boolean; - maxAge?: string | number; - clockTimestamp?: number; -} - -interface JWTSignOptions { - algorithm?: string; - expiresIn?: string; - notBefore?: string; - ignoreExpiration?: boolean; - maxAge?: string | number; - clockTimestamp?: number; -} - -interface APITokenOptions { - legacy: boolean; - jwt?: JWTOptions; -} - -interface Security { - web: JWTOptions; - api: APITokenOptions; -} - -interface Config { - user_agent: string; - server_id: any; - _debug?: boolean; - storage?: string | void; - plugins?: string | void; - secret: string; - self_path: string; - packages: PackageList; - uplinks: UpLinksConfList; - logs?: LoggerConf[]; - web?: WebConf; - auth?: AuthConf; - security: Security; - publish?: PublishOptions; - url_prefix?: string; - store?: any; - listen?: ListenAddress; - https?: HttpsConf; - http_proxy?: string; - https_proxy?: string; - no_proxy?: string; - max_body_size?: string; - notifications?: Notifications; - middlewares?: any; - filters?: any; - checkSecretKey(token: string): string; - getMatchedPackagesSpec(storage: string): PackageAccess | void; - [key: string]: any; -} - -interface ConfigWithHttps extends Config { - https: HttpsConf; -} - -interface ITokenActions { - saveToken(token: Token): Promise; - deleteToken(user: string, tokenKey: string): Promise; - readTokens(filter: TokenFilter): Promise; -} - -/** - * This method expect return a Package object - * eg: - * { - * name: string; - * time: number; - * ... and other props - * } - * - * The `cb` callback object will be executed if: - * - it might return object (truly) - * - it might reutrn null - */ -type onSearchPackage = (item: Package, cb: CallbackAction) => void; -// FIXME: error should be export type `VerdaccioError = HttpError & { code: number };` -// but this type is on @verdaccio/commons-api and cannot be used here yet -type onEndSearchPackage = (error?: any) => void; -type onValidatePackage = (name: string) => boolean; - -interface ILocalData extends IPlugin, ITokenActions { - logger: Logger; - config: T & Config; - add(name: string, callback: Callback): void; - remove(name: string, callback: Callback): void; - get(callback: Callback): void; - getSecret(): Promise; - setSecret(secret: string): Promise; - getPackageStorage(packageInfo: string): IPackageStorage; - search(onPackage: onSearchPackage, onEnd: onEndSearchPackage, validateName: onValidatePackage): void; -} - -type StorageUpdateCallback = (data: Package, cb: CallbackAction) => void; -type StorageUpdateHandler = (name: string, cb: StorageUpdateCallback) => void; -type StorageWriteCallback = (name: string, json: Package, callback: Callback) => void; -type PackageTransformer = (pkg: Package) => Package; -type ReadPackageCallback = (err: any | null, data?: Package) => void; - -interface ILocalPackageManager { - logger: Logger; - writeTarball(pkgName: string): IUploadTarball; - readTarball(pkgName: string): IReadTarball; - readPackage(fileName: string, callback: ReadPackageCallback): void; - createPackage(pkgName: string, value: Package, cb: CallbackAction): void; - deletePackage(fileName: string, callback: CallbackAction): void; - removePackage(callback: CallbackAction): void; - updatePackage( - pkgFileName: string, - updateHandler: StorageUpdateCallback, - onWrite: StorageWriteCallback, - transformPackage: PackageTransformer, - onEnd: CallbackAction - ): void; - savePackage(fileName: string, json: Package, callback: CallbackAction): void; -} - -interface TarballActions { - addTarball(name: string, filename: string): IUploadTarball; - getTarball(name: string, filename: string): IReadTarball; - removeTarball(name: string, filename: string, revision: string, callback: Callback): void; -} - -interface StoragePackageActions extends TarballActions { - addVersion(name: string, version: string, metadata: Version, tag: StringValue, callback: Callback): void; - mergeTags(name: string, tags: MergeTags, callback: Callback): void; - removePackage(name: string, callback: Callback): void; - changePackage(name: string, metadata: Package, revision: string, callback: Callback): void; -} - -interface IStorageManager extends StoragePackageActions { - config: T & Config; - logger: Logger; - init(config: T & Config, filters: any): Promise; - addPackage(name: string, metadata: any, callback: Callback): Promise; - getPackage(options: any): void; - search(startkey: string, options: any): IReadTarball; - getLocalDatabase(callback: Callback): void; -} - -interface IBasicStorage extends StoragePackageActions { - addPackage(name: string, info: Package, callback: Callback): void; - updateVersions(name: string, packageInfo: Package, callback: Callback): void; - getPackageMetadata(name: string, callback: Callback): void; - search(startKey: string, options: any): IReadTarball; - getSecret(config: T & Config): Promise; -} - -interface IBasicAuth { - config: T & Config; - aesEncrypt(buf: Buffer): Buffer; - authenticate(user: string, password: string, cb: Callback): void; - changePassword(user: string, password: string, newPassword: string, cb: Callback): void; - allow_access(pkg: AuthPluginPackage, user: RemoteUser, callback: Callback): void; - add_user(user: string, password: string, cb: Callback): any; -} - -export interface Plugin { - new (config: T, options: PluginOptions): T; -} - -interface IPlugin { - version?: string; - // In case a plugin needs to be cleaned up/removed - close?(): void; -} - -interface PluginOptions { - config: T & Config; - logger: Logger; -} - -interface AllowAccess { - name: string; - version?: string; - tag?: string; -} - -// FIXME: error should be export type `VerdaccioError = HttpError & { code: number };` instead of AuthError -// but this type is on @verdaccio/commons-api and cannot be used here yet (I don't know why) -interface HttpError extends Error { - status: number; - statusCode: number; - expose: boolean; - headers?: { - [key: string]: string; - }; - [key: string]: any; -} - -type AuthError = HttpError & { code: number }; -type AuthAccessCallback = (error: AuthError | null, access: boolean) => void; -type AuthCallback = (error: AuthError | null, groups: string[] | false) => void; - -interface IPluginAuth extends IPlugin { - authenticate(user: string, password: string, cb: AuthCallback): void; - adduser?(user: string, password: string, cb: AuthCallback): void; - changePassword?(user: string, password: string, newPassword: string, cb: AuthCallback): void; - allow_publish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void; - allow_access?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void; - allow_unpublish?(user: RemoteUser, pkg: T & PackageAccess, cb: AuthAccessCallback): void; - allow_publish?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AuthAccessCallback): void; - allow_access?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AuthAccessCallback): void; - allow_unpublish?(user: RemoteUser, pkg: AllowAccess & PackageAccess, cb: AuthAccessCallback): void; - apiJWTmiddleware?(helpers: any): Function; -} - -interface IPluginMiddleware extends IPlugin { - register_middlewares(app: any, auth: IBasicAuth, storage: IStorageManager): void; -} - -interface IPluginStorageFilter extends IPlugin { - filter_metadata(packageInfo: Package): Promise; -} diff --git a/packages/core/types/tsconfig.json b/packages/core/types/tsconfig.json deleted file mode 100644 index 537522270..000000000 --- a/packages/core/types/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../../tsconfig", - "compilerOptions": { - "rootDir": "./src", - "outDir": "./build" - }, - "include": ["src/**/*"], - "exclude": ["src/**/*.test.ts"] -} diff --git a/packages/hooks/package.json b/packages/hooks/package.json index 19aec236c..715442891 100644 --- a/packages/hooks/package.json +++ b/packages/hooks/package.json @@ -18,7 +18,8 @@ "@verdaccio/commons-api": "workspace:*", "@verdaccio/logger": "5.0.0-alpha.0", "handlebars": "4.5.3", - "request": "2.87.0" + "request": "2.87.0", + "lodash": "^4.17.20" }, "devDependencies": { "@verdaccio/auth": "5.0.0-alpha.0", @@ -26,7 +27,7 @@ "@verdaccio/utils": "5.0.0-alpha.0", "@verdaccio/dev-commons": "5.0.0-alpha.0", "@verdaccio/dev-types": "5.0.0-alpha.0", - "@verdaccio/types": "9.5.0" + "@verdaccio/types": "workspace:*" }, "scripts": { "clean": "rimraf ./build", diff --git a/packages/loaders/package.json b/packages/loaders/package.json index 5d6bf9c02..106d7333b 100644 --- a/packages/loaders/package.json +++ b/packages/loaders/package.json @@ -15,14 +15,15 @@ "dependencies": { "@verdaccio/dev-commons": "workspace:5.0.0-alpha.0", "@verdaccio/logger": "workspace:5.0.0-alpha.0", - "lodash": "4.17.15" + "lodash": "4.17.15", + "debug": "^4.1.1" }, "devDependencies": { "@verdaccio/mock": "workspace:5.0.0-alpha.0", "@verdaccio/dev-types": "workspace:5.0.0-alpha.0", "@verdaccio/config": "workspace:5.0.0-alpha.0", "@verdaccio/commons-api": "workspace:*", - "@verdaccio/types": "9.5.0" + "@verdaccio/types": "workspace:*" }, "homepage": "https://verdaccio.org", "license": "MIT", diff --git a/packages/loaders/src/plugin-loader.ts b/packages/loaders/src/plugin-loader.ts index c833c926c..23bc50f9c 100644 --- a/packages/loaders/src/plugin-loader.ts +++ b/packages/loaders/src/plugin-loader.ts @@ -1,9 +1,13 @@ import Path from 'path'; import _ from 'lodash'; +import buildDebug from 'debug'; + import { logger } from '@verdaccio/logger'; import { Config, IPlugin } from '@verdaccio/types'; import { MODULE_NOT_FOUND } from '@verdaccio/dev-commons'; +const debug = buildDebug('verdaccio:plugin:loader'); + /** * Requires a module. * @param {*} path the module's path @@ -114,7 +118,7 @@ export function loadPlugin>(config: Config, pluginConfigs: throw Error(`sanity check has failed, "${pluginId}" is not a valid plugin`); } - logger.warn({ content: pluginId, prefix }, 'Plugin successfully loaded: @{prefix}-@{content}'); + debug('Plugin successfully loaded: %o-%o', pluginId, prefix); return plugin; } ); diff --git a/packages/logger/package.json b/packages/logger/package.json index 18c38a6a8..17f1abe4c 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -28,7 +28,7 @@ }, "devDependencies": { "@types/pino": "5.20.0", - "@verdaccio/types": "9.5.0" + "@verdaccio/types": "workspace:*" }, "gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982" } diff --git a/packages/logger/src/logger.ts b/packages/logger/src/logger.ts index 6a9a5fa73..b180c4470 100644 --- a/packages/logger/src/logger.ts +++ b/packages/logger/src/logger.ts @@ -37,6 +37,8 @@ export function createLogger(options = {}, destination = pino.destination(1), fo if (format === DEFAULT_LOG_FORMAT || format !== 'json') { pinoConfig = Object.assign({}, pinoConfig, { + // FIXME: this property cannot be used in combination with pino.final + // https://github.com/pinojs/pino-pretty/issues/37 prettyPrint: { levelFirst: true, prettyStamp: format === 'pretty-timestamped', diff --git a/packages/mock/package.json b/packages/mock/package.json index 15dedd9a3..c266d3231 100644 --- a/packages/mock/package.json +++ b/packages/mock/package.json @@ -33,7 +33,7 @@ }, "devDependencies": { "@verdaccio/dev-types": "5.0.0-alpha.0", - "@verdaccio/types": "^9.3.0" + "@verdaccio/types": "workspace:*" }, "gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982" } diff --git a/packages/node-api/package.json b/packages/node-api/package.json index 316933615..4cb7c58c1 100644 --- a/packages/node-api/package.json +++ b/packages/node-api/package.json @@ -27,11 +27,12 @@ "@verdaccio/logger": "5.0.0-alpha.0", "@verdaccio/server": "5.0.0-alpha.0", "@verdaccio/utils": "5.0.0-alpha.0", - "selfsigned": "1.10.7" + "selfsigned": "1.10.7", + "lodash": "^4.17.20" }, "devDependencies": { "@verdaccio/mock": "5.0.0-alpha.0", - "@verdaccio/types": "9.7.0" + "@verdaccio/types": "workspace:*" }, "publishConfig": { "access": "public" diff --git a/packages/proxy/package.json b/packages/proxy/package.json index 7b320d0da..a57869d2a 100644 --- a/packages/proxy/package.json +++ b/packages/proxy/package.json @@ -29,11 +29,12 @@ "@verdaccio/streams": "workspace:*", "@verdaccio/utils": "5.0.0-alpha.0", "JSONStream": "1.3.5", - "request": "2.87.0" + "request": "2.87.0", + "lodash": "^4.17.20" }, "devDependencies": { "@verdaccio/dev-types": "5.0.0-alpha.0", - "@verdaccio/types": "9.5.0" + "@verdaccio/types": "workspace:*" }, "gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982" } diff --git a/packages/proxy/src/up-storage.ts b/packages/proxy/src/up-storage.ts index a21668fa0..f1ed30f76 100644 --- a/packages/proxy/src/up-storage.ts +++ b/packages/proxy/src/up-storage.ts @@ -47,7 +47,8 @@ class ProxyStorage implements IProxy { public upname: string; // FIXME: proxy can be boolean or object, something smells here // @ts-ignore - public proxy: string | void; + // any due this https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#operands-for-delete-must-be-optional + public proxy: any; // @ts-ignore public last_request_time: number | null; public strict_ssl: boolean; diff --git a/packages/store/package.json b/packages/store/package.json index 0b228b9ab..61958c19d 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -24,9 +24,9 @@ }, "dependencies": { "@verdaccio/commons-api": "workspace:*", - "@verdaccio/dev-commons": "5.0.0-alpha.0", + "@verdaccio/dev-commons": "workspace:5.0.0-alpha.0", "@verdaccio/loaders": "5.0.0-alpha.0", - "@verdaccio/local-storage": "9.6.1", + "@verdaccio/local-storage": "workspace:*", "@verdaccio/logger": "5.0.0-alpha.0", "@verdaccio/proxy": "5.0.0-alpha.0", "@verdaccio/streams": "workspace:*", @@ -41,7 +41,7 @@ "@verdaccio/config": "5.0.0-alpha.0", "@verdaccio/mock": "5.0.0-alpha.0", "@verdaccio/dev-types": "5.0.0-alpha.0", - "@verdaccio/types": "9.5.0" + "@verdaccio/types": "workspace:*" }, "gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982" } diff --git a/packages/store/src/local-storage.ts b/packages/store/src/local-storage.ts index 36362a4ac..be6585f00 100644 --- a/packages/store/src/local-storage.ts +++ b/packages/store/src/local-storage.ts @@ -214,7 +214,7 @@ class LocalStorage implements IStorage { } if (change) { - this.logger.debug({ name }, 'updating package @{name} info'); + debug('updating package info %o', name); this._writePackage(name, packageLocalJson, function (err): void { callback(err, packageLocalJson); }); @@ -805,7 +805,7 @@ class LocalStorage implements IStorage { } private _deleteAttachments(storage: any, attachments: string[], callback: Callback): void { - this.logger.debug({ l: attachments.length }, `[storage/_deleteAttachments] delete attachments total: @{l}`); + debug('deleting %o attachments total %o', attachments?.length); const unlinkNext = function (cb): void { if (_.isEmpty(attachments)) { return cb(); diff --git a/packages/store/src/storage-utils.ts b/packages/store/src/storage-utils.ts index 50d6dbbd8..276f4ab77 100644 --- a/packages/store/src/storage-utils.ts +++ b/packages/store/src/storage-utils.ts @@ -1,6 +1,6 @@ import _ from 'lodash'; -import { ErrorCode, isObject, normalizeDistTags, semverSort, generateRandomHexString } from '@verdaccio/utils'; +import { ErrorCode, isObject, normalizeDistTags, semverSort, generateRandomHexString, isNil } from '@verdaccio/utils'; import { Package, Version, Author } from '@verdaccio/types'; import { IStorage } from '@verdaccio/dev-types'; @@ -32,7 +32,7 @@ export function normalizePackage(pkg: Package): Package { pkgProperties.forEach((key): void => { const pkgProp = pkg[key]; - if (_.isNil(pkgProp) || isObject(pkgProp) === false) { + if (isNil(pkgProp) || isObject(pkgProp) === false) { pkg[key] = {}; } }); @@ -79,8 +79,10 @@ export function getLatestReadme(pkg: Package): string { return readme; } -export function cleanUpReadme(version: Version): Version { - if (_.isNil(version) === false) { +// FIXME: type any due this +export function cleanUpReadme(version: any): Version { + if (isNil(version) === false) { + // https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#operands-for-delete-must-be-optional delete version.readme; } @@ -88,7 +90,7 @@ export function cleanUpReadme(version: Version): Version { } export function normalizeContributors(contributors: Author[]): Author[] { - if (_.isNil(contributors)) { + if (isNil(contributors)) { return []; } else if (contributors && _.isArray(contributors) === false) { // FIXME: this branch is clearly no an array, still tsc complains @@ -131,7 +133,7 @@ export function cleanUpLinksRef(keepUpLinkData: boolean, result: Package): Packa export function checkPackageLocal(name: string, localStorage: IStorage): Promise { return new Promise((resolve, reject): void => { localStorage.getPackageMetadata(name, (err, results): void => { - if (!_.isNil(err) && err.status !== HTTP_STATUS.NOT_FOUND) { + if (!isNil(err) && err.status !== HTTP_STATUS.NOT_FOUND) { return reject(err); } if (results) { @@ -164,14 +166,14 @@ export function checkPackageRemote(name: string, isAllowPublishOffline: boolean, } // checking package exist already - if (_.isNil(packageJsonLocal) === false) { + if (isNil(packageJsonLocal) === false) { return reject(ErrorCode.getConflict(API_ERROR.PACKAGE_EXIST)); } for (let errorItem = 0; errorItem < upLinksErrors.length; errorItem++) { // checking error // if uplink fails with a status other than 404, we report failure - if (_.isNil(upLinksErrors[errorItem][0]) === false) { + if (isNil(upLinksErrors[errorItem][0]) === false) { if (upLinksErrors[errorItem][0].status !== HTTP_STATUS.NOT_FOUND) { if (isAllowPublishOffline) { return resolve(); diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index d7b4ff7d5..edccf970b 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -3,3 +3,4 @@ export * from './string'; export * from './utils'; export * from './crypto-utils'; export * from './config-utils'; +export * from './replace-lodash'; diff --git a/packages/utils/src/replace-lodash.ts b/packages/utils/src/replace-lodash.ts new file mode 100644 index 000000000..b8bbaf8e2 --- /dev/null +++ b/packages/utils/src/replace-lodash.ts @@ -0,0 +1,7 @@ +export function isNil(value: any): boolean { + return value == null; +} + +export function isFunction(value): boolean { + return typeof value === 'function'; +} diff --git a/packages/utils/src/utils.ts b/packages/utils/src/utils.ts index 8f8c894bc..8c0046c00 100644 --- a/packages/utils/src/utils.ts +++ b/packages/utils/src/utils.ts @@ -25,9 +25,6 @@ import { getCode, } from '@verdaccio/commons-api'; -// eslint-disable-next-line @typescript-eslint/no-unused-vars -// eslint-disable-next-line @typescript-eslint/no-var-requires - // FIXME: this is fixed, should pick the package.json or official version const pkgVersion = '5.0.0'; const pkgName = 'verdaccio'; diff --git a/packages/verdaccio/package.json b/packages/verdaccio/package.json index c3e56c375..3ae5c4159 100644 --- a/packages/verdaccio/package.json +++ b/packages/verdaccio/package.json @@ -37,12 +37,14 @@ }, "homepage": "https://verdaccio.org", "dependencies": { - "@verdaccio/hooks": "5.0.0-alpha.0", - "@verdaccio/utils": "5.0.0-alpha.0", - "@verdaccio/logger": "5.0.0-alpha.0", - "@verdaccio/mock": "5.0.0-alpha.0", - "@verdaccio/node-api": "5.0.0-alpha.0", - "@verdaccio/cli": "5.0.0-alpha.0" + "@verdaccio/hooks": "workspace:5.0.0-alpha.0", + "@verdaccio/utils": "workspace:5.0.0-alpha.0", + "@verdaccio/logger": "workspace:5.0.0-alpha.0", + "@verdaccio/mock": "workspace:5.0.0-alpha.0", + "@verdaccio/node-api": "workspace:5.0.0-alpha.0", + "@verdaccio/cli": "workspace:5.0.0-alpha.0", + "verdaccio-htpasswd": "9.7.2", + "@verdaccio/ui-theme": "^1.12.1" }, "devDependencies": { "@verdaccio/dev-commons": "workspace:*" diff --git a/packages/web/package.json b/packages/web/package.json index fecf79ee8..0eb3344aa 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -6,20 +6,22 @@ "types": "build/index.d.ts", "license": "MIT", "dependencies": { - "@verdaccio/logger": "5.0.0-alpha.0", - "@verdaccio/auth": "5.0.0-alpha.0", - "@verdaccio/dev-commons": "5.0.0-alpha.0", - "@verdaccio/loaders": "5.0.0-alpha.0", - "@verdaccio/middleware": "5.0.0-alpha.0", - "@verdaccio/store": "5.0.0-alpha.0", - "@verdaccio/utils": "5.0.0-alpha.0", + "@verdaccio/logger": "workspace:5.0.0-alpha.0", + "@verdaccio/auth": "workspace:5.0.0-alpha.0", + "@verdaccio/dev-commons": "workspace:5.0.0-alpha.0", + "@verdaccio/loaders": "workspace:5.0.0-alpha.0", + "@verdaccio/middleware": "workspace:5.0.0-alpha.0", + "@verdaccio/store": "workspace:5.0.0-alpha.0", + "@verdaccio/utils": "workspace:5.0.0-alpha.0", "body-parse": "0.1.0", "body-parser": "1.19.0", - "express": "4.17.1" + "lodash": "^4.17.20", + "express": "4.17.1", + "debug": "^4.1.1" }, "devDependencies": { "@verdaccio/dev-types": "5.0.0-alpha.0", - "@verdaccio/types": "9.5.0" + "@verdaccio/types": "workspace:*" }, "scripts": { "clean": "rimraf ./build", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index aabbe1eb0..5404d51dd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -39,9 +39,10 @@ importers: '@types/request': 2.48.3 '@types/semver': 7.2.0 '@types/supertest': 2.0.9 - '@typescript-eslint/eslint-plugin': 3.9.1_c966759c017b8c3f0ae352c464ebe3fe - '@typescript-eslint/parser': 3.9.1_eslint@7.5.0+typescript@3.9.7 - '@verdaccio/types': 9.5.0 + '@typescript-eslint/eslint-plugin': 3.9.1_7a4012260ecd1e35a222c3ff19f9f0fa + '@typescript-eslint/parser': 3.9.1_eslint@7.5.0+typescript@4.0.2 + '@verdaccio/types': 'link:packages/core/types' + '@verdaccio/ui-theme': 1.12.1 babel-core: 7.0.0-bridge.0_@babel+core@7.10.5 babel-eslint: 10.1.0_eslint@7.5.0 babel-jest: 26.1.0_@babel+core@7.10.5 @@ -55,7 +56,7 @@ importers: eslint-config-prettier: 6.10.0_eslint@7.5.0 eslint-plugin-babel: 5.3.0_eslint@7.5.0 eslint-plugin-import: 2.22.0_eslint@7.5.0 - eslint-plugin-jest: 23.8.0_eslint@7.5.0+typescript@3.9.7 + eslint-plugin-jest: 23.8.0_eslint@7.5.0+typescript@4.0.2 eslint-plugin-jsx-a11y: 6.3.1_eslint@7.5.0 eslint-plugin-prettier: 3.1.2_eslint@7.5.0+prettier@2.0.5 eslint-plugin-react: 7.20.5_eslint@7.5.0 @@ -77,10 +78,12 @@ importers: selfsigned: 1.10.7 standard-version: 8.0.0 supertest: 4.0.2 - typescript: 3.9.7 - verdaccio: 4.7.1 - verdaccio-auth-memory: 9.7.0 - verdaccio-memory: 9.7.0 + typescript: 4.0.2 + verdaccio: 4.8.1 + verdaccio-audit: 9.7.3 + verdaccio-auth-memory: 9.7.2 + verdaccio-htpasswd: 9.7.2 + verdaccio-memory: 9.7.2 specifiers: '@babel/cli': 7.10.5 '@babel/core': 7.10.5 @@ -122,7 +125,8 @@ importers: '@types/supertest': 2.0.9 '@typescript-eslint/eslint-plugin': ^3.9.1 '@typescript-eslint/parser': ^3.9.1 - '@verdaccio/types': 9.5.0 + '@verdaccio/types': 'workspace:*' + '@verdaccio/ui-theme': latest babel-core: 7.0.0-bridge.0 babel-eslint: 10.1.0 babel-jest: 26.1.0 @@ -158,10 +162,12 @@ importers: selfsigned: 1.10.7 standard-version: 8.0.0 supertest: 4.0.2 - typescript: 3.9.7 - verdaccio: 4.7.1 - verdaccio-auth-memory: 9.7.0 - verdaccio-memory: 9.7.0 + typescript: 4.0.2 + verdaccio: latest + verdaccio-audit: latest + verdaccio-auth-memory: latest + verdaccio-htpasswd: latest + verdaccio-memory: latest packages/api: dependencies: '@verdaccio/auth': 'link:../auth' @@ -175,13 +181,14 @@ importers: cookies: 0.8.0 debug: 4.1.1 express: 4.17.1 - lodash: 4.17.15 + lodash: 4.17.20 mime: 2.4.4 + semver: 7.3.2 devDependencies: '@verdaccio/config': 'link:../config' '@verdaccio/dev-types': 'link:../types' '@verdaccio/server': 'link:../server' - '@verdaccio/types': 9.5.0 + '@verdaccio/types': 'link:../core/types' body-parser: 1.19.0 supertest: 5.0.0-0 specifiers: @@ -195,14 +202,15 @@ importers: '@verdaccio/middleware': 5.0.0-alpha.0 '@verdaccio/server': 5.0.0-alpha.0 '@verdaccio/store': 5.0.0-alpha.0 - '@verdaccio/types': 9.5.0 + '@verdaccio/types': 'workspace:*' '@verdaccio/utils': 5.0.0-alpha.0 body-parser: 1.19.0 cookies: 0.8.0 debug: ^4.1.1 express: 4.17.1 - lodash: 4.17.15 + lodash: ^4.17.15 mime: 2.4.4 + semver: 7.3.2 supertest: next packages/auth: dependencies: @@ -211,13 +219,14 @@ importers: '@verdaccio/loaders': 'link:../loaders' '@verdaccio/logger': 'link:../logger' '@verdaccio/utils': 'link:../utils' + debug: 4.1.1 express: 4.17.1 lodash: 4.17.15 devDependencies: '@verdaccio/config': 'link:../config' '@verdaccio/dev-types': 'link:../types' '@verdaccio/mock': 'link:../mock' - '@verdaccio/types': 9.5.0 + '@verdaccio/types': 'link:../core/types' specifiers: '@verdaccio/commons-api': 'workspace:*' '@verdaccio/config': 'workspace:5.0.0-alpha.0' @@ -226,8 +235,9 @@ importers: '@verdaccio/loaders': 5.0.0-alpha.0 '@verdaccio/logger': 5.0.0-alpha.0 '@verdaccio/mock': 'workspace:5.0.0-alpha.0' - '@verdaccio/types': 9.5.0 + '@verdaccio/types': 'workspace:*' '@verdaccio/utils': 5.0.0-alpha.0 + debug: ^4.1.1 express: 4.17.1 lodash: 4.17.15 packages/cli: @@ -239,6 +249,7 @@ importers: commander: 5.1.0 envinfo: 7.4.0 kleur: 3.0.3 + lodash: 4.17.20 semver: 7.3.2 specifiers: '@verdaccio/config': 5.0.0-alpha.0 @@ -248,14 +259,19 @@ importers: commander: 5.1.0 envinfo: 7.4.0 kleur: 3.0.3 + lodash: ^4.17.20 semver: 7.3.2 packages/commons: - specifiers: {} + devDependencies: + '@verdaccio/types': 'link:../core/types' + specifiers: + '@verdaccio/types': 'workspace:10.0.0-beta' packages/config: dependencies: '@verdaccio/dev-commons': 'link:../commons' '@verdaccio/logger': 'link:../logger' '@verdaccio/utils': 'link:../utils' + lodash: 4.17.20 mkdirp: 0.5.5 devDependencies: '@verdaccio/dev-types': 'link:../types' @@ -264,6 +280,7 @@ importers: '@verdaccio/dev-types': 'workspace:5.0.0-alpha.0' '@verdaccio/logger': 'workspace:5.0.0-alpha.0' '@verdaccio/utils': 'workspace:5.0.0-alpha.0' + lodash: ^4.17.20 mkdirp: 0.5.5 packages/core/commons-api: dependencies: @@ -304,6 +321,7 @@ importers: '@verdaccio/file-locking': 'link:../file-locking' '@verdaccio/streams': 'link:../streams' async: 3.2.0 + debug: 4.1.1 level: 5.0.1 lodash: 4.17.19 mkdirp: 0.5.5 @@ -319,6 +337,7 @@ importers: '@verdaccio/streams': 'workspace:*' '@verdaccio/types': 'workspace:*' async: ^3.2.0 + debug: ^4.1.1 level: 5.0.1 lodash: ^4.17.19 minimatch: ^3.0.4 @@ -342,19 +361,23 @@ importers: specifiers: '@verdaccio/types': ^9.7.2 packages/core/types: - specifiers: {} + devDependencies: + '@types/node': 14.6.0 + specifiers: + '@types/node': 14.6.0 packages/hooks: dependencies: '@verdaccio/commons-api': 'link:../core/commons-api' '@verdaccio/logger': 'link:../logger' handlebars: 4.5.3 + lodash: 4.17.20 request: 2.87.0 devDependencies: '@verdaccio/auth': 'link:../auth' '@verdaccio/config': 'link:../config' '@verdaccio/dev-commons': 'link:../commons' '@verdaccio/dev-types': 'link:../types' - '@verdaccio/types': 9.5.0 + '@verdaccio/types': 'link:../core/types' '@verdaccio/utils': 'link:../utils' specifiers: '@verdaccio/auth': 5.0.0-alpha.0 @@ -363,21 +386,23 @@ importers: '@verdaccio/dev-commons': 5.0.0-alpha.0 '@verdaccio/dev-types': 5.0.0-alpha.0 '@verdaccio/logger': 5.0.0-alpha.0 - '@verdaccio/types': 9.5.0 + '@verdaccio/types': 'workspace:*' '@verdaccio/utils': 5.0.0-alpha.0 handlebars: 4.5.3 + lodash: ^4.17.20 request: 2.87.0 packages/loaders: dependencies: '@verdaccio/dev-commons': 'link:../commons' '@verdaccio/logger': 'link:../logger' + debug: 4.1.1 lodash: 4.17.15 devDependencies: '@verdaccio/commons-api': 'link:../core/commons-api' '@verdaccio/config': 'link:../config' '@verdaccio/dev-types': 'link:../types' '@verdaccio/mock': 'link:../mock' - '@verdaccio/types': 9.5.0 + '@verdaccio/types': 'link:../core/types' specifiers: '@verdaccio/commons-api': 'workspace:*' '@verdaccio/config': 'workspace:5.0.0-alpha.0' @@ -385,7 +410,8 @@ importers: '@verdaccio/dev-types': 'workspace:5.0.0-alpha.0' '@verdaccio/logger': 'workspace:5.0.0-alpha.0' '@verdaccio/mock': 'workspace:5.0.0-alpha.0' - '@verdaccio/types': 9.5.0 + '@verdaccio/types': 'workspace:*' + debug: ^4.1.1 lodash: 4.17.15 packages/logger: dependencies: @@ -394,11 +420,11 @@ importers: pino: 5.17.0 devDependencies: '@types/pino': 5.20.0 - '@verdaccio/types': 9.5.0 + '@verdaccio/types': 'link:../core/types' specifiers: '@types/pino': 5.20.0 '@verdaccio/logger-prettify': 5.0.0-alpha.0 - '@verdaccio/types': 9.5.0 + '@verdaccio/types': 'workspace:*' lodash: 4.17.15 pino: 5.17.0 packages/logger-prettify: @@ -456,11 +482,11 @@ importers: verdaccio: 4.7.1 devDependencies: '@verdaccio/dev-types': 'link:../types' - '@verdaccio/types': 9.7.0 + '@verdaccio/types': 'link:../core/types' specifiers: '@verdaccio/dev-commons': 5.0.0-alpha.0 '@verdaccio/dev-types': 5.0.0-alpha.0 - '@verdaccio/types': ^9.3.0 + '@verdaccio/types': 'workspace:*' '@verdaccio/utils': 5.0.0-alpha.0 fs-extra: ^8.1.0 lodash: ^4.17.15 @@ -473,17 +499,19 @@ importers: '@verdaccio/logger': 'link:../logger' '@verdaccio/server': 'link:../server' '@verdaccio/utils': 'link:../utils' + lodash: 4.17.20 selfsigned: 1.10.7 devDependencies: '@verdaccio/mock': 'link:../mock' - '@verdaccio/types': 9.7.0 + '@verdaccio/types': 'link:../core/types' specifiers: '@verdaccio/dev-commons': 5.0.0-alpha.0 '@verdaccio/logger': 5.0.0-alpha.0 '@verdaccio/mock': 5.0.0-alpha.0 '@verdaccio/server': 5.0.0-alpha.0 - '@verdaccio/types': 9.7.0 + '@verdaccio/types': 'workspace:*' '@verdaccio/utils': 5.0.0-alpha.0 + lodash: ^4.17.20 selfsigned: 1.10.7 packages/proxy: dependencies: @@ -493,19 +521,21 @@ importers: '@verdaccio/streams': 'link:../core/streams' '@verdaccio/utils': 'link:../utils' JSONStream: 1.3.5 + lodash: 4.17.20 request: 2.87.0 devDependencies: '@verdaccio/dev-types': 'link:../types' - '@verdaccio/types': 9.5.0 + '@verdaccio/types': 'link:../core/types' specifiers: '@verdaccio/dev-commons': 5.0.0-alpha.0 '@verdaccio/dev-types': 5.0.0-alpha.0 '@verdaccio/local-storage': 'workspace:*' '@verdaccio/logger': 5.0.0-alpha.0 '@verdaccio/streams': 'workspace:*' - '@verdaccio/types': 9.5.0 + '@verdaccio/types': 'workspace:*' '@verdaccio/utils': 5.0.0-alpha.0 JSONStream: 1.3.5 + lodash: ^4.17.20 request: 2.87.0 packages/server: dependencies: @@ -558,7 +588,7 @@ importers: '@verdaccio/commons-api': 'link:../core/commons-api' '@verdaccio/dev-commons': 'link:../commons' '@verdaccio/loaders': 'link:../loaders' - '@verdaccio/local-storage': 9.6.1 + '@verdaccio/local-storage': 'link:../core/local-storage' '@verdaccio/logger': 'link:../logger' '@verdaccio/proxy': 'link:../proxy' '@verdaccio/streams': 'link:../core/streams' @@ -572,19 +602,19 @@ importers: '@verdaccio/config': 'link:../config' '@verdaccio/dev-types': 'link:../types' '@verdaccio/mock': 'link:../mock' - '@verdaccio/types': 9.5.0 + '@verdaccio/types': 'link:../core/types' specifiers: '@verdaccio/commons-api': 'workspace:*' '@verdaccio/config': 5.0.0-alpha.0 - '@verdaccio/dev-commons': 5.0.0-alpha.0 + '@verdaccio/dev-commons': 'workspace:5.0.0-alpha.0' '@verdaccio/dev-types': 5.0.0-alpha.0 '@verdaccio/loaders': 5.0.0-alpha.0 - '@verdaccio/local-storage': 9.6.1 + '@verdaccio/local-storage': 'workspace:*' '@verdaccio/logger': 5.0.0-alpha.0 '@verdaccio/mock': 5.0.0-alpha.0 '@verdaccio/proxy': 5.0.0-alpha.0 '@verdaccio/streams': 'workspace:*' - '@verdaccio/types': 9.5.0 + '@verdaccio/types': 'workspace:*' '@verdaccio/utils': 5.0.0-alpha.0 async: 3.1.1 debug: ^4.1.1 @@ -629,17 +659,21 @@ importers: '@verdaccio/logger': 'link:../logger' '@verdaccio/mock': 'link:../mock' '@verdaccio/node-api': 'link:../node-api' + '@verdaccio/ui-theme': 1.12.1 '@verdaccio/utils': 'link:../utils' + verdaccio-htpasswd: 9.7.2 devDependencies: '@verdaccio/dev-commons': 'link:../commons' specifiers: - '@verdaccio/cli': 5.0.0-alpha.0 + '@verdaccio/cli': 'workspace:5.0.0-alpha.0' '@verdaccio/dev-commons': 'workspace:*' - '@verdaccio/hooks': 5.0.0-alpha.0 - '@verdaccio/logger': 5.0.0-alpha.0 - '@verdaccio/mock': 5.0.0-alpha.0 - '@verdaccio/node-api': 5.0.0-alpha.0 - '@verdaccio/utils': 5.0.0-alpha.0 + '@verdaccio/hooks': 'workspace:5.0.0-alpha.0' + '@verdaccio/logger': 'workspace:5.0.0-alpha.0' + '@verdaccio/mock': 'workspace:5.0.0-alpha.0' + '@verdaccio/node-api': 'workspace:5.0.0-alpha.0' + '@verdaccio/ui-theme': ^1.12.1 + '@verdaccio/utils': 'workspace:5.0.0-alpha.0' + verdaccio-htpasswd: 9.7.2 packages/web: dependencies: '@verdaccio/auth': 'link:../auth' @@ -651,23 +685,27 @@ importers: '@verdaccio/utils': 'link:../utils' body-parse: 0.1.0 body-parser: 1.19.0 + debug: 4.1.1 express: 4.17.1 + lodash: 4.17.20 devDependencies: '@verdaccio/dev-types': 'link:../types' - '@verdaccio/types': 9.5.0 + '@verdaccio/types': 'link:../core/types' specifiers: - '@verdaccio/auth': 5.0.0-alpha.0 - '@verdaccio/dev-commons': 5.0.0-alpha.0 + '@verdaccio/auth': 'workspace:5.0.0-alpha.0' + '@verdaccio/dev-commons': 'workspace:5.0.0-alpha.0' '@verdaccio/dev-types': 5.0.0-alpha.0 - '@verdaccio/loaders': 5.0.0-alpha.0 - '@verdaccio/logger': 5.0.0-alpha.0 - '@verdaccio/middleware': 5.0.0-alpha.0 - '@verdaccio/store': 5.0.0-alpha.0 - '@verdaccio/types': 9.5.0 - '@verdaccio/utils': 5.0.0-alpha.0 + '@verdaccio/loaders': 'workspace:5.0.0-alpha.0' + '@verdaccio/logger': 'workspace:5.0.0-alpha.0' + '@verdaccio/middleware': 'workspace:5.0.0-alpha.0' + '@verdaccio/store': 'workspace:5.0.0-alpha.0' + '@verdaccio/types': 'workspace:*' + '@verdaccio/utils': 'workspace:5.0.0-alpha.0' body-parse: 0.1.0 body-parser: 1.19.0 + debug: ^4.1.1 express: 4.17.1 + lodash: ^4.17.20 lockfileVersion: 5.1 packages: /@babel/cli/7.10.5_@babel+core@7.10.5: @@ -734,6 +772,14 @@ packages: dev: true resolution: integrity: sha512-fEm3Uzw7Mc9Xi//qU20cBKatTfs2aOtKqmvy/Vm7RkJEGFQ4xc9myCfbXxqK//ZS8MR/ciOHw6meGASJuKmDfQ== + /@babel/generator/7.11.4: + dependencies: + '@babel/types': 7.11.0 + jsesc: 2.5.2 + source-map: 0.5.7 + dev: true + resolution: + integrity: sha512-Rn26vueFx0eOoz7iifCN2UHT6rGtnkSGWSoDRIy8jZN3B91PzeSULbswfLoOWuTuAcNwpG/mxy+uCTDnZ9Mp1g== /@babel/helper-annotate-as-pure/7.10.4: dependencies: '@babel/types': 7.11.0 @@ -966,6 +1012,13 @@ packages: hasBin: true resolution: integrity: sha512-Vuj/+7vLo6l1Vi7uuO+1ngCDNeVmNbTngcJFKCR/oEtz8tKz0CJxZEGmPt9KcIloZhOZ3Zit6xbpXT2MDlS9Vw== + /@babel/parser/7.11.4: + dev: true + engines: + node: '>=6.0.0' + hasBin: true + resolution: + integrity: sha512-MggwidiH+E9j5Sh8pbrX5sJvMcsqS5o+7iB42M9/k0CD63MjYbdP4nhSh7uB5wnv2/RVzTZFTxzF/kIa5mrCqA== /@babel/plugin-proposal-async-generator-functions/7.10.5_@babel+core@7.10.5: dependencies: '@babel/core': 7.10.5 @@ -1839,7 +1892,7 @@ packages: /@babel/template/7.10.4: dependencies: '@babel/code-frame': 7.10.4 - '@babel/parser': 7.11.2 + '@babel/parser': 7.11.4 '@babel/types': 7.11.0 dev: true resolution: @@ -1847,21 +1900,21 @@ packages: /@babel/traverse/7.11.0: dependencies: '@babel/code-frame': 7.10.4 - '@babel/generator': 7.11.0 + '@babel/generator': 7.11.4 '@babel/helper-function-name': 7.10.4 '@babel/helper-split-export-declaration': 7.11.0 - '@babel/parser': 7.11.2 + '@babel/parser': 7.11.4 '@babel/types': 7.11.0 debug: 4.1.1 globals: 11.12.0 - lodash: 4.17.19 + lodash: 4.17.20 dev: true resolution: integrity: sha512-ZB2V+LskoWKNpMq6E5UUCrjtDUh5IOTAyIl0dTjIEoXum/iKWkoIEKIRDnUucO6f+2FzNkE0oD4RLKoPIufDtg== /@babel/types/7.11.0: dependencies: '@babel/helper-validator-identifier': 7.10.4 - lodash: 4.17.19 + lodash: 4.17.20 to-fast-properties: 2.0.0 dev: true resolution: @@ -2528,6 +2581,10 @@ packages: dev: true resolution: integrity: sha512-syUgf67ZQpaJj01/tRTknkMNoBBLWJOBODF0Zm4NrXmiSuxjymFrxnTu1QVYRubhVkRcZLYZG8STTwJRdVm/WQ== + /@types/node/14.6.0: + dev: true + resolution: + integrity: sha512-mikldZQitV94akrc4sCcSjtJfsTKt4p+e/s0AGscVA6XArQ9kFclP+ZiYUMnq987rc6QlYxXv/EivqlfSLxpKA== /@types/normalize-package-data/2.4.0: dev: true resolution: @@ -2628,17 +2685,17 @@ packages: dev: true resolution: integrity: sha512-Dk/IDOPtOgubt/IaevIUbTgV7doaKkoorvOyYM2CMwuDyP89bekI7H4xLIwunNYiK9jhCkmc6pUrJk3cj2AB9w== - /@typescript-eslint/eslint-plugin/3.9.1_c966759c017b8c3f0ae352c464ebe3fe: + /@typescript-eslint/eslint-plugin/3.9.1_7a4012260ecd1e35a222c3ff19f9f0fa: dependencies: - '@typescript-eslint/experimental-utils': 3.9.1_eslint@7.5.0+typescript@3.9.7 - '@typescript-eslint/parser': 3.9.1_eslint@7.5.0+typescript@3.9.7 + '@typescript-eslint/experimental-utils': 3.9.1_eslint@7.5.0+typescript@4.0.2 + '@typescript-eslint/parser': 3.9.1_eslint@7.5.0+typescript@4.0.2 debug: 4.1.1 eslint: 7.5.0 functional-red-black-tree: 1.0.1 regexpp: 3.1.0 semver: 7.3.2 - tsutils: 3.17.1_typescript@3.9.7 - typescript: 3.9.7 + tsutils: 3.17.1_typescript@4.0.2 + typescript: 4.0.2 dev: true engines: node: ^10.12.0 || >=12.0.0 @@ -2651,10 +2708,10 @@ packages: optional: true resolution: integrity: sha512-XIr+Mfv7i4paEdBf0JFdIl9/tVxyj+rlilWIfZ97Be0lZ7hPvUbS5iHt9Glc8kRI53dsr0PcAEudbf8rO2wGgg== - /@typescript-eslint/experimental-utils/2.34.0_eslint@7.5.0+typescript@3.9.7: + /@typescript-eslint/experimental-utils/2.34.0_eslint@7.5.0+typescript@4.0.2: dependencies: '@types/json-schema': 7.0.5 - '@typescript-eslint/typescript-estree': 2.34.0_typescript@3.9.7 + '@typescript-eslint/typescript-estree': 2.34.0_typescript@4.0.2 eslint: 7.5.0 eslint-scope: 5.1.0 eslint-utils: 2.1.0 @@ -2666,11 +2723,11 @@ packages: typescript: '*' resolution: integrity: sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA== - /@typescript-eslint/experimental-utils/3.9.1_eslint@7.5.0+typescript@3.9.7: + /@typescript-eslint/experimental-utils/3.9.1_eslint@7.5.0+typescript@4.0.2: dependencies: '@types/json-schema': 7.0.5 '@typescript-eslint/types': 3.9.1 - '@typescript-eslint/typescript-estree': 3.9.1_typescript@3.9.7 + '@typescript-eslint/typescript-estree': 3.9.1_typescript@4.0.2 eslint: 7.5.0 eslint-scope: 5.1.0 eslint-utils: 2.1.0 @@ -2682,15 +2739,15 @@ packages: typescript: '*' resolution: integrity: sha512-lkiZ8iBBaYoyEKhCkkw4SAeatXyBq9Ece5bZXdLe1LWBUwTszGbmbiqmQbwWA8cSYDnjWXp9eDbXpf9Sn0hLAg== - /@typescript-eslint/parser/3.9.1_eslint@7.5.0+typescript@3.9.7: + /@typescript-eslint/parser/3.9.1_eslint@7.5.0+typescript@4.0.2: dependencies: '@types/eslint-visitor-keys': 1.0.0 - '@typescript-eslint/experimental-utils': 3.9.1_eslint@7.5.0+typescript@3.9.7 + '@typescript-eslint/experimental-utils': 3.9.1_eslint@7.5.0+typescript@4.0.2 '@typescript-eslint/types': 3.9.1 - '@typescript-eslint/typescript-estree': 3.9.1_typescript@3.9.7 + '@typescript-eslint/typescript-estree': 3.9.1_typescript@4.0.2 eslint: 7.5.0 eslint-visitor-keys: 1.3.0 - typescript: 3.9.7 + typescript: 4.0.2 dev: true engines: node: ^10.12.0 || >=12.0.0 @@ -2708,7 +2765,7 @@ packages: node: ^8.10.0 || ^10.13.0 || >=11.10.1 resolution: integrity: sha512-15JcTlNQE1BsYy5NBhctnEhEoctjXOjOK+Q+rk8ugC+WXU9rAcS2BYhoh6X4rOaXJEpIYDl+p7ix+A5U0BqPTw== - /@typescript-eslint/typescript-estree/2.34.0_typescript@3.9.7: + /@typescript-eslint/typescript-estree/2.34.0_typescript@4.0.2: dependencies: debug: 4.1.1 eslint-visitor-keys: 1.3.0 @@ -2716,8 +2773,8 @@ packages: is-glob: 4.0.1 lodash: 4.17.19 semver: 7.3.2 - tsutils: 3.17.1_typescript@3.9.7 - typescript: 3.9.7 + tsutils: 3.17.1_typescript@4.0.2 + typescript: 4.0.2 dev: true engines: node: ^8.10.0 || ^10.13.0 || >=11.10.1 @@ -2728,7 +2785,7 @@ packages: optional: true resolution: integrity: sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg== - /@typescript-eslint/typescript-estree/3.9.1_typescript@3.9.7: + /@typescript-eslint/typescript-estree/3.9.1_typescript@4.0.2: dependencies: '@typescript-eslint/types': 3.9.1 '@typescript-eslint/visitor-keys': 3.9.1 @@ -2737,8 +2794,8 @@ packages: is-glob: 4.0.1 lodash: 4.17.20 semver: 7.3.2 - tsutils: 3.17.1_typescript@3.9.7 - typescript: 3.9.7 + tsutils: 3.17.1_typescript@4.0.2 + typescript: 4.0.2 dev: true engines: node: ^10.12.0 || >=12.0.0 @@ -2770,6 +2827,7 @@ packages: dependencies: http-errors: 1.7.3 http-status-codes: 1.4.0 + dev: false engines: node: '>=8' resolution: @@ -2811,6 +2869,20 @@ packages: node: '>=8' resolution: integrity: sha512-ZyhvwAZ/7oVKSqAI9tK1Q7oyVomWVUMjLIQ8gLguwdbHFB10fvMpJt/d4Wbf+b1juGAFxrLmUP5SNT/0td3N4w== + /@verdaccio/local-storage/9.7.2: + dependencies: + '@verdaccio/commons-api': 9.7.1 + '@verdaccio/file-locking': 9.7.2 + '@verdaccio/streams': 9.7.2 + async: 3.2.0 + level: 5.0.1 + lodash: 4.17.19 + mkdirp: 0.5.5 + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-Lsn9TR1Jnkl0y7ndQQUi0ypvS9tHT4rqMiMebt2wsiy5mAlLrZ0sjw7erI7wE5sBi/L+uoq0HXfJwLjP8bfrBg== /@verdaccio/readme/8.5.2: dependencies: dompurify: 2.0.7 @@ -2824,8 +2896,17 @@ packages: dompurify: 2.0.8 jsdom: 15.2.1 marked: 0.7.0 + dev: false resolution: integrity: sha512-RD48djuQRfK5j0fNhj2zmmhMf7vICCPlhJAhsKaYOB0cNtK+51Z/HfAUf5yflkhcGE+4Cm6gaUfmfIlkRbR31A== + /@verdaccio/readme/9.7.3: + dependencies: + dompurify: 2.0.8 + jsdom: 15.2.1 + marked: 1.1.1 + dev: true + resolution: + integrity: sha512-86Zv46Qpcx0d0YRutFPhPH4OhGSljUJyhkxk3H/bCzzw8hGEvM1Du2y8kzfAS9qUsX8Qux97vfxxz6+RpBdU1w== /@verdaccio/streams/8.5.2: dev: true engines: @@ -2834,6 +2915,7 @@ packages: resolution: integrity: sha512-Rbw+vm/KHgy5OQB+jSxxIXYvVFmG/fuFmBeH7F4fp2r5h7w1TP/mlQZI7PVlPPhLZtM6Xdrzf6H+NRCwRncwIg== /@verdaccio/streams/9.6.1: + dev: false engines: node: '>=8' npm: '>=5' @@ -2845,14 +2927,6 @@ packages: npm: '>=5' resolution: integrity: sha512-SoCG1btVFPxOcrs8w9wLJCfe8nfE6EaEXCXyRwGbh+Sr3NLEG0R8JOugGJbuSE+zIRuUs5JaUKjzSec+JKLvZw== - /@verdaccio/types/9.5.0: - dev: true - resolution: - integrity: sha512-zUCkSQF0qShq/9OCEq6bZgHtz0lP0npkxXGc0Ch8P5fPiTlih1MBY5GxqM0ervMGw8ojH2mCYQ0655pKicYg1A== - /@verdaccio/types/9.7.0: - dev: true - resolution: - integrity: sha512-QeijEgVBVRTGyOteIl+RD4aiEbiUM1SkN7UAjZxhwns0o2YebdO+Z2iphmx0EZdo4STnWLuGSRlJexTaU/+lDQ== /@verdaccio/types/9.7.2: dev: true resolution: @@ -2865,11 +2939,18 @@ packages: resolution: integrity: sha512-3nDT5iJvmIYJe8UwirJbHexy21HU0YUkwvKygVe2KCPUTQu8u23/w6JyOB8reqj8w0xFfJMHI0dArnPsKxYM3Q== /@verdaccio/ui-theme/1.11.0: + dev: false engines: node: '>= 8' npm: '>=5' resolution: integrity: sha512-ggXPyCueh8CtHFrpZsq7kP+pLxKPsiTuoCGmYNIquZ/p99A6eIAVLElqHFJfgGATsdVlFQKWG/AawCfxD5ymUw== + /@verdaccio/ui-theme/1.12.1: + engines: + node: '>= 8' + npm: '>=5' + resolution: + integrity: sha512-J9UEf6MkKugeq5sFhDfqPPGNy4dTSf3fVYK3Q2hGFQiKXvOw7hqovjz6PVOJRNMymBXb2fJuMPIXx1Br3kwD2Q== /@yarnpkg/lockfile/1.1.0: dev: true resolution: @@ -3575,6 +3656,18 @@ packages: safe-json-stringify: 1.2.0 resolution: integrity: sha1-8VDw9nSKvdcq6uhPBEA74u8RN5c= + /bunyan/1.8.14: + dev: true + engines: + '0': node >=0.10.0 + hasBin: true + optionalDependencies: + dtrace-provider: 0.8.8 + moment: 2.27.0 + mv: 2.1.1 + safe-json-stringify: 1.2.0 + resolution: + integrity: sha512-LlahJUxXzZLuw/hetUQJmRgZ1LF6+cr5TPpRj6jf327AsiIq2jhYEH4oqUUkVKTor+9w2BT3oxVwhzE5lw9tcg== /bytes/3.0.0: engines: node: '>= 0.8' @@ -4833,9 +4926,9 @@ packages: eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 resolution: integrity: sha512-66Fpf1Ln6aIS5Gr/55ts19eUuoDhAbZgnr6UxK5hbDx6l/QgQgx61AePq+BV4PP2uXQFClgMVzep5zZ94qqsxg== - /eslint-plugin-jest/23.8.0_eslint@7.5.0+typescript@3.9.7: + /eslint-plugin-jest/23.8.0_eslint@7.5.0+typescript@4.0.2: dependencies: - '@typescript-eslint/experimental-utils': 2.34.0_eslint@7.5.0+typescript@3.9.7 + '@typescript-eslint/experimental-utils': 2.34.0_eslint@7.5.0+typescript@4.0.2 eslint: 7.5.0 dev: true engines: @@ -7169,10 +7262,17 @@ packages: resolution: integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w== /kleur/4.0.1: + dev: false engines: node: '>=6' resolution: integrity: sha512-Qs6SqCLm63rd0kNVh+wO4XsWLU6kgfwwaPYsLiClWf0Tewkzsa6MvB21bespb8cz+ANS+2t3So1ge3gintzhlw== + /kleur/4.0.2: + dev: true + engines: + node: '>=6' + resolution: + integrity: sha512-FGCCxczbrZuF5CtMeO0xfnjhzkVZSXfcWK90IPLucDWZwskrpYN7pmRIgvd8muU0mrPrzy4A2RBGuwCjLHI+nw== /language-subtag-registry/0.3.20: dev: true resolution: @@ -7522,7 +7622,6 @@ packages: resolution: integrity: sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ== /lodash/4.17.20: - dev: true resolution: integrity: sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== /log-symbols/1.0.2: @@ -7653,13 +7752,13 @@ packages: resolution: integrity: sha512-MyUe+T/Pw4TZufHkzAfDj6HarCBWia2y27/bhuYkTaiUnfDYFnCP3KUN+9oM7Wi6JA2rymtVYbQu3spE0GCmxQ== /marked/0.8.2: + dev: false engines: node: '>= 8.16.2' hasBin: true resolution: integrity: sha512-EGwzEeCcLniFX51DhTpmTom+dSA/MG/OBUDjnWtHbEnjAH180VzUeAw+oE4+Zv+CoYBWyRlYOTR0N8SO9R1PVw== /marked/1.1.1: - dev: false engines: node: '>= 8.16.2' hasBin: true @@ -10248,10 +10347,10 @@ packages: node: '>=0.6.x' resolution: integrity: sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA== - /tsutils/3.17.1_typescript@3.9.7: + /tsutils/3.17.1_typescript@4.0.2: dependencies: tslib: 1.13.0 - typescript: 3.9.7 + typescript: 4.0.2 dev: true engines: node: '>= 6' @@ -10329,13 +10428,13 @@ packages: dev: true resolution: integrity: sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= - /typescript/3.9.7: + /typescript/4.0.2: dev: true engines: node: '>=4.2.0' hasBin: true resolution: - integrity: sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw== + integrity: sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ== /uglify-js/3.10.1: engines: node: '>=0.8.0' @@ -10504,18 +10603,28 @@ packages: dependencies: express: 4.17.1 request: 2.88.0 + dev: false engines: node: '>=8' resolution: integrity: sha512-dyYeGhg+HfLFgTMJEV7usJ46xQix9SU566XIi278IlYFmBkFe6SsmiZUHKaL3pbq8K9ESQYNCyYkZW29QMpcIg== - /verdaccio-auth-memory/9.7.0: + /verdaccio-audit/9.7.3: + dependencies: + express: 4.17.1 + request: 2.88.2 + dev: true + engines: + node: '>=8' + resolution: + integrity: sha512-FDWafgDjvnTbJapQpd0c41FjrecR+iRHrnDi2gkAn4IJpiLCgXC6R5NdkXjDIekKEsou9PyQTsEdoHK7iDx+tQ== + /verdaccio-auth-memory/9.7.2: dependencies: '@verdaccio/commons-api': 9.7.1 dev: true engines: node: '>=8' resolution: - integrity: sha512-PSe8BRkmeqK4hweZLWKp3KH4DdoMK8/ychs4SCR4VvcEUAKJU+VOAQzD6VMlkX33yG1p4T8PUwALjhNqKO+FLA== + integrity: sha512-pxFGUk91kAJPrmjRIzHRn/cnLmyuN925nA1iH2Bf6kdP9E0uEGK/pRjMh8BuXWFLsGe9E6N7HR86cub1/qcrzA== /verdaccio-htpasswd/8.5.2: dependencies: '@verdaccio/file-locking': 1.0.0 @@ -10535,11 +10644,23 @@ packages: bcryptjs: 2.4.3 http-errors: 1.7.3 unix-crypt-td-js: 1.1.4 + dev: false engines: node: '>=8' resolution: integrity: sha512-UVUm3lt0JNJk02rKd2VBqpfVDwDlRfGyTQLwBuZfdnD/qmGrTzqKcnXAsG6zwlPo64Js5ZTvGi1/QeAgG4GjxA== - /verdaccio-memory/9.7.0: + /verdaccio-htpasswd/9.7.2: + dependencies: + '@verdaccio/file-locking': 9.7.2 + apache-md5: 1.1.2 + bcryptjs: 2.4.3 + http-errors: 1.8.0 + unix-crypt-td-js: 1.1.4 + engines: + node: '>=8' + resolution: + integrity: sha512-c7ZEb7wuce0+4h92w4f1ySMhsIWFs/mlsFjjoqIlY5SBskmQI5RHC7HQglVgFjOMxrWoaaadJ5WGmFV+A/yxPQ== + /verdaccio-memory/9.7.2: dependencies: '@verdaccio/commons-api': 9.7.1 '@verdaccio/streams': 9.7.2 @@ -10548,7 +10669,7 @@ packages: engines: node: '>=8' resolution: - integrity: sha512-lIpqNwrEaJ6VDu6sPnhoWIk4SYJQxWneaHezdM/Q8ukOn4wMjBA3V16Wo8oQJnGCEd4EXjRnVkv/THxXVK7slA== + integrity: sha512-HKUbbgY147dOV4GhOoC/iVTl87RPVKN7dLX/EBSH23TwR/tClQdGduRLy9yeqc/0iouGc0GXm2IWK/1qoBuy4w== /verdaccio/4.4.4: dependencies: '@verdaccio/commons-api': 8.5.0 @@ -10627,12 +10748,55 @@ packages: semver: 6.3.0 verdaccio-audit: 9.6.1 verdaccio-htpasswd: 9.6.1 + dev: false engines: node: '>=8' npm: '>=5' hasBin: true resolution: integrity: sha512-frbxs8uRighBJ5aOt3Yc13wV1Go3B94Uu5NzmeB+WuvfSBQJOWktRhE2JzfPrx9ShRI6Ogho1FUa3th4iXjPXw== + /verdaccio/4.8.1: + dependencies: + '@verdaccio/commons-api': 9.7.1 + '@verdaccio/local-storage': 9.7.2 + '@verdaccio/readme': 9.7.3 + '@verdaccio/streams': 9.7.2 + '@verdaccio/ui-theme': 1.12.1 + JSONStream: 1.3.5 + async: 3.2.0 + body-parser: 1.19.0 + bunyan: 1.8.14 + commander: 3.0.2 + compression: 1.7.4 + cookies: 0.8.0 + cors: 2.8.5 + dayjs: 1.8.28 + envinfo: 7.5.1 + express: 4.17.1 + handlebars: 4.7.6 + http-errors: 1.8.0 + js-yaml: 3.14.0 + jsonwebtoken: 8.5.1 + kleur: 4.0.2 + lodash: 4.17.19 + lunr-mutable-indexes: 2.3.2 + marked: 1.1.1 + mime: 2.4.6 + minimatch: 3.0.4 + mkdirp: 0.5.5 + mv: 2.1.1 + pkginfo: 0.4.1 + request: 2.88.0 + semver: 6.3.0 + verdaccio-audit: 9.7.3 + verdaccio-htpasswd: 9.7.2 + dev: true + engines: + node: '>=8' + npm: '>=5' + hasBin: true + resolution: + integrity: sha512-6I04bBlY4NS/MtRQismmIA+l/J0MJvBPj78s0p9QMATKDTcsdZS+zXf/Y6a/JsWYqz3fNp94YjV84bLjHrm4UA== /verror/1.10.0: dependencies: assert-plus: 1.0.0 diff --git a/tsconfig.json b/tsconfig.json index da7d75c93..787094416 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,10 +11,6 @@ "resolveJsonModule": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, - "typeRoots": [ - "./node_modules/@verdaccio/types/lib/verdaccio", - "./node_modules/@types" - ] }, "exclude": [ "**/build",