node-pluginsmanager-plugin 4.8.2 → 4.8.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.
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ // module
4
+
5
+ module.exports = class NotFoundError extends Error {};
@@ -16,6 +16,7 @@
16
16
 
17
17
  // locals
18
18
  const MediatorUser = require(join(__dirname, "MediatorUser.js"));
19
+ const NotFoundError = require(join(__dirname, "NotFoundError.js"));
19
20
  const { checkInteger, checkNonEmptyObject, checkNonEmptyString } = require(join(__dirname, "..", "checkers", "main.js"));
20
21
  const { extractPattern, extractParams, extractSchemaType } = require(join(__dirname, "..", "utils", "descriptor", "main.js"));
21
22
  const { extractBody, extractIp, extractCookies } = require(join(__dirname, "..", "utils", "request", "main.js"));
@@ -486,6 +487,17 @@ module.exports = class Server extends MediatorUser {
486
487
  this._log("error", "<= [" + req.validatedIp + "] " + JSON.stringify(result));
487
488
  return send(req, res, SERVER_CODES.JSON_PARSE, result, this._Descriptor.info.version, this._cors);
488
489
 
490
+ }
491
+ else if (err instanceof NotFoundError) {
492
+
493
+ const result = {
494
+ "code": "NOT_FOUND",
495
+ "message": cleanSendedError(err)
496
+ };
497
+
498
+ this._log("error", "<= [" + req.validatedIp + "] " + JSON.stringify(result));
499
+ return send(req, res, SERVER_CODES.NOT_FOUND, result, this._Descriptor.info.version, this._cors);
500
+
489
501
  }
490
502
  else {
491
503
 
@@ -11,6 +11,7 @@
11
11
  const MediatorUser = require(join(__dirname, "MediatorUser.js"));
12
12
  const Orchestrator = require(join(__dirname, "Orchestrator.js"));
13
13
  const Server = require(join(__dirname, "Server.js"));
14
+ const NotFoundError = require(join(__dirname, "NotFoundError.js"));
14
15
 
15
16
  // module
16
17
 
@@ -19,5 +20,6 @@ module.exports = {
19
20
  Mediator,
20
21
  MediatorUser,
21
22
  Orchestrator,
22
- Server
23
+ Server,
24
+ NotFoundError
23
25
  };
package/lib/index.d.ts CHANGED
@@ -206,4 +206,6 @@ declare module "node-pluginsmanager-plugin" {
206
206
 
207
207
  }
208
208
 
209
+ export class NotFoundError extends Error {}
210
+
209
211
  }
@@ -8,6 +8,7 @@
8
8
  "WRONG_TYPE_PARAMETER": 400,
9
9
  "EMPTY_OR_RANGE_OR_ENUM_PARAMETER": 400,
10
10
  "JSON_PARSE": 400,
11
+ "NOT_FOUND": 404,
11
12
  "MISSING_HEADER": 411,
12
13
 
13
14
  "INTERNAL_SERVER_ERROR": 500,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-pluginsmanager-plugin",
3
- "version": "4.8.2",
3
+ "version": "4.8.3",
4
4
  "description": "An abstract parent plugin for node-pluginsmanager",
5
5
  "main": "lib/main.js",
6
6
  "typings": "lib/index.d.ts",
@@ -39,19 +39,19 @@
39
39
  "express-openapi-validate": "0.6.1"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/node": "17.0.25",
42
+ "@types/node": "17.0.29",
43
43
  "@types/socket.io": "3.0.2",
44
44
  "@types/ws": "8.5.3",
45
45
  "check-version-modules": "1.3.5",
46
46
  "coveralls": "3.1.1",
47
47
  "colors": "1.4.0",
48
- "eslint": "8.13.0",
49
- "express": "4.17.3",
48
+ "eslint": "8.14.0",
49
+ "express": "4.18.0",
50
50
  "husky": "7.0.4",
51
51
  "mocha": "9.2.2",
52
52
  "nyc": "15.1.0",
53
- "socket.io": "4.4.1",
54
- "socket.io-client": "4.4.1",
53
+ "socket.io": "4.5.0",
54
+ "socket.io-client": "4.5.0",
55
55
  "typescript": "4.6.3",
56
56
  "ws": "8.5.0"
57
57
  },