@thzero/library_server 0.17.11 → 0.17.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/service/baseSecurity.js +4 -4
- package/service/news/base.js +7 -3
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thzero/library_server",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.17.
|
|
4
|
+
"version": "0.17.13",
|
|
5
5
|
"version_major": 0,
|
|
6
6
|
"version_minor": 17,
|
|
7
|
-
"version_patch":
|
|
8
|
-
"version_date": "
|
|
7
|
+
"version_patch": 13,
|
|
8
|
+
"version_date": "06/16/2023",
|
|
9
9
|
"description": "An opinionated library of common functionality to bootstrap an API using either Fastify or Koa as the web server.",
|
|
10
10
|
"author": "thZero",
|
|
11
11
|
"license": "MIT",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@godaddy/terminus": "^4.
|
|
28
|
+
"@godaddy/terminus": "^4.12.0",
|
|
29
29
|
"async-mutex": "^0.4.0",
|
|
30
30
|
"config": "^3.3.9",
|
|
31
31
|
"default-gateway": "^6.0.3",
|
package/service/baseSecurity.js
CHANGED
|
@@ -95,7 +95,7 @@ class BaseSecurityService extends Service {
|
|
|
95
95
|
roleObj = roleParts[0];
|
|
96
96
|
roleAct = roleParts.length >= 2 ? roleParts[1] : null
|
|
97
97
|
|
|
98
|
-
result = await this.validate(userRole, null, roleObj, roleAct);
|
|
98
|
+
result = await this.validate(correlationId, userRole, null, roleObj, roleAct);
|
|
99
99
|
this._logger.debug('BaseSecurityService', 'authorizationCheckRoles', 'result', result, correlationId);
|
|
100
100
|
if (logical === BaseSecurityService.logicalOr) {
|
|
101
101
|
if (result)
|
|
@@ -128,11 +128,11 @@ class BaseSecurityService extends Service {
|
|
|
128
128
|
|
|
129
129
|
initializeOptionsLogical(correlationId, options) {
|
|
130
130
|
if (!options)
|
|
131
|
-
return logicalOr;
|
|
131
|
+
return BaseSecurityService.logicalOr;
|
|
132
132
|
|
|
133
133
|
let logical = options.logical;
|
|
134
|
-
if (String.isNullOrEmpty(logical) || (logical !== logicalAnd) || (logical !== logicalOr))
|
|
135
|
-
logical = logicalOr;
|
|
134
|
+
if (String.isNullOrEmpty(logical) || (logical !== BaseSecurityService.logicalAnd) || (logical !== BaseSecurityService.logicalOr))
|
|
135
|
+
logical = BaseSecurityService.logicalOr;
|
|
136
136
|
|
|
137
137
|
return logical;
|
|
138
138
|
}
|
package/service/news/base.js
CHANGED
|
@@ -20,9 +20,13 @@ class BaseNewsService extends Service {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
async latest(correlationId, user, timestamp) {
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
this._enforceNotEmpty('BaseNewsService', 'latest', timestamp, 'timestamp', correlationId);
|
|
24
|
+
try {
|
|
25
|
+
timestamp = parseInt(timestamp);
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
return this._error('BaseNewsService', 'latest', 'Invalid timestamp.', null, err, null, correlationId);
|
|
29
|
+
}
|
|
26
30
|
|
|
27
31
|
const validationCheckNewsTiemstampResponse = this._serviceValidation.check(correlationId, this._serviceValidationNews.newsTimestampSchema, timestamp, null, 'news');
|
|
28
32
|
if (!validationCheckNewsTiemstampResponse.success)
|