@eik/common
Advanced tools
Comparing version 1.5.0 to 1.6.0
@@ -0,1 +1,8 @@ | ||
# [1.6.0](https://github.com/eik-lib/common/compare/v1.5.0...v1.6.0) (2021-01-27) | ||
### Features | ||
* add "type" field to JSON Schema, validation and asserts ([402ffca](https://github.com/eik-lib/common/commit/402ffcadcd823fdfdd47bf0d4e2c8353795e6fbc)) | ||
# [1.5.0](https://github.com/eik-lib/common/compare/v1.4.2...v1.5.0) (2021-01-25) | ||
@@ -2,0 +9,0 @@ |
@@ -7,2 +7,3 @@ 'use strict'; | ||
version, | ||
type, | ||
server, | ||
@@ -18,3 +19,9 @@ files, | ||
if (valid.error) { | ||
const errorMessage = valid.error.map(err => err.message).join(','); | ||
const errorMessage = valid.error.map(err => { | ||
let msg = err.message; | ||
if (err.params && err.params.allowedValues) { | ||
msg += ` ("${err.params.allowedValues.join('", ')}")`; | ||
} | ||
return msg; | ||
}).join(','); | ||
throw new ValidationError(`${message}: ${errorMessage}`); | ||
@@ -27,2 +34,3 @@ } | ||
name: assert(name, 'Parameter "name" is not valid'), | ||
type: assert(type, 'Parameter "type" is not valid'), | ||
version: assert(version, 'Parameter "version" is not valid'), | ||
@@ -29,0 +37,0 @@ server: assert(server, 'Parameter "server" is not valid'), |
@@ -22,2 +22,8 @@ { | ||
}, | ||
"type": { | ||
"description": "The type of the Eik package. Must be one of 'package', 'npm' or 'map'. Setting this value changes the URL publish namespace between '/pkg' (default), '/npm' and '/map', use 'npm' when publishing NPM packages. Use 'map' when publishing import maps.", | ||
"type": "string", | ||
"enum": ["package", "npm", "map"], | ||
"default": "package" | ||
}, | ||
"files": { | ||
@@ -24,0 +30,0 @@ "description": "File mapping definition for the package. Keys represent files or paths to be created on the Eik Server. Values represent paths to local files to be published.", |
@@ -80,2 +80,3 @@ 'use strict'; | ||
const version = createVersionValidator(createValidator(eikJSONSchema.properties.version)); | ||
const type = createValidator(eikJSONSchema.properties.type); | ||
const server = createValidator(eikJSONSchema.properties.server); | ||
@@ -89,2 +90,3 @@ const files = createValidator(eikJSONSchema.properties.files); | ||
module.exports.version = version; | ||
module.exports.type = type; | ||
module.exports.server = server; | ||
@@ -91,0 +93,0 @@ module.exports.files = files; |
{ | ||
"name": "@eik/common", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "Common utilities for Eik modules", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -58,2 +58,13 @@ # Eik Commons | ||
``` | ||
##### type | ||
```js | ||
const { error, value } = schemas.validate.type('package'); | ||
// or | ||
assert.type('package'); | ||
``` | ||
##### server | ||
@@ -60,0 +71,0 @@ |
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
27889
570
185