soajs.controller 4.2.32 → 4.2.33

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.
@@ -56,20 +56,23 @@ module.exports = () => {
56
56
  if (error) {
57
57
  req.soajs.log.debug("lastSeen failed for [" + item.name + "@" + item.version + " " + item.api + "]");
58
58
  req.soajs.log.debug("lastSeen " + error.message);
59
- } else if (!body.result) {
60
- let errorMsg = "";
61
- if (body.errors && body.errors && body.errors.details && body.errors.details.length > 0) {
62
- body.errors.details.forEach((detail) => {
63
- if (errorMsg === "") {
64
- errorMsg += detail.message;
65
- }
66
- else {
67
- errorMsg += " - " + detail.message;
68
- }
69
- });
70
- }
71
- req.soajs.log.debug("lastSeen", errorMsg);
59
+ } else {
60
+ req.soajs.log.debug("lastSeen ", body);
72
61
  }
62
+ // else if (!body.result) {
63
+ // let errorMsg = "";
64
+ // if (body.errors && body.errors && body.errors.details && body.errors.details.length > 0) {
65
+ // body.errors.details.forEach((detail) => {
66
+ // if (errorMsg === "") {
67
+ // errorMsg += detail.message;
68
+ // }
69
+ // else {
70
+ // errorMsg += " - " + detail.message;
71
+ // }
72
+ // });
73
+ // }
74
+ // req.soajs.log.debug("lastSeen", errorMsg);
75
+ // }
73
76
  });
74
77
 
75
78
  // let options = {
package/mw/mt/urac.js CHANGED
@@ -16,7 +16,7 @@ const lib = require("./lib.js");
16
16
 
17
17
  function Urac(param) {
18
18
  let _self = this;
19
-
19
+
20
20
  _self.soajs = param.soajs;
21
21
  _self.userRecord = null;
22
22
  _self.user_ACL = null;
@@ -70,7 +70,7 @@ Urac.prototype.init = function (cb) {
70
70
  }
71
71
  }
72
72
  else if (_self.id) {
73
- uracDriver.getRecord(_self.soajs, {id: _self.id.toString(), username: _self.username}, function (err, record) {
73
+ uracDriver.getRecord(_self.soajs, { id: _self.id.toString(), username: _self.username }, function (err, record) {
74
74
  if (record) {
75
75
  _self.userRecord = record;
76
76
  _self.resolveACL(() => {
@@ -78,7 +78,9 @@ Urac.prototype.init = function (cb) {
78
78
  });
79
79
  } else {
80
80
  if (err && err.msg) {
81
+ const code = err.code;
81
82
  err = new Error(err.msg);
83
+ err.code = code;
82
84
  }
83
85
  return cb(err, null);
84
86
  }
@@ -141,19 +143,19 @@ Urac.prototype.getProfile = function (_ALL) {
141
143
  "profile": _self.userRecord.profile,
142
144
  "tenant": _self.userRecord.tenant
143
145
  };
144
-
146
+
145
147
  if (_self.userRecord.socialLogin) {
146
148
  urac.socialLogin = {
147
149
  "strategy": _self.userRecord.socialLogin.strategy,
148
150
  "id": _self.userRecord.socialLogin.id
149
151
  };
150
152
  }
151
-
153
+
152
154
  if (_ALL) {
153
155
  if (_self.userRecord.socialLogin) {
154
156
  urac.socialLogin.accessToken = _self.userRecord.socialLogin.accessToken;
155
157
  }
156
-
158
+
157
159
  urac.config = _self.userRecord.config;
158
160
  urac.groupsConfig = _self.userRecord.groupsConfig;
159
161
  }
@@ -162,7 +164,7 @@ Urac.prototype.getProfile = function (_ALL) {
162
164
  urac = {
163
165
  "_id": _self.userRecord._id,
164
166
  "username": _self.userRecord.userId,
165
- "tenant": {"id": _self.userRecord.tId}
167
+ "tenant": { "id": _self.userRecord.tId }
166
168
  };
167
169
  }
168
170
  else if (_self.userRecord) {
@@ -182,7 +184,7 @@ Urac.prototype.getProfile = function (_ALL) {
182
184
  */
183
185
  Urac.prototype.getAcl = function () {
184
186
  let _self = this;
185
-
187
+
186
188
  if (_self.user_ACL && _self.user_ACL.acl) {
187
189
  return _self.user_ACL.acl;
188
190
  } else {
@@ -195,7 +197,7 @@ Urac.prototype.getAcl = function () {
195
197
  */
196
198
  Urac.prototype.getAclAllEnv = function () {
197
199
  let _self = this;
198
-
200
+
199
201
  if (_self.user_ACL && _self.user_ACL.acl_all_env) {
200
202
  return _self.user_ACL.acl_all_env;
201
203
  } else {
@@ -214,13 +216,13 @@ Urac.prototype.getConfig = function () {
214
216
  return null;
215
217
  }
216
218
  let config = null;
217
-
219
+
218
220
  if (_self.userRecord.config && _self.userRecord.config.keys) {
219
221
  if (_self.userRecord.config.keys[key] && _self.userRecord.config.keys[key].config) {
220
222
  config = _self.userRecord.config.keys[key].config;
221
223
  }
222
224
  }
223
-
225
+
224
226
  return config;
225
227
  };
226
228
 
package/mw/mt/utils.js CHANGED
@@ -590,7 +590,7 @@ let utils = {
590
590
  obj.req.soajs.uracDriver = new UracDriver({ "soajs": obj.req.soajs, "oauth": obj.req.oauth });
591
591
  obj.req.soajs.uracDriver.init((error) => {
592
592
  if (error && !roaming) {
593
- obj.req.soajs.log.error(error.message);
593
+ obj.req.soajs.log.error(error.message, error.code);
594
594
  return cb(146);
595
595
  }
596
596
  let userServiceConf = obj.req.soajs.uracDriver.getConfig();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "soajs.controller",
3
3
  "description": "soajs multi tenant API gateway",
4
- "version": "4.2.32",
4
+ "version": "4.2.33",
5
5
  "author": {
6
6
  "name": "soajs team",
7
7
  "email": "team@soajs.org"
@@ -34,9 +34,10 @@
34
34
  "useragent": "2.3.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@babel/core": "7.26.0",
38
- "@babel/plugin-transform-runtime": "7.25.9",
39
- "@babel/preset-env": "7.26.0",
37
+ "@babel/core": "7.27.1",
38
+ "@babel/plugin-transform-runtime": "7.27.1",
39
+ "@babel/preset-env": "7.27.2",
40
+ "@babel/runtime": "7.27.1",
40
41
  "express": "4.21.1",
41
42
  "grunt": "1.6.1",
42
43
  "grunt-babel": "8.0.0",