node-pluginsmanager-plugin 6.2.3 → 6.3.0
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/lib/cjs/components/Server.d.ts +1 -1
- package/lib/cjs/components/Server.js +27 -1
- package/lib/cjs/components/errors/LockedError.d.ts +2 -0
- package/lib/cjs/components/errors/LockedError.js +6 -0
- package/lib/cjs/components/errors/UnauthorizedError.d.ts +2 -0
- package/lib/cjs/components/errors/UnauthorizedError.js +6 -0
- package/lib/cjs/main.cjs +7 -3
- package/lib/cjs/main.d.cts +4 -2
- package/lib/cjs/utils/serverCodes.d.ts +2 -0
- package/lib/cjs/utils/serverCodes.js +2 -0
- package/package.json +1 -1
- /package/lib/cjs/components/{NotFoundError.d.ts → errors/NotFoundError.d.ts} +0 -0
- /package/lib/cjs/components/{NotFoundError.js → errors/NotFoundError.js} +0 -0
|
@@ -41,7 +41,7 @@ export default class Server extends MediatorUser {
|
|
|
41
41
|
socketMiddleware(socketServer: WebSocketServer | SocketIOServer): void;
|
|
42
42
|
push(command: string, data?: any, log?: boolean): this;
|
|
43
43
|
getClients(): iClient[];
|
|
44
|
-
pushClient(clientId: string, command: string, data
|
|
44
|
+
pushClient(clientId: string, command: string, data?: any, log?: boolean): this;
|
|
45
45
|
init(...data: any): Promise<void>;
|
|
46
46
|
release(...data: any): Promise<void>;
|
|
47
47
|
}
|
|
@@ -24,7 +24,9 @@ const jsonParser_1 = __importDefault(require("../utils/jsonParser"));
|
|
|
24
24
|
const send_1 = __importDefault(require("../utils/send"));
|
|
25
25
|
const cleanSendedError_1 = __importDefault(require("../utils/cleanSendedError"));
|
|
26
26
|
const MediatorUser_1 = __importDefault(require("./MediatorUser"));
|
|
27
|
-
const
|
|
27
|
+
const UnauthorizedError_1 = __importDefault(require("./errors/UnauthorizedError"));
|
|
28
|
+
const NotFoundError_1 = __importDefault(require("./errors/NotFoundError"));
|
|
29
|
+
const LockedError_1 = __importDefault(require("./errors/LockedError"));
|
|
28
30
|
const serverCodes_1 = __importDefault(require("../utils/serverCodes"));
|
|
29
31
|
// consts
|
|
30
32
|
const WEBSOCKET_STATE_OPEN = 1;
|
|
@@ -409,6 +411,18 @@ class Server extends MediatorUser_1.default {
|
|
|
409
411
|
"mime": (0, extractMime_1.default)(contentType, serverCodes_1.default.JSON_PARSE, responses)
|
|
410
412
|
});
|
|
411
413
|
}
|
|
414
|
+
else if (err instanceof UnauthorizedError_1.default) {
|
|
415
|
+
const result = JSON.stringify({
|
|
416
|
+
"code": "UNAUTHORIZED",
|
|
417
|
+
"message": (0, cleanSendedError_1.default)(err)
|
|
418
|
+
});
|
|
419
|
+
this._log("error", "<= [" + req.validatedIp + "] " + result);
|
|
420
|
+
return (0, send_1.default)(req, res, serverCodes_1.default.UNAUTHORIZED, result, {
|
|
421
|
+
"apiVersion": apiVersion,
|
|
422
|
+
"cors": this._cors,
|
|
423
|
+
"mime": (0, extractMime_1.default)(contentType, serverCodes_1.default.UNAUTHORIZED, responses)
|
|
424
|
+
});
|
|
425
|
+
}
|
|
412
426
|
else if (err instanceof NotFoundError_1.default) {
|
|
413
427
|
const result = JSON.stringify({
|
|
414
428
|
"code": "NOT_FOUND",
|
|
@@ -421,6 +435,18 @@ class Server extends MediatorUser_1.default {
|
|
|
421
435
|
"mime": (0, extractMime_1.default)(contentType, serverCodes_1.default.NOT_FOUND, responses)
|
|
422
436
|
});
|
|
423
437
|
}
|
|
438
|
+
else if (err instanceof LockedError_1.default) {
|
|
439
|
+
const result = JSON.stringify({
|
|
440
|
+
"code": "LOCKED",
|
|
441
|
+
"message": (0, cleanSendedError_1.default)(err)
|
|
442
|
+
});
|
|
443
|
+
this._log("error", "<= [" + req.validatedIp + "] " + result);
|
|
444
|
+
return (0, send_1.default)(req, res, serverCodes_1.default.LOCKED, result, {
|
|
445
|
+
"apiVersion": apiVersion,
|
|
446
|
+
"cors": this._cors,
|
|
447
|
+
"mime": (0, extractMime_1.default)(contentType, serverCodes_1.default.LOCKED, responses)
|
|
448
|
+
});
|
|
449
|
+
}
|
|
424
450
|
else {
|
|
425
451
|
this._log("error", err);
|
|
426
452
|
const result = JSON.stringify({
|
package/lib/cjs/main.cjs
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
7
|
+
exports.LockedError = exports.NotFoundError = exports.UnauthorizedError = exports.Server = exports.Orchestrator = exports.MediatorUser = exports.Mediator = exports.DescriptorUser = exports.checkArrayLengthBetweenSync = exports.checkArrayLengthBetween = exports.checkArrayLengthSync = exports.checkArrayLength = exports.checkIntegerBetweenSync = exports.checkIntegerBetween = exports.checkStringLengthBetweenSync = exports.checkStringLengthBetween = exports.checkStringLengthSync = exports.checkStringLength = exports.checkObjectLengthBetweenSync = exports.checkObjectLengthBetween = exports.checkObjectLengthSync = exports.checkObjectLength = exports.checkNumberBetweenSync = exports.checkNumberBetween = exports.checkNonEmptyStringSync = exports.checkNonEmptyString = exports.checkNonEmptyObjectSync = exports.checkNonEmptyObject = exports.checkNonEmptyNumberSync = exports.checkNonEmptyNumber = exports.checkNonEmptyIntegerSync = exports.checkNonEmptyInteger = exports.checkNonEmptyArraySync = exports.checkNonEmptyArray = exports.checkIntegerSync = exports.checkInteger = exports.checkArraySync = exports.checkArray = exports.checkStringSync = exports.checkString = exports.checkObjectSync = exports.checkObject = exports.checkNumberSync = exports.checkNumber = exports.checkFunctionSync = exports.checkFunction = exports.checkBooleanSync = exports.checkBoolean = exports.checkExistsSync = exports.checkExists = void 0;
|
|
8
8
|
// undefined
|
|
9
9
|
const checkExists_1 = require("./checkers/ReferenceError/checkExists");
|
|
10
10
|
Object.defineProperty(exports, "checkExists", { enumerable: true, get: function () { return checkExists_1.checkExists; } });
|
|
@@ -82,9 +82,13 @@ const Mediator_1 = __importDefault(require("./components/Mediator"));
|
|
|
82
82
|
exports.Mediator = Mediator_1.default;
|
|
83
83
|
const MediatorUser_1 = __importDefault(require("./components/MediatorUser"));
|
|
84
84
|
exports.MediatorUser = MediatorUser_1.default;
|
|
85
|
-
const NotFoundError_1 = __importDefault(require("./components/NotFoundError"));
|
|
86
|
-
exports.NotFoundError = NotFoundError_1.default;
|
|
87
85
|
const Orchestrator_1 = __importDefault(require("./components/Orchestrator"));
|
|
88
86
|
exports.Orchestrator = Orchestrator_1.default;
|
|
89
87
|
const Server_1 = __importDefault(require("./components/Server"));
|
|
90
88
|
exports.Server = Server_1.default;
|
|
89
|
+
const UnauthorizedError_1 = __importDefault(require("./components/errors/UnauthorizedError"));
|
|
90
|
+
exports.UnauthorizedError = UnauthorizedError_1.default;
|
|
91
|
+
const NotFoundError_1 = __importDefault(require("./components/errors/NotFoundError"));
|
|
92
|
+
exports.NotFoundError = NotFoundError_1.default;
|
|
93
|
+
const LockedError_1 = __importDefault(require("./components/errors/LockedError"));
|
|
94
|
+
exports.LockedError = LockedError_1.default;
|
package/lib/cjs/main.d.cts
CHANGED
|
@@ -23,8 +23,10 @@ export { checkExists, checkExistsSync, checkBoolean, checkBooleanSync, checkFunc
|
|
|
23
23
|
import DescriptorUser, { type iDescriptorUserOptions, type tLogType, type tLogger } from "./components/DescriptorUser";
|
|
24
24
|
import Mediator, { type iUrlParameters } from "./components/Mediator";
|
|
25
25
|
import MediatorUser, { type iMediatorUserOptions } from "./components/MediatorUser";
|
|
26
|
-
import NotFoundError from "./components/NotFoundError";
|
|
27
26
|
import Orchestrator, { type iOrchestratorOptions } from "./components/Orchestrator";
|
|
28
27
|
import Server, { type iClient, type iIncomingMessage, type iServerResponse } from "./components/Server";
|
|
28
|
+
import UnauthorizedError from "./components/errors/UnauthorizedError";
|
|
29
|
+
import NotFoundError from "./components/errors/NotFoundError";
|
|
30
|
+
import LockedError from "./components/errors/LockedError";
|
|
29
31
|
export type { tLogType, tLogger, iUrlParameters, iClient, iIncomingMessage, iServerResponse };
|
|
30
|
-
export { DescriptorUser, type iDescriptorUserOptions, Mediator, MediatorUser, type iMediatorUserOptions,
|
|
32
|
+
export { DescriptorUser, type iDescriptorUserOptions, Mediator, MediatorUser, type iMediatorUserOptions, Orchestrator, type iOrchestratorOptions, Server, UnauthorizedError, NotFoundError, LockedError };
|
|
@@ -6,8 +6,10 @@ declare const _default: {
|
|
|
6
6
|
WRONG_TYPE_PARAMETER: number;
|
|
7
7
|
EMPTY_OR_RANGE_OR_ENUM_PARAMETER: number;
|
|
8
8
|
JSON_PARSE: number;
|
|
9
|
+
UNAUTHORIZED: number;
|
|
9
10
|
NOT_FOUND: number;
|
|
10
11
|
MISSING_HEADER: number;
|
|
12
|
+
LOCKED: number;
|
|
11
13
|
INTERNAL_SERVER_ERROR: number;
|
|
12
14
|
NOT_IMPLEMENTED: number;
|
|
13
15
|
};
|
|
@@ -8,8 +8,10 @@ exports.default = {
|
|
|
8
8
|
"WRONG_TYPE_PARAMETER": 400,
|
|
9
9
|
"EMPTY_OR_RANGE_OR_ENUM_PARAMETER": 400,
|
|
10
10
|
"JSON_PARSE": 400,
|
|
11
|
+
"UNAUTHORIZED": 401,
|
|
11
12
|
"NOT_FOUND": 404,
|
|
12
13
|
"MISSING_HEADER": 411,
|
|
14
|
+
"LOCKED": 423,
|
|
13
15
|
"INTERNAL_SERVER_ERROR": 500,
|
|
14
16
|
"NOT_IMPLEMENTED": 501
|
|
15
17
|
};
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|