@verdaccio/utils
Advanced tools
Comparing version 6.0.0-6-next.6 to 6.0.0-6-next.7
@@ -11,5 +11,5 @@ "use strict"; | ||
var _commonsApi = require("@verdaccio/commons-api"); | ||
var _core = require("@verdaccio/core"); | ||
function validatePassword(password, minLength = _commonsApi.DEFAULT_MIN_LIMIT_PASSWORD) { | ||
function validatePassword(password, minLength = _core.DEFAULT_MIN_LIMIT_PASSWORD) { | ||
return typeof password === 'string' && password.length >= minLength; | ||
@@ -16,0 +16,0 @@ } |
import { Package, Version, Author } from '@verdaccio/types'; | ||
import { getConflict, getBadData, getBadRequest, getInternalError, getUnauthorized, getForbidden, getServiceUnavailable, getNotFound, getCode } from '@verdaccio/commons-api'; | ||
/** | ||
@@ -48,13 +47,2 @@ * From normalize-package-data/lib/fixer.js | ||
export declare function getLatestVersion(pkgInfo: Package): string; | ||
export declare const ErrorCode: { | ||
getConflict: typeof getConflict; | ||
getBadData: typeof getBadData; | ||
getBadRequest: typeof getBadRequest; | ||
getInternalError: typeof getInternalError; | ||
getUnauthorized: typeof getUnauthorized; | ||
getForbidden: typeof getForbidden; | ||
getServiceUnavailable: typeof getServiceUnavailable; | ||
getNotFound: typeof getNotFound; | ||
getCode: typeof getCode; | ||
}; | ||
export declare function buildToken(type: string, token: string): string; | ||
@@ -61,0 +49,0 @@ export declare type AuthorFormat = Author | string | null | void; |
@@ -20,3 +20,2 @@ "use strict"; | ||
exports.isVersionValid = isVersionValid; | ||
exports.ErrorCode = void 0; | ||
@@ -29,3 +28,3 @@ var _assert = _interopRequireDefault(require("assert")); | ||
var _commonsApi = require("@verdaccio/commons-api"); | ||
var _core = require("@verdaccio/core"); | ||
@@ -118,4 +117,4 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
if (!isObject(object[_commonsApi.DIST_TAGS])) { | ||
object[_commonsApi.DIST_TAGS] = {}; | ||
if (!isObject(object[_core.DIST_TAGS])) { | ||
object[_core.DIST_TAGS] = {}; | ||
} | ||
@@ -185,3 +184,3 @@ | ||
if (!pkg[_commonsApi.DIST_TAGS].latest) { | ||
if (!pkg[_core.DIST_TAGS].latest) { | ||
var _sorted; | ||
@@ -193,25 +192,25 @@ | ||
if ((_sorted = sorted) !== null && _sorted !== void 0 && _sorted.length) { | ||
pkg[_commonsApi.DIST_TAGS].latest = sorted.pop(); | ||
pkg[_core.DIST_TAGS].latest = sorted.pop(); | ||
} | ||
} | ||
for (const tag in pkg[_commonsApi.DIST_TAGS]) { | ||
if (_lodash.default.isArray(pkg[_commonsApi.DIST_TAGS][tag])) { | ||
if (pkg[_commonsApi.DIST_TAGS][tag].length) { | ||
for (const tag in pkg[_core.DIST_TAGS]) { | ||
if (_lodash.default.isArray(pkg[_core.DIST_TAGS][tag])) { | ||
if (pkg[_core.DIST_TAGS][tag].length) { | ||
// sort array | ||
// FIXME: this is clearly wrong, we need to research why this is like this. | ||
// @ts-ignore | ||
sorted = semverSort(pkg[_commonsApi.DIST_TAGS][tag]); | ||
sorted = semverSort(pkg[_core.DIST_TAGS][tag]); | ||
if (sorted.length) { | ||
// use highest version based on semver sort | ||
pkg[_commonsApi.DIST_TAGS][tag] = sorted.pop(); | ||
pkg[_core.DIST_TAGS][tag] = sorted.pop(); | ||
} | ||
} else { | ||
delete pkg[_commonsApi.DIST_TAGS][tag]; | ||
delete pkg[_core.DIST_TAGS][tag]; | ||
} | ||
} else if (_lodash.default.isString(pkg[_commonsApi.DIST_TAGS][tag])) { | ||
if (!_semver.default.parse(pkg[_commonsApi.DIST_TAGS][tag], true)) { | ||
} else if (_lodash.default.isString(pkg[_core.DIST_TAGS][tag])) { | ||
if (!_semver.default.parse(pkg[_core.DIST_TAGS][tag], true)) { | ||
// if the version is invalid, delete the dist-tag entry | ||
delete pkg[_commonsApi.DIST_TAGS][tag]; | ||
delete pkg[_core.DIST_TAGS][tag]; | ||
} | ||
@@ -223,18 +222,5 @@ } | ||
function getLatestVersion(pkgInfo) { | ||
return pkgInfo[_commonsApi.DIST_TAGS].latest; | ||
return pkgInfo[_core.DIST_TAGS].latest; | ||
} | ||
const ErrorCode = { | ||
getConflict: _commonsApi.getConflict, | ||
getBadData: _commonsApi.getBadData, | ||
getBadRequest: _commonsApi.getBadRequest, | ||
getInternalError: _commonsApi.getInternalError, | ||
getUnauthorized: _commonsApi.getUnauthorized, | ||
getForbidden: _commonsApi.getForbidden, | ||
getServiceUnavailable: _commonsApi.getServiceUnavailable, | ||
getNotFound: _commonsApi.getNotFound, | ||
getCode: _commonsApi.getCode | ||
}; | ||
exports.ErrorCode = ErrorCode; | ||
function buildToken(type, token) { | ||
@@ -251,3 +237,3 @@ return `${_lodash.default.capitalize(type)} ${token}`; | ||
let authorDetails = { | ||
name: _commonsApi.DEFAULT_USER, | ||
name: _core.DEFAULT_USER, | ||
email: '', | ||
@@ -254,0 +240,0 @@ url: '' |
# @verdaccio/utils | ||
## 6.0.0-6-next.7 | ||
### Major Changes | ||
- 794af76c: Remove Node 12 support | ||
- We need move to the new `undici` and does not support Node.js 12 | ||
### Minor Changes | ||
- 154b2ecd: refactor: remove @verdaccio/commons-api in favor @verdaccio/core and remove duplications | ||
### Patch Changes | ||
- Updated dependencies [794af76c] | ||
- Updated dependencies [154b2ecd] | ||
- @verdaccio/core@6.0.0-6-next.2 | ||
## 6.0.0-6-next.6 | ||
@@ -4,0 +22,0 @@ |
{ | ||
"name": "@verdaccio/utils", | ||
"version": "6.0.0-6-next.6", | ||
"version": "6.0.0-6-next.7", | ||
"description": "verdaccio utilities", | ||
@@ -29,7 +29,7 @@ "main": "./build/index.js", | ||
"engines": { | ||
"node": ">=10", | ||
"node": ">=14", | ||
"npm": ">=6" | ||
}, | ||
"dependencies": { | ||
"@verdaccio/commons-api": "11.0.0-6-next.4", | ||
"@verdaccio/core": "6.0.0-6-next.2", | ||
"minimatch": "3.0.4", | ||
@@ -36,0 +36,0 @@ "semver": "7.3.5" |
@@ -1,2 +0,2 @@ | ||
import { DEFAULT_MIN_LIMIT_PASSWORD } from '@verdaccio/commons-api'; | ||
import { DEFAULT_MIN_LIMIT_PASSWORD } from '@verdaccio/core'; | ||
@@ -3,0 +3,0 @@ export interface CookieSessionToken { |
@@ -5,15 +5,3 @@ import assert from 'assert'; | ||
import { Package, Version, Author } from '@verdaccio/types'; | ||
import { | ||
DIST_TAGS, | ||
DEFAULT_USER, | ||
getConflict, | ||
getBadData, | ||
getBadRequest, | ||
getInternalError, | ||
getUnauthorized, | ||
getForbidden, | ||
getServiceUnavailable, | ||
getNotFound, | ||
getCode, | ||
} from '@verdaccio/commons-api'; | ||
import { DIST_TAGS, DEFAULT_USER } from '@verdaccio/core'; | ||
@@ -194,14 +182,2 @@ /** | ||
export const ErrorCode = { | ||
getConflict, | ||
getBadData, | ||
getBadRequest, | ||
getInternalError, | ||
getUnauthorized, | ||
getForbidden, | ||
getServiceUnavailable, | ||
getNotFound, | ||
getCode, | ||
}; | ||
export function buildToken(type: string, token: string): string { | ||
@@ -208,0 +184,0 @@ return `${_.capitalize(type)} ${token}`; |
@@ -1,10 +0,3 @@ | ||
import { DIST_TAGS, DEFAULT_USER } from '@verdaccio/commons-api'; | ||
import { | ||
validateName, | ||
validatePackage, | ||
validateMetadata, | ||
getVersion, | ||
normalizeDistTags, | ||
formatAuthor, | ||
} from '../src/index'; | ||
import { DIST_TAGS, DEFAULT_USER } from '@verdaccio/core'; | ||
import { validateMetadata, getVersion, normalizeDistTags, formatAuthor } from '../src/index'; | ||
@@ -11,0 +4,0 @@ describe('Utilities', () => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70074
1048
+ Added@verdaccio/core@6.0.0-6-next.2(transitive)
- Removed@verdaccio/commons-api@11.0.0-6-next.4(transitive)