not-node 6.5.60 → 6.5.62

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.
@@ -9,7 +9,9 @@
9
9
 
10
10
  */
11
11
 
12
- let { argv } = require("yargs"),
12
+ const yargs = require("yargs"),
13
+ { hideBin } = require("yargs/helpers"),
14
+ argv = yargs(hideBin(process.argv)).parse(),
13
15
  fs = require("fs"),
14
16
  path = require("path"),
15
17
  child_process = require("child_process"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "not-node",
3
- "version": "6.5.60",
3
+ "version": "6.5.62",
4
4
  "description": "node complimentary part for client side notFramework.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -38,7 +38,7 @@
38
38
  "dependencies": {
39
39
  "@bluelovers/deep-diff": "^1.0.3",
40
40
  "@eslint/js": "^10.0.1",
41
- "ajv": "^8.17.1",
41
+ "ajv": "^8.18.0",
42
42
  "body-parser": "^2.2.2",
43
43
  "commander": "^14.0.3",
44
44
  "compression": "^1.8.1",
@@ -46,7 +46,7 @@
46
46
  "connect-redis": "^9.0.0",
47
47
  "cors": "^2.8.6",
48
48
  "deepmerge": "^4.3.1",
49
- "ejs": "^4.0.1",
49
+ "ejs": "^5.0.1",
50
50
  "escape-string-regexp": "*",
51
51
  "express": "^5.2.1",
52
52
  "express-fileupload": "^1.5.2",
@@ -54,17 +54,17 @@
54
54
  "fs-extra": "*",
55
55
  "generate-password": "^1.7.1",
56
56
  "helmet": "^8.1.0",
57
- "inquirer": "^13.2.2",
57
+ "inquirer": "^13.3.0",
58
58
  "inquirer-autocomplete-prompt": "^3.0.1",
59
59
  "jsonwebtoken": "^9.0.3",
60
60
  "method-override": "^3.0.0",
61
61
  "mongoose-validator": "*",
62
62
  "nconf": "*",
63
63
  "rate-limiter-flexible": "^9.1.1",
64
- "redis": "^5.10.0",
64
+ "redis": "^5.11.0",
65
65
  "redlock": "^5.0.0-beta.2",
66
66
  "rfdc": "^1.4.1",
67
- "rimraf": "^6.1.2",
67
+ "rimraf": "^6.1.3",
68
68
  "serve-static": "*",
69
69
  "simple-git": "*",
70
70
  "validator": "*",
@@ -82,21 +82,21 @@
82
82
  "babel-eslint": "^10.1.0",
83
83
  "chai": "*",
84
84
  "chai-as-promised": "*",
85
- "eslint": "^10.0.0",
85
+ "eslint": "^10.0.3",
86
86
  "eslint-plugin-node": "^11.1.0",
87
87
  "husky": "^9.1.7",
88
88
  "ink-docstrap": "^1.3.2",
89
- "ioredis": "^5.9.2",
89
+ "ioredis": "^5.10.0",
90
90
  "jsdoc": "^4.0.5",
91
91
  "mocha": "*",
92
92
  "mocha-suppress-logs": "^0.6.0",
93
93
  "mock-require": "^3.0.3",
94
94
  "mongodb-memory-server": "^11.0.1",
95
- "mongoose": "^9.1.6",
95
+ "mongoose": "^9.3.0",
96
96
  "not-error": "*",
97
97
  "not-validation": "*",
98
98
  "npm-run-all": "^4.1.5",
99
- "nyc": "^17.1.0",
99
+ "nyc": "^18.0.0",
100
100
  "retire": "^5.4.2"
101
101
  },
102
102
  "homepage": "https://github.com/interrupter/not-node#readme",
package/src/common.js CHANGED
@@ -342,17 +342,14 @@ module.exports.generatePaths = (content = [], relative = "src") => {
342
342
  **/
343
343
  module.exports.getIP = (req) => {
344
344
  if (req) {
345
- const ip =
345
+ return (
346
346
  (req.headers && req.headers["x-forwarded-for"]) ||
347
347
  (req.connection && req.connection.remoteAddress) ||
348
348
  (req.socket && req.socket.remoteAddress) ||
349
349
  (req.connection &&
350
350
  req.connection.socket &&
351
- req.connection.socket.remoteAddress);
352
- if (ip && ip.indexOf(",") > -1) {
353
- return ip.split(",")[0];
354
- }
355
- return ip;
351
+ req.connection.socket.remoteAddress)
352
+ );
356
353
  } else {
357
354
  return undefined;
358
355
  }
@@ -2,7 +2,14 @@ module.exports = [
2
2
  ...require("./string"),
3
3
  {
4
4
  validator(val, { validator }) {
5
- return validator.isIP(val);
5
+ if (val.indexOf(",") > -1) {
6
+ return val
7
+ .split(",")
8
+ .map((ip) => ip.trim())
9
+ .every((ip) => validator.isIP(ip));
10
+ } else {
11
+ return validator.isIP(val);
12
+ }
6
13
  },
7
14
  message: "not-node:value_is_not_ip_address",
8
15
  },
@@ -95,8 +95,13 @@ module.exports = class InitENV {
95
95
  );
96
96
  }
97
97
 
98
- static initFromTemplate({ config, master }) {
99
- InitENV.CONFIG_SET.forEach((item) => {
98
+ static initFromTemplate({ options, config, master }) {
99
+ const CUSTOM_SET =
100
+ options?.customPaths && Array.isArray(options?.customPaths)
101
+ ? options?.customPaths
102
+ : [];
103
+ const ALL_CONFIGS_SET = [...InitENV.CONFIG_SET, ...CUSTOM_SET];
104
+ ALL_CONFIGS_SET.forEach((item) => {
100
105
  InitENV.setObsoleteAndNew({
101
106
  config,
102
107
  master,
@@ -113,7 +118,7 @@ module.exports = class InitENV {
113
118
  master.setEnv("hostname", config.get("hostname"));
114
119
  master.setEnv("server", `https://` + config.get("host"));
115
120
 
116
- InitENV.initFromTemplate({ config, master });
121
+ InitENV.initFromTemplate({ config, master, options });
117
122
 
118
123
  config.set(
119
124
  "appPath",
@@ -675,7 +675,12 @@ describe("Core Validators", () => {
675
675
  });
676
676
  });
677
677
 
678
- const listOfValidValues = ["127.0.1.1", "10.8.1.10", "0.0.0.0"];
678
+ const listOfValidValues = [
679
+ "127.0.1.1",
680
+ "10.8.1.10",
681
+ "0.0.0.0",
682
+ "123.1.1.4, 192.123.4.1",
683
+ ];
679
684
  listOfValidValues.forEach((val) => {
680
685
  it(
681
686
  "valid: " + val,