impress
Advanced tools
Comparing version 2.3.2 to 2.4.0
@@ -5,2 +5,7 @@ # Changelog | ||
## [2.4.0][] - 2021-06-26 | ||
- Use references to schemas in API definition | ||
- Allow optional balancer in config | ||
## [2.3.2][] - 2021-06-06 | ||
@@ -160,3 +165,4 @@ | ||
[unreleased]: https://github.com/metarhia/impress/compare/v2.3.2...HEAD | ||
[unreleased]: https://github.com/metarhia/impress/compare/v2.4.0...HEAD | ||
[2.4.0]: https://github.com/metarhia/impress/compare/v2.3.2...v2.4.0 | ||
[2.3.2]: https://github.com/metarhia/impress/compare/v2.3.1...v2.3.2 | ||
@@ -163,0 +169,0 @@ [2.3.1]: https://github.com/metarhia/impress/compare/v2.3.0...v2.3.1 |
@@ -30,8 +30,8 @@ 'use strict'; | ||
this.api = new Interfaces('api', this); | ||
this.schemas = new Schemas('schemas', this); | ||
this.static = new Resources('static', this); | ||
this.resources = new Resources('resources', this); | ||
this.api = new Interfaces('api', this); | ||
this.lib = new Modules('lib', this); | ||
this.domain = new Modules('domain', this); | ||
this.schemas = new Schemas('schemas', this); | ||
@@ -38,0 +38,0 @@ new Modules('domain', this); |
@@ -19,4 +19,6 @@ 'use strict'; | ||
else if (typeof exp === 'function') this.method = exp; | ||
this.parameters = exp.parameters ? Schema.from(exp.parameters) : null; | ||
this.returns = exp.returns ? Schema.from(exp.returns) : null; | ||
const namespaces = application.schemas ? [application.schemas.model] : []; | ||
const { parameters, returns } = exp; | ||
this.parameters = parameters ? Schema.from(parameters, namespaces) : null; | ||
this.returns = returns ? Schema.from(returns, namespaces) : null; | ||
this.semaphore = null; | ||
@@ -32,3 +34,3 @@ if (exp.queue) { | ||
this.timeout = exp.timeout || 0; | ||
this.sirializer = exp.sirialize || null; | ||
this.serializer = exp.serialize || null; | ||
this.protocols = exp.protocols || null; | ||
@@ -62,4 +64,5 @@ this.deprecated = exp.deprecated || false; | ||
if (parameters) { | ||
const { valid } = parameters.check(args); | ||
if (!valid) return new Error('Invalid parameter type'); | ||
const { valid, errors } = parameters.check(args); | ||
const problems = errors.join('; '); | ||
if (!valid) return new Error('Invalid parameters type: ' + problems); | ||
} | ||
@@ -82,4 +85,5 @@ if (validate) { | ||
if (returns) { | ||
const { valid } = this.returns.check(result); | ||
if (!valid) return new Error('Invalid result type'); | ||
const { valid, errors } = this.returns.check(result); | ||
const problems = errors.join('; '); | ||
if (!valid) return new Error('Invalid result type: ' + problems); | ||
} | ||
@@ -86,0 +90,0 @@ return result; |
{ | ||
"name": "impress", | ||
"version": "2.3.2", | ||
"version": "2.4.0", | ||
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>", | ||
@@ -69,6 +69,6 @@ "description": "Enterprise application server for Node.js", | ||
"dependencies": { | ||
"metacom": "^1.7.1", | ||
"metacom": "^1.7.4", | ||
"metaconfiguration": "^2.1.4", | ||
"metalog": "^3.1.2", | ||
"metaschema": "^1.2.3", | ||
"metaschema": "^1.3.1", | ||
"metautil": "^3.5.4", | ||
@@ -79,5 +79,5 @@ "metavm": "^1.0.2", | ||
"devDependencies": { | ||
"@types/ws": "^7.4.4", | ||
"@types/node": "^15.6.2", | ||
"eslint": "^7.27.0", | ||
"@types/node": "^15.12.4", | ||
"@types/ws": "^7.4.5", | ||
"eslint": "^7.29.0", | ||
"eslint-config-metarhia": "^7.0.1", | ||
@@ -88,5 +88,5 @@ "eslint-config-prettier": "^8.3.0", | ||
"metatests": "^0.7.2", | ||
"prettier": "^2.3.0", | ||
"typescript": "^4.3.2" | ||
"prettier": "^2.3.2", | ||
"typescript": "^4.3.4" | ||
} | ||
} |
({ | ||
host: 'string', | ||
balancer: 'number', | ||
balancer: '?number', | ||
protocol: { enum: ['http', 'https'] }, | ||
@@ -5,0 +5,0 @@ ports: { array: 'number' }, |
50459
1109
Updatedmetacom@^1.7.4
Updatedmetaschema@^1.3.1