@eik/core
Advanced tools
Comparing version 1.1.12 to 1.2.0
@@ -0,1 +1,8 @@ | ||
# [1.2.0](https://github.com/eik-lib/core/compare/v1.1.12...v1.2.0) (2021-01-11) | ||
### Features | ||
* Decode URL encoded URL parameters ([#201](https://github.com/eik-lib/core/issues/201)) ([f3977f5](https://github.com/eik-lib/core/commit/f3977f51a31d8306453ff68e44728de703a1c2f5)) | ||
## [1.1.12](https://github.com/eik-lib/core/compare/v1.1.11...v1.1.12) (2021-01-07) | ||
@@ -2,0 +9,0 @@ |
@@ -12,2 +12,3 @@ 'use strict'; | ||
const config = require('../utils/defaults'); | ||
const utils = require('../utils/utils'); | ||
@@ -64,5 +65,8 @@ const AliasDel = class AliasDel { | ||
const pAlias = utils.decodeUriComponent(alias); | ||
const pName = utils.decodeUriComponent(name); | ||
try { | ||
validators.alias(alias); | ||
validators.name(name); | ||
validators.alias(pAlias); | ||
validators.name(pName); | ||
validators.type(type); | ||
@@ -86,7 +90,7 @@ } catch (error) { | ||
const path = createFilePathToAlias({ org, type, name, alias }); | ||
const path = createFilePathToAlias({ org, type, name: pName, alias: pAlias }); | ||
const exist = await this._exist(path); | ||
if (!exist) { | ||
this._log.info( | ||
`alias:del - Alias does not exists - Org: ${org} - Type: ${type} - Name: ${name} - Alias: ${alias}`, | ||
`alias:del - Alias does not exists - Org: ${org} - Type: ${type} - Name: ${pName} - Alias: ${pAlias}`, | ||
); | ||
@@ -93,0 +97,0 @@ const e = new HttpError.NotFound(); |
@@ -56,6 +56,10 @@ 'use strict'; | ||
const pAlias = utils.decodeUriComponent(alias); | ||
const pExtra = utils.decodeUriComponent(extra); | ||
const pName = utils.decodeUriComponent(name); | ||
try { | ||
validators.alias(alias); | ||
validators.extra(extra); | ||
validators.name(name); | ||
validators.alias(pAlias); | ||
validators.extra(pExtra); | ||
validators.name(pName); | ||
validators.type(type); | ||
@@ -79,7 +83,7 @@ } catch (error) { | ||
const path = createFilePathToAlias({ org, type, name, alias }); | ||
const path = createFilePathToAlias({ org, type, name: pName, alias: pAlias }); | ||
try { | ||
const obj = await utils.readJSON(this._sink, path); | ||
const location = createURIToTargetOfAlias({ extra, ...obj }); | ||
const location = createURIToTargetOfAlias({ extra: pExtra, ...obj }); | ||
@@ -86,0 +90,0 @@ const outgoing = new HttpOutgoing(); |
@@ -16,4 +16,4 @@ 'use strict'; | ||
const Alias = require('../classes/alias'); | ||
const config = require('../utils/defaults'); | ||
const utils = require('../utils/utils'); | ||
const config = require('../utils/defaults'); | ||
@@ -124,5 +124,8 @@ const AliasPost = class AliasPost { | ||
const pAlias = utils.decodeUriComponent(alias); | ||
const pName = utils.decodeUriComponent(name); | ||
try { | ||
validators.alias(alias); | ||
validators.name(name); | ||
validators.alias(pAlias); | ||
validators.name(pName); | ||
validators.type(type); | ||
@@ -150,4 +153,4 @@ } catch (error) { | ||
author, | ||
alias, | ||
name, | ||
alias: pAlias, | ||
name: pName, | ||
type, | ||
@@ -160,3 +163,3 @@ org, | ||
this._log.info( | ||
`alias:post - Alias does not exists - Org: ${org} - Type: ${type} - Name: ${name} - Alias: ${alias}`, | ||
`alias:post - Alias does not exists - Org: ${org} - Type: ${type} - Name: ${pName} - Alias: ${pAlias}`, | ||
); | ||
@@ -163,0 +166,0 @@ const e = new HttpError.NotFound(); |
@@ -122,5 +122,8 @@ 'use strict'; | ||
const pAlias = utils.decodeUriComponent(alias); | ||
const pName = utils.decodeUriComponent(name); | ||
try { | ||
validators.alias(alias); | ||
validators.name(name); | ||
validators.alias(pAlias); | ||
validators.name(pName); | ||
validators.type(type); | ||
@@ -148,4 +151,4 @@ } catch (error) { | ||
author, | ||
alias, | ||
name, | ||
alias: pAlias, | ||
name: pName, | ||
type, | ||
@@ -158,3 +161,3 @@ org, | ||
this._log.info( | ||
`alias:put - Alias exists - Org: ${org} - Type: ${type} - Name: ${name} - Alias: ${alias}`, | ||
`alias:put - Alias exists - Org: ${org} - Type: ${type} - Name: ${pName} - Alias: ${pAlias}`, | ||
); | ||
@@ -161,0 +164,0 @@ const e = new HttpError.Conflict(); |
@@ -12,2 +12,3 @@ 'use strict'; | ||
const config = require('../utils/defaults'); | ||
const utils = require('../utils/utils'); | ||
@@ -58,5 +59,8 @@ const MapGet = class MapGet { | ||
const pVersion = utils.decodeUriComponent(version); | ||
const pName = utils.decodeUriComponent(name); | ||
try { | ||
validators.version(version); | ||
validators.name(name); | ||
validators.version(pVersion); | ||
validators.name(pName); | ||
} catch (error) { | ||
@@ -79,3 +83,3 @@ this._log.debug(`map:get - Validation failed - ${error.message}`); | ||
const path = createFilePathToImportMap({ org, name, version }); | ||
const path = createFilePathToImportMap({ org, name: pName, version: pVersion }); | ||
@@ -82,0 +86,0 @@ try { |
@@ -20,4 +20,4 @@ 'use strict'; | ||
const Author = require('../classes/author'); | ||
const config = require('../utils/defaults'); | ||
const utils = require('../utils/utils'); | ||
const config = require('../utils/defaults'); | ||
@@ -176,5 +176,8 @@ const MapPut = class MapPut { | ||
const pVersion = utils.decodeUriComponent(version); | ||
const pName = utils.decodeUriComponent(name); | ||
try { | ||
validators.version(version); | ||
validators.name(name); | ||
validators.version(pVersion); | ||
validators.name(pName); | ||
} catch (error) { | ||
@@ -201,5 +204,5 @@ this._log.info(`map:put - Validation failed - ${error.message}`); | ||
type: 'map', | ||
version, | ||
version: pVersion, | ||
author, | ||
name, | ||
name: pName, | ||
org, | ||
@@ -210,5 +213,5 @@ }); | ||
if (!versions.check(version)) { | ||
if (!versions.check(pVersion)) { | ||
this._log.info( | ||
`map:put - Semver version is lower than previous version of the package - Org: ${org} - Name: ${name} - Version: ${version}`, | ||
`map:put - Semver version is lower than previous version of the package - Org: ${org} - Name: ${pName} - Version: ${pVersion}`, | ||
); | ||
@@ -221,3 +224,3 @@ const e = new HttpError.Conflict(); | ||
const integrity = await this._parser(incoming); | ||
versions.setVersion(version, integrity); | ||
versions.setVersion(pVersion, integrity); | ||
@@ -224,0 +227,0 @@ try { |
@@ -13,2 +13,3 @@ 'use strict'; | ||
const config = require('../utils/defaults'); | ||
const utils = require('../utils/utils'); | ||
@@ -59,6 +60,10 @@ const PkgGet = class PkgGet { | ||
const pVersion = utils.decodeUriComponent(version); | ||
const pExtra = utils.decodeUriComponent(extra); | ||
const pName = utils.decodeUriComponent(name); | ||
try { | ||
validators.version(version); | ||
validators.extra(extra); | ||
validators.name(name); | ||
validators.version(pVersion); | ||
validators.extra(pExtra); | ||
validators.name(pName); | ||
validators.type(type); | ||
@@ -83,5 +88,5 @@ } catch (error) { | ||
const asset = new Asset({ | ||
pathname: extra, | ||
version, | ||
name, | ||
pathname: pExtra, | ||
version: pVersion, | ||
name: pName, | ||
type, | ||
@@ -88,0 +93,0 @@ org, |
@@ -12,2 +12,3 @@ 'use strict'; | ||
const config = require('../utils/defaults'); | ||
const utils = require('../utils/utils'); | ||
@@ -57,5 +58,8 @@ const PkgLog = class PkgLog { | ||
const pVersion = utils.decodeUriComponent(version); | ||
const pName = utils.decodeUriComponent(name); | ||
try { | ||
validators.version(version); | ||
validators.name(name); | ||
validators.version(pVersion); | ||
validators.name(pName); | ||
validators.type(type); | ||
@@ -79,3 +83,3 @@ } catch (error) { | ||
const path = createFilePathToPackage({ org, type, name, version }); | ||
const path = createFilePathToPackage({ org, type, name: pName, version: pVersion }); | ||
@@ -82,0 +86,0 @@ try { |
@@ -135,5 +135,8 @@ 'use strict'; | ||
const pVersion = utils.decodeUriComponent(version); | ||
const pName = utils.decodeUriComponent(name); | ||
try { | ||
validators.version(version); | ||
validators.name(name); | ||
validators.version(pVersion); | ||
validators.name(pName); | ||
validators.type(type); | ||
@@ -160,6 +163,6 @@ } catch (error) { | ||
const incoming = new HttpIncoming(req, { | ||
version, | ||
version: pVersion, | ||
author, | ||
type, | ||
name, | ||
name: pName, | ||
org, | ||
@@ -170,5 +173,5 @@ }); | ||
if (!versions.check(version)) { | ||
if (!versions.check(pVersion)) { | ||
this._log.info( | ||
`pkg:put - Semver version is lower than previous version of the package - Org: ${org} - Type: ${type} - Name: ${name} - Version: ${version}`, | ||
`pkg:put - Semver version is lower than previous version of the package - Org: ${org} - Type: ${type} - Name: ${pName} - Version: ${pVersion}`, | ||
); | ||
@@ -181,3 +184,3 @@ const e = new HttpError.Conflict(); | ||
const pkg = await this._parser(incoming); | ||
versions.setVersion(version, pkg.integrity); | ||
versions.setVersion(pVersion, pkg.integrity); | ||
@@ -184,0 +187,0 @@ try { |
@@ -12,2 +12,3 @@ 'use strict'; | ||
const config = require('../utils/defaults'); | ||
const utils = require('../utils/utils'); | ||
@@ -58,4 +59,6 @@ const VersionsGet = class VersionsGet { | ||
const pName = utils.decodeUriComponent(name); | ||
try { | ||
validators.name(name); | ||
validators.name(pName); | ||
validators.type(type); | ||
@@ -80,3 +83,3 @@ } catch (error) { | ||
} | ||
const path = createFilePathToVersion({ org, type, name }); | ||
const path = createFilePathToVersion({ org, type, name: pName }); | ||
@@ -83,0 +86,0 @@ try { |
@@ -86,1 +86,8 @@ 'use strict'; | ||
module.exports.etagFromFsStat = etagFromFsStat; | ||
const decodeUriComponent = (value) => { | ||
if (value === null || value === undefined) return value; | ||
return decodeURIComponent(value); | ||
} | ||
module.exports.decodeUriComponent = decodeUriComponent; |
{ | ||
"name": "@eik/core", | ||
"version": "1.1.12", | ||
"version": "1.2.0", | ||
"description": "Core server package", | ||
@@ -46,3 +46,3 @@ "main": "lib/main.js", | ||
"eslint-plugin-import": "2.22.1", | ||
"eslint-plugin-prettier": "3.3.0", | ||
"eslint-plugin-prettier": "3.3.1", | ||
"form-data": "3.0.0", | ||
@@ -49,0 +49,0 @@ "mkdirp": "1.0.4", |
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
110740
3023