@vulkano/core 1.17.2 → 1.17.3

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.
@@ -190,9 +190,10 @@ module.exports = function loadServer() {
190
190
  vulkano.use(timeout( expressConfig.timeout || 120000 ));
191
191
 
192
192
  vulkano.use( (req, res, next) => {
193
- if (!req.timedout) {
194
- next();
193
+ if (req.timedout) {
194
+ return res.status(503).json({ success: false, statusCode: 503, error: { detail: 'Request timeout' } });
195
195
  }
196
+ next();
196
197
  });
197
198
 
198
199
  // ---------------
@@ -660,6 +661,11 @@ module.exports = function loadServer() {
660
661
  return;
661
662
  }
662
663
 
664
+ // Timeout — always respond with JSON regardless of request type
665
+ if (req.timedout || (err && err.timeout)) {
666
+ return res.status(503).json({ success: false, statusCode: 503, error: { detail: 'Request timeout' } });
667
+ }
668
+
663
669
  const status = err ? (err.status || 500) : (res.statusCode || 500);
664
670
 
665
671
  res.status(status);
@@ -871,6 +877,9 @@ module.exports = function loadServer() {
871
877
  (pubClient ? pubClient.connect() : null),
872
878
  (subClient ? subClient.connect() : null)
873
879
  ])
880
+ .catch((err) => {
881
+ throw new Error(`Socket Redis adapter failed to connect: ${err.message}`);
882
+ })
874
883
  .then(() => {
875
884
 
876
885
  io.on('connection', (socket) => {
@@ -97,10 +97,12 @@ module.exports = {
97
97
  });
98
98
  }
99
99
 
100
+ // Two queries by design: fetch the full document first so subdocument arrays
101
+ // and nested fields are preserved in the write — a bare $set would drop
102
+ // any subdoc entries not included in the incoming payload.
100
103
  return this.getByField(_id)
101
104
  .then( (record) => {
102
105
 
103
- // Merge current info with incoming values
104
106
  const merged = {
105
107
  ...record,
106
108
  ...filtered,
package/libs/Jwt.js CHANGED
@@ -122,12 +122,16 @@ module.exports = {
122
122
  */
123
123
  decode(token, customKey) {
124
124
 
125
+ if (!token) {
126
+ return null;
127
+ }
128
+
125
129
  const {
126
130
  key,
127
131
  expiration: allowExpiration
128
132
  } = this.getConfig();
129
133
 
130
- let data = {};
134
+ let data = null;
131
135
 
132
136
  try {
133
137
 
@@ -135,12 +139,16 @@ module.exports = {
135
139
  data = this.decrypt(payload);
136
140
 
137
141
  } catch (e) {
138
- console.log('Invalid Token');
142
+ // invalid token
143
+ }
144
+
145
+ if (!data) {
146
+ return null;
139
147
  }
140
148
 
141
149
  const {
142
150
  expiration
143
- } = data || {};
151
+ } = data;
144
152
 
145
153
  const now = String(Date.now());
146
154
 
@@ -149,14 +157,13 @@ module.exports = {
149
157
  return null;
150
158
  }
151
159
 
152
- // Ignore expiration field
160
+ // Ignore expiration requirement
153
161
  if (allowExpiration === false) {
154
162
  return data;
155
163
  }
156
164
 
157
- // Expiration must be required
165
+ // Expiration field is required
158
166
  if (!expiration) {
159
- console.log('JWT Without expiration date');
160
167
  return null;
161
168
  }
162
169
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulkano/core",
3
- "version": "1.17.2",
3
+ "version": "1.17.3",
4
4
  "description": "A MVC framework using Express 4",
5
5
  "license": "MIT",
6
6
  "author": "Vulkano Team",