ti2 1.0.24 → 1.0.27

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.
Files changed (3) hide show
  1. package/cache.js +11 -0
  2. package/index.js +6 -5
  3. package/package.json +1 -1
package/cache.js CHANGED
@@ -55,8 +55,19 @@ const getOrExec = async ({
55
55
  return value;
56
56
  };
57
57
 
58
+ const drop = async ({
59
+ pluginName,
60
+ fn,
61
+ fnParams,
62
+ }) => {
63
+ let key = hash({ fn, fnParams });
64
+ key = `${pluginName}:${key}`;
65
+ await cache.del(key);
66
+ };
67
+
58
68
  module.exports = {
59
69
  cache,
60
70
  save,
61
71
  getOrExec,
72
+ drop,
62
73
  };
package/index.js CHANGED
@@ -203,12 +203,13 @@ module.exports = async ({
203
203
  app.use(middleware.mock());
204
204
  // global error Handling
205
205
  app.use((err, req, res) => {
206
- // console.log(req.headers.['X-Request-Id'], err);
207
- res.status(err.status || 500);
208
- if ((process.env.JEST_WORKER_ID)) {
209
- console.debug(err);
206
+ if (process.env.CONSOLE_ERRORS || process.env.JEST_WORKER_ID) {
207
+ console.error(err);
210
208
  }
211
- return res.json({
209
+ return res.status((() => {
210
+ if (isNan(err.status)) return 500;
211
+ return parseInt(err.status, 10);
212
+ })()).json({
212
213
  message: err.message || 'Internal Error',
213
214
  });
214
215
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ti2",
3
- "version": "1.0.24",
3
+ "version": "1.0.27",
4
4
  "description": "Tourist Industry Exchange (TI2)",
5
5
  "main": "index.js",
6
6
  "scripts": {