node-pluginsmanager-plugin 7.3.1 → 7.4.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.
@@ -0,0 +1,2 @@
1
+ export default class ConflictError extends Error {
2
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // module
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ class ConflictError extends Error {
5
+ }
6
+ exports.default = ConflictError;
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.formateError = exports.LockedError = exports.NotFoundError = exports.UnauthorizedError = exports.Server = exports.Orchestrator = exports.MediatorUser = exports.Mediator = exports.DescriptorUser = exports.checkNonEmptyStringSync = exports.checkNonEmptyString = exports.checkNonEmptyObjectSync = exports.checkNonEmptyObject = exports.checkNonEmptyNumberSync = exports.checkNonEmptyNumber = exports.checkIntegerSync = exports.checkInteger = exports.checkStringSync = exports.checkString = exports.checkObjectSync = exports.checkObject = exports.checkNumberSync = exports.checkNumber = exports.checkFunctionSync = exports.checkFunction = exports.checkExistsSync = exports.checkExists = void 0;
7
+ exports.formateError = exports.UnauthorizedError = exports.NotFoundError = exports.LockedError = exports.ConflictError = exports.Server = exports.Orchestrator = exports.MediatorUser = exports.Mediator = exports.DescriptorUser = exports.isDirectory = exports.readJSONFile = exports.isFile = exports.isPlainObject = exports.checkNonEmptyStringSync = exports.checkNonEmptyString = exports.checkNonEmptyObjectSync = exports.checkNonEmptyObject = exports.checkNonEmptyNumberSync = exports.checkNonEmptyNumber = exports.checkIntegerSync = exports.checkInteger = exports.checkStringSync = exports.checkString = exports.checkObjectSync = exports.checkObject = exports.checkNumberSync = exports.checkNumber = exports.checkFunctionSync = exports.checkFunction = 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; } });
@@ -36,6 +36,15 @@ Object.defineProperty(exports, "checkNonEmptyObjectSync", { enumerable: true, ge
36
36
  const checkNonEmptyString_1 = require("./checkers/RangeError/checkNonEmptyString");
37
37
  Object.defineProperty(exports, "checkNonEmptyString", { enumerable: true, get: function () { return checkNonEmptyString_1.checkNonEmptyString; } });
38
38
  Object.defineProperty(exports, "checkNonEmptyStringSync", { enumerable: true, get: function () { return checkNonEmptyString_1.checkNonEmptyStringSync; } });
39
+ // utils
40
+ const isPlainObject_1 = __importDefault(require("./utils/isPlainObject"));
41
+ exports.isPlainObject = isPlainObject_1.default;
42
+ const isFile_1 = __importDefault(require("./utils/file/isFile"));
43
+ exports.isFile = isFile_1.default;
44
+ const readJSONFile_1 = __importDefault(require("./utils/file/readJSONFile"));
45
+ exports.readJSONFile = readJSONFile_1.default;
46
+ const isDirectory_1 = __importDefault(require("./utils/file/isDirectory"));
47
+ exports.isDirectory = isDirectory_1.default;
39
48
  // components
40
49
  const DescriptorUser_1 = __importDefault(require("./components/DescriptorUser"));
41
50
  exports.DescriptorUser = DescriptorUser_1.default;
@@ -47,11 +56,13 @@ const Orchestrator_1 = __importDefault(require("./components/Orchestrator"));
47
56
  exports.Orchestrator = Orchestrator_1.default;
48
57
  const Server_1 = __importDefault(require("./components/Server"));
49
58
  exports.Server = Server_1.default;
50
- const UnauthorizedError_1 = __importDefault(require("./components/errors/UnauthorizedError"));
51
- exports.UnauthorizedError = UnauthorizedError_1.default;
52
- const NotFoundError_1 = __importDefault(require("./components/errors/NotFoundError"));
53
- exports.NotFoundError = NotFoundError_1.default;
59
+ const ConflictError_1 = __importDefault(require("./components/errors/ConflictError"));
60
+ exports.ConflictError = ConflictError_1.default;
54
61
  const LockedError_1 = __importDefault(require("./components/errors/LockedError"));
55
62
  exports.LockedError = LockedError_1.default;
63
+ const NotFoundError_1 = __importDefault(require("./components/errors/NotFoundError"));
64
+ exports.NotFoundError = NotFoundError_1.default;
65
+ const UnauthorizedError_1 = __importDefault(require("./components/errors/UnauthorizedError"));
66
+ exports.UnauthorizedError = UnauthorizedError_1.default;
56
67
  const formateError_1 = __importDefault(require("./utils/server/formateError"));
57
68
  exports.formateError = formateError_1.default;
@@ -8,14 +8,20 @@ import { checkNonEmptyNumber, checkNonEmptyNumberSync } from "./checkers/RangeEr
8
8
  import { checkNonEmptyObject, checkNonEmptyObjectSync } from "./checkers/RangeError/checkNonEmptyObject";
9
9
  import { checkNonEmptyString, checkNonEmptyStringSync } from "./checkers/RangeError/checkNonEmptyString";
10
10
  export { checkExists, checkExistsSync, checkFunction, checkFunctionSync, checkNumber, checkNumberSync, checkObject, checkObjectSync, checkString, checkStringSync, checkInteger, checkIntegerSync, checkNonEmptyNumber, checkNonEmptyNumberSync, checkNonEmptyObject, checkNonEmptyObjectSync, checkNonEmptyString, checkNonEmptyStringSync };
11
+ import isPlainObject from "./utils/isPlainObject";
12
+ import isFile from "./utils/file/isFile";
13
+ import readJSONFile from "./utils/file/readJSONFile";
14
+ import isDirectory from "./utils/file/isDirectory";
15
+ export { isPlainObject, isFile, readJSONFile, isDirectory };
11
16
  import DescriptorUser, { type iDescriptorUserOptions, type tLogType, type tLogger, type iEventsMinimal } from "./components/DescriptorUser";
12
17
  import Mediator, { type iUrlAllowedParameters } from "./components/Mediator";
13
18
  import MediatorUser, { type iMediatorUserOptions } from "./components/MediatorUser";
14
19
  import Orchestrator, { type iOrchestratorOptions } from "./components/Orchestrator";
15
20
  import Server, { type iClient } from "./components/Server";
16
- import UnauthorizedError from "./components/errors/UnauthorizedError";
17
- import NotFoundError from "./components/errors/NotFoundError";
21
+ import ConflictError from "./components/errors/ConflictError";
18
22
  import LockedError from "./components/errors/LockedError";
23
+ import NotFoundError from "./components/errors/NotFoundError";
24
+ import UnauthorizedError from "./components/errors/UnauthorizedError";
19
25
  import formateError, { type iFormattedError } from "./utils/server/formateError";
20
26
  export type { tLogType, tLogger, iEventsMinimal, iUrlAllowedParameters, iClient };
21
- export { DescriptorUser, type iDescriptorUserOptions, Mediator, MediatorUser, type iMediatorUserOptions, Orchestrator, type iOrchestratorOptions, Server, UnauthorizedError, NotFoundError, LockedError, formateError, type iFormattedError };
27
+ export { DescriptorUser, type iDescriptorUserOptions, Mediator, MediatorUser, type iMediatorUserOptions, Orchestrator, type iOrchestratorOptions, Server, ConflictError, LockedError, NotFoundError, UnauthorizedError, formateError, type iFormattedError };
@@ -0,0 +1 @@
1
+ export default function isDirectory(directoryPath: string): Promise<boolean>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ // deps
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.default = isDirectory;
5
+ // natives
6
+ const node_fs_1 = require("node:fs");
7
+ // locals
8
+ const checkNonEmptyString_1 = require("../../checkers/RangeError/checkNonEmptyString");
9
+ // module
10
+ function isDirectory(directoryPath) {
11
+ return (0, checkNonEmptyString_1.checkNonEmptyString)("directoryPath", directoryPath).then(() => {
12
+ return new Promise((resolve) => {
13
+ (0, node_fs_1.lstat)(directoryPath, (err, stats) => {
14
+ return resolve(Boolean(!err && stats.isDirectory()));
15
+ });
16
+ });
17
+ });
18
+ }
@@ -1 +1 @@
1
- export default function isFile(filename: string): Promise<boolean>;
1
+ export default function isFile(filePath: string): Promise<boolean>;
@@ -7,10 +7,10 @@ const node_fs_1 = require("node:fs");
7
7
  // locals
8
8
  const checkNonEmptyString_1 = require("../../checkers/RangeError/checkNonEmptyString");
9
9
  // module
10
- function isFile(filename) {
11
- return (0, checkNonEmptyString_1.checkNonEmptyString)("filename", filename).then(() => {
10
+ function isFile(filePath) {
11
+ return (0, checkNonEmptyString_1.checkNonEmptyString)("filePath", filePath).then(() => {
12
12
  return new Promise((resolve) => {
13
- (0, node_fs_1.lstat)(filename, (err, stats) => {
13
+ (0, node_fs_1.lstat)(filePath, (err, stats) => {
14
14
  return resolve(Boolean(!err && stats.isFile()));
15
15
  });
16
16
  });
@@ -0,0 +1 @@
1
+ export default function isPlainObject(value: unknown): boolean;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // module
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.default = isPlainObject;
5
+ function isPlainObject(value) {
6
+ if ("object" !== typeof value || null === value) {
7
+ return false;
8
+ }
9
+ return Object.getPrototypeOf(value) === Object.getPrototypeOf({});
10
+ }
@@ -6,6 +6,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.default = formateError;
8
8
  // locals
9
+ const ConflictError_1 = __importDefault(require("../../components/errors/ConflictError"));
9
10
  const LockedError_1 = __importDefault(require("../../components/errors/LockedError"));
10
11
  const NotFoundError_1 = __importDefault(require("../../components/errors/NotFoundError"));
11
12
  const UnauthorizedError_1 = __importDefault(require("../../components/errors/UnauthorizedError"));
@@ -55,6 +56,13 @@ function formateError(err) {
55
56
  "message": (0, cleanSendedError_1.default)(err)
56
57
  };
57
58
  }
59
+ else if (err instanceof ConflictError_1.default) {
60
+ return {
61
+ "httpCode": serverCodes_1.default.CONFLICT,
62
+ "code": "CONFLICT",
63
+ "message": (0, cleanSendedError_1.default)(err)
64
+ };
65
+ }
58
66
  else if (err instanceof LockedError_1.default) {
59
67
  return {
60
68
  "httpCode": serverCodes_1.default.LOCKED,
@@ -8,6 +8,7 @@ declare const _default: {
8
8
  JSON_PARSE: number;
9
9
  UNAUTHORIZED: number;
10
10
  NOT_FOUND: number;
11
+ CONFLICT: number;
11
12
  MISSING_HEADER: number;
12
13
  LOCKED: number;
13
14
  INTERNAL_SERVER_ERROR: number;
@@ -10,6 +10,7 @@ exports.default = {
10
10
  "JSON_PARSE": 400,
11
11
  "UNAUTHORIZED": 401,
12
12
  "NOT_FOUND": 404,
13
+ "CONFLICT": 409,
13
14
  "MISSING_HEADER": 411,
14
15
  "LOCKED": 423,
15
16
  "INTERNAL_SERVER_ERROR": 500,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
 
3
3
  "name": "node-pluginsmanager-plugin",
4
- "version": "7.3.1",
4
+ "version": "7.4.0",
5
5
  "description": "An abstract parent plugin for node-pluginsmanager.",
6
6
 
7
7
  "type": "commonjs",
@@ -54,7 +54,7 @@
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/express": "5.0.6",
57
- "@types/node": "25.9.1",
57
+ "@types/node": "25.9.3",
58
58
  "@types/socket.io": "3.0.2",
59
59
  "@types/uniqid": "5.3.4",
60
60
  "@types/ws": "8.18.1",