From 6d706aa8cfefd4b71abac9cedeb8e4d15e29f6c3 Mon Sep 17 00:00:00 2001 From: petruki <31597636+petruki@users.noreply.github.com> Date: Thu, 2 Oct 2025 22:04:03 -0700 Subject: [PATCH] chore: fixes code smells --- npm-shrinkwrap.json | 707 ++++++++++++------------- package.json | 6 +- src/aggregator/permission-resolvers.js | 6 +- src/aggregator/resolvers.js | 4 +- src/app-server.js | 6 +- src/external/gitops.js | 2 +- src/helpers/index.js | 32 +- src/middleware/gitops.js | 4 +- src/middleware/limiter.js | 4 +- src/middleware/validators.js | 2 +- src/models/admin.js | 34 +- src/models/common/index.js | 2 +- src/models/component.js | 24 +- src/models/config-strategy.js | 43 +- src/models/config.js | 20 +- src/models/domain.js | 18 +- src/models/group-config.js | 8 +- src/models/slack.js | 3 +- src/models/team.js | 17 +- src/routers/common/index.js | 4 +- src/routers/component.js | 4 +- src/routers/config-strategy.js | 4 +- src/routers/config.js | 4 +- src/routers/domain.js | 4 +- src/routers/environment.js | 4 +- src/routers/gitops.js | 4 +- src/routers/group-config.js | 4 +- src/routers/metric.js | 2 +- src/services/config.js | 2 +- src/services/domain.js | 2 +- src/services/history.js | 4 +- src/services/metric.js | 18 +- src/services/permission.js | 4 +- src/services/relay.js | 2 +- src/services/team.js | 4 +- tests/config-strategy.test.js | 4 +- tests/fixtures/db_api.js | 2 +- tests/fixtures/db_client.js | 2 +- tests/fixtures/db_client_payload.js | 2 +- tests/fixtures/db_metrics.js | 2 +- 40 files changed, 475 insertions(+), 549 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index cb2d4787..cc784639 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -25,9 +25,9 @@ "jsonwebtoken": "^9.0.2", "moment": "^2.30.1", "mongodb": "^6.20.0", - "mongoose": "^8.18.2", + "mongoose": "^8.19.0", "passport": "^0.7.0", - "pino": "^9.11.0", + "pino": "^9.13.0", "pino-pretty": "^13.1.1", "swagger-ui-express": "^5.0.1", "switcher-client": "^4.4.1", @@ -36,7 +36,7 @@ "devDependencies": { "env-cmd": "^11.0.0", "eslint": "^9.36.0", - "jest": "^30.1.3", + "jest": "^30.2.0", "jest-sonar-reporter": "^2.0.0", "node-notifier": "^10.0.1", "nodemon": "^3.1.10", @@ -913,17 +913,17 @@ } }, "node_modules/@jest/console": { - "version": "30.1.2", - "resolved": "https://registry.npmjs.org/@jest/console/-/console-30.1.2.tgz", - "integrity": "sha512-BGMAxj8VRmoD0MoA/jo9alMXSRoqW8KPeqOfEo1ncxnRLatTBCpRoOwlwlEMdudp68Q6WSGwYrrLtTGOh8fLzw==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-30.2.0.tgz", + "integrity": "sha512-+O1ifRjkvYIkBqASKWgLxrpEhQAAE7hY77ALLUufSk5717KfOShg6IbqLmdsLMPdUiFvA2kTs0R7YZy+l0IzZQ==", "dev": true, "license": "MIT", "dependencies": { - "@jest/types": "30.0.5", + "@jest/types": "30.2.0", "@types/node": "*", "chalk": "^4.1.2", - "jest-message-util": "30.1.0", - "jest-util": "30.0.5", + "jest-message-util": "30.2.0", + "jest-util": "30.2.0", "slash": "^3.0.0" }, "engines": { @@ -931,39 +931,39 @@ } }, "node_modules/@jest/core": { - "version": "30.1.3", - "resolved": "https://registry.npmjs.org/@jest/core/-/core-30.1.3.tgz", - "integrity": "sha512-LIQz7NEDDO1+eyOA2ZmkiAyYvZuo6s1UxD/e2IHldR6D7UYogVq3arTmli07MkENLq6/3JEQjp0mA8rrHHJ8KQ==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-30.2.0.tgz", + "integrity": "sha512-03W6IhuhjqTlpzh/ojut/pDB2LPRygyWX8ExpgHtQA8H/3K7+1vKmcINx5UzeOX1se6YEsBsOHQ1CRzf3fOwTQ==", "dev": true, "license": "MIT", "dependencies": { - "@jest/console": "30.1.2", + "@jest/console": "30.2.0", "@jest/pattern": "30.0.1", - "@jest/reporters": "30.1.3", - "@jest/test-result": "30.1.3", - "@jest/transform": "30.1.2", - "@jest/types": "30.0.5", + "@jest/reporters": "30.2.0", + "@jest/test-result": "30.2.0", + "@jest/transform": "30.2.0", + "@jest/types": "30.2.0", "@types/node": "*", "ansi-escapes": "^4.3.2", "chalk": "^4.1.2", "ci-info": "^4.2.0", "exit-x": "^0.2.2", "graceful-fs": "^4.2.11", - "jest-changed-files": "30.0.5", - "jest-config": "30.1.3", - "jest-haste-map": "30.1.0", - "jest-message-util": "30.1.0", + "jest-changed-files": "30.2.0", + "jest-config": "30.2.0", + "jest-haste-map": "30.2.0", + "jest-message-util": "30.2.0", "jest-regex-util": "30.0.1", - "jest-resolve": "30.1.3", - "jest-resolve-dependencies": "30.1.3", - "jest-runner": "30.1.3", - "jest-runtime": "30.1.3", - "jest-snapshot": "30.1.2", - "jest-util": "30.0.5", - "jest-validate": "30.1.0", - "jest-watcher": "30.1.3", + "jest-resolve": "30.2.0", + "jest-resolve-dependencies": "30.2.0", + "jest-runner": "30.2.0", + "jest-runtime": "30.2.0", + "jest-snapshot": "30.2.0", + "jest-util": "30.2.0", + "jest-validate": "30.2.0", + "jest-watcher": "30.2.0", "micromatch": "^4.0.8", - "pretty-format": "30.0.5", + "pretty-format": "30.2.0", "slash": "^3.0.0" }, "engines": { @@ -989,39 +989,39 @@ } }, "node_modules/@jest/environment": { - "version": "30.1.2", - "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-30.1.2.tgz", - "integrity": "sha512-N8t1Ytw4/mr9uN28OnVf0SYE2dGhaIxOVYcwsf9IInBKjvofAjbFRvedvBBlyTYk2knbJTiEjEJ2PyyDIBnd9w==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-30.2.0.tgz", + "integrity": "sha512-/QPTL7OBJQ5ac09UDRa3EQes4gt1FTEG/8jZ/4v5IVzx+Cv7dLxlVIvfvSVRiiX2drWyXeBjkMSR8hvOWSog5g==", "dev": true, "license": "MIT", "dependencies": { - "@jest/fake-timers": "30.1.2", - "@jest/types": "30.0.5", + "@jest/fake-timers": "30.2.0", + "@jest/types": "30.2.0", "@types/node": "*", - "jest-mock": "30.0.5" + "jest-mock": "30.2.0" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/expect": { - "version": "30.1.2", - "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-30.1.2.tgz", - "integrity": "sha512-tyaIExOwQRCxPCGNC05lIjWJztDwk2gPDNSDGg1zitXJJ8dC3++G/CRjE5mb2wQsf89+lsgAgqxxNpDLiCViTA==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-30.2.0.tgz", + "integrity": "sha512-V9yxQK5erfzx99Sf+7LbhBwNWEZ9eZay8qQ9+JSC0TrMR1pMDHLMY+BnVPacWU6Jamrh252/IKo4F1Xn/zfiqA==", "dev": true, "license": "MIT", "dependencies": { - "expect": "30.1.2", - "jest-snapshot": "30.1.2" + "expect": "30.2.0", + "jest-snapshot": "30.2.0" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/expect-utils": { - "version": "30.1.2", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-30.1.2.tgz", - "integrity": "sha512-HXy1qT/bfdjCv7iC336ExbqqYtZvljrV8odNdso7dWK9bSeHtLlvwWWC3YSybSPL03Gg5rug6WLCZAZFH72m0A==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-30.2.0.tgz", + "integrity": "sha512-1JnRfhqpD8HGpOmQp180Fo9Zt69zNtC+9lR+kT7NVL05tNXIi+QC8Csz7lfidMoVLPD3FnOtcmp0CEFnxExGEA==", "dev": true, "license": "MIT", "dependencies": { @@ -1032,18 +1032,18 @@ } }, "node_modules/@jest/fake-timers": { - "version": "30.1.2", - "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-30.1.2.tgz", - "integrity": "sha512-Beljfv9AYkr9K+ETX9tvV61rJTY706BhBUtiaepQHeEGfe0DbpvUA5Z3fomwc5Xkhns6NWrcFDZn+72fLieUnA==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-30.2.0.tgz", + "integrity": "sha512-HI3tRLjRxAbBy0VO8dqqm7Hb2mIa8d5bg/NJkyQcOk7V118ObQML8RC5luTF/Zsg4474a+gDvhce7eTnP4GhYw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/types": "30.0.5", + "@jest/types": "30.2.0", "@sinonjs/fake-timers": "^13.0.0", "@types/node": "*", - "jest-message-util": "30.1.0", - "jest-mock": "30.0.5", - "jest-util": "30.0.5" + "jest-message-util": "30.2.0", + "jest-mock": "30.2.0", + "jest-util": "30.2.0" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" @@ -1060,16 +1060,16 @@ } }, "node_modules/@jest/globals": { - "version": "30.1.2", - "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-30.1.2.tgz", - "integrity": "sha512-teNTPZ8yZe3ahbYnvnVRDeOjr+3pu2uiAtNtrEsiMjVPPj+cXd5E/fr8BL7v/T7F31vYdEHrI5cC/2OoO/vM9A==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-30.2.0.tgz", + "integrity": "sha512-b63wmnKPaK+6ZZfpYhz9K61oybvbI1aMcIs80++JI1O1rR1vaxHUCNqo3ITu6NU0d4V34yZFoHMn/uoKr/Rwfw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/environment": "30.1.2", - "@jest/expect": "30.1.2", - "@jest/types": "30.0.5", - "jest-mock": "30.0.5" + "@jest/environment": "30.2.0", + "@jest/expect": "30.2.0", + "@jest/types": "30.2.0", + "jest-mock": "30.2.0" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" @@ -1090,17 +1090,17 @@ } }, "node_modules/@jest/reporters": { - "version": "30.1.3", - "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-30.1.3.tgz", - "integrity": "sha512-VWEQmJWfXMOrzdFEOyGjUEOuVXllgZsoPtEHZzfdNz18RmzJ5nlR6kp8hDdY8dDS1yGOXAY7DHT+AOHIPSBV0w==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-30.2.0.tgz", + "integrity": "sha512-DRyW6baWPqKMa9CzeiBjHwjd8XeAyco2Vt8XbcLFjiwCOEKOvy82GJ8QQnJE9ofsxCMPjH4MfH8fCWIHHDKpAQ==", "dev": true, "license": "MIT", "dependencies": { "@bcoe/v8-coverage": "^0.2.3", - "@jest/console": "30.1.2", - "@jest/test-result": "30.1.3", - "@jest/transform": "30.1.2", - "@jest/types": "30.0.5", + "@jest/console": "30.2.0", + "@jest/test-result": "30.2.0", + "@jest/transform": "30.2.0", + "@jest/types": "30.2.0", "@jridgewell/trace-mapping": "^0.3.25", "@types/node": "*", "chalk": "^4.1.2", @@ -1113,9 +1113,9 @@ "istanbul-lib-report": "^3.0.0", "istanbul-lib-source-maps": "^5.0.0", "istanbul-reports": "^3.1.3", - "jest-message-util": "30.1.0", - "jest-util": "30.0.5", - "jest-worker": "30.1.0", + "jest-message-util": "30.2.0", + "jest-util": "30.2.0", + "jest-worker": "30.2.0", "slash": "^3.0.0", "string-length": "^4.0.2", "v8-to-istanbul": "^9.0.1" @@ -1146,13 +1146,13 @@ } }, "node_modules/@jest/snapshot-utils": { - "version": "30.1.2", - "resolved": "https://registry.npmjs.org/@jest/snapshot-utils/-/snapshot-utils-30.1.2.tgz", - "integrity": "sha512-vHoMTpimcPSR7OxS2S0V1Cpg8eKDRxucHjoWl5u4RQcnxqQrV3avETiFpl8etn4dqxEGarBeHbIBety/f8mLXw==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/snapshot-utils/-/snapshot-utils-30.2.0.tgz", + "integrity": "sha512-0aVxM3RH6DaiLcjj/b0KrIBZhSX1373Xci4l3cW5xiUWPctZ59zQ7jj4rqcJQ/Z8JuN/4wX3FpJSa3RssVvCug==", "dev": true, "license": "MIT", "dependencies": { - "@jest/types": "30.0.5", + "@jest/types": "30.2.0", "chalk": "^4.1.2", "graceful-fs": "^4.2.11", "natural-compare": "^1.4.0" @@ -1177,14 +1177,14 @@ } }, "node_modules/@jest/test-result": { - "version": "30.1.3", - "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-30.1.3.tgz", - "integrity": "sha512-P9IV8T24D43cNRANPPokn7tZh0FAFnYS2HIfi5vK18CjRkTDR9Y3e1BoEcAJnl4ghZZF4Ecda4M/k41QkvurEQ==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-30.2.0.tgz", + "integrity": "sha512-RF+Z+0CCHkARz5HT9mcQCBulb1wgCP3FBvl9VFokMX27acKphwyQsNuWH3c+ojd1LeWBLoTYoxF0zm6S/66mjg==", "dev": true, "license": "MIT", "dependencies": { - "@jest/console": "30.1.2", - "@jest/types": "30.0.5", + "@jest/console": "30.2.0", + "@jest/types": "30.2.0", "@types/istanbul-lib-coverage": "^2.0.6", "collect-v8-coverage": "^1.0.2" }, @@ -1193,15 +1193,15 @@ } }, "node_modules/@jest/test-sequencer": { - "version": "30.1.3", - "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-30.1.3.tgz", - "integrity": "sha512-82J+hzC0qeQIiiZDThh+YUadvshdBswi5nuyXlEmXzrhw5ZQSRHeQ5LpVMD/xc8B3wPePvs6VMzHnntxL+4E3w==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-30.2.0.tgz", + "integrity": "sha512-wXKgU/lk8fKXMu/l5Hog1R61bL4q5GCdT6OJvdAFz1P+QrpoFuLU68eoKuVc4RbrTtNnTL5FByhWdLgOPSph+Q==", "dev": true, "license": "MIT", "dependencies": { - "@jest/test-result": "30.1.3", + "@jest/test-result": "30.2.0", "graceful-fs": "^4.2.11", - "jest-haste-map": "30.1.0", + "jest-haste-map": "30.2.0", "slash": "^3.0.0" }, "engines": { @@ -1209,23 +1209,23 @@ } }, "node_modules/@jest/transform": { - "version": "30.1.2", - "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-30.1.2.tgz", - "integrity": "sha512-UYYFGifSgfjujf1Cbd3iU/IQoSd6uwsj8XHj5DSDf5ERDcWMdJOPTkHWXj4U+Z/uMagyOQZ6Vne8C4nRIrCxqA==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-30.2.0.tgz", + "integrity": "sha512-XsauDV82o5qXbhalKxD7p4TZYYdwcaEXC77PPD2HixEFF+6YGppjrAAQurTl2ECWcEomHBMMNS9AH3kcCFx8jA==", "dev": true, "license": "MIT", "dependencies": { "@babel/core": "^7.27.4", - "@jest/types": "30.0.5", + "@jest/types": "30.2.0", "@jridgewell/trace-mapping": "^0.3.25", - "babel-plugin-istanbul": "^7.0.0", + "babel-plugin-istanbul": "^7.0.1", "chalk": "^4.1.2", "convert-source-map": "^2.0.0", "fast-json-stable-stringify": "^2.1.0", "graceful-fs": "^4.2.11", - "jest-haste-map": "30.1.0", + "jest-haste-map": "30.2.0", "jest-regex-util": "30.0.1", - "jest-util": "30.0.5", + "jest-util": "30.2.0", "micromatch": "^4.0.8", "pirates": "^4.0.7", "slash": "^3.0.0", @@ -1236,9 +1236,9 @@ } }, "node_modules/@jest/types": { - "version": "30.0.5", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-30.0.5.tgz", - "integrity": "sha512-aREYa3aku9SSnea4aX6bhKn4bgv3AXkgijoQgbYV3yvbiGt6z+MQ85+6mIhx9DsKW2BuB/cLR/A+tcMThx+KLQ==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-30.2.0.tgz", + "integrity": "sha512-H9xg1/sfVvyfU7o3zMfBEjQ1gcsdeTMgqHoYdN79tuLqfTtuu7WckRA1R5whDwOzxaZAeMKTYWqP+WCAi0CHsg==", "dev": true, "license": "MIT", "dependencies": { @@ -1636,12 +1636,12 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "24.5.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.5.2.tgz", - "integrity": "sha512-FYxk1I7wPv3K2XBaoyH2cTnocQEu8AOZ60hPbsyukMPLv5/5qr7V1i8PLHdl6Zf87I+xZXFvPCXYjiTFq+YSDQ==", + "version": "24.6.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.6.2.tgz", + "integrity": "sha512-d2L25Y4j+W3ZlNAeMKcy7yDsK425ibcAOO2t7aPTz6gNMH0z2GThtwENCDc0d/Pw9wgyRqE5Px1wkV7naz8ang==", "license": "MIT", "dependencies": { - "undici-types": "~7.12.0" + "undici-types": "~7.13.0" } }, "node_modules/@types/passport": { @@ -2200,16 +2200,16 @@ } }, "node_modules/babel-jest": { - "version": "30.1.2", - "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-30.1.2.tgz", - "integrity": "sha512-IQCus1rt9kaSh7PQxLYRY5NmkNrNlU2TpabzwV7T2jljnpdHOcmnYYv8QmE04Li4S3a2Lj8/yXyET5pBarPr6g==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-30.2.0.tgz", + "integrity": "sha512-0YiBEOxWqKkSQWL9nNGGEgndoeL0ZpWrbLMNL5u/Kaxrli3Eaxlt3ZtIDktEvXt4L/R9r3ODr2zKwGM/2BjxVw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/transform": "30.1.2", + "@jest/transform": "30.2.0", "@types/babel__core": "^7.20.5", - "babel-plugin-istanbul": "^7.0.0", - "babel-preset-jest": "30.0.1", + "babel-plugin-istanbul": "^7.0.1", + "babel-preset-jest": "30.2.0", "chalk": "^4.1.2", "graceful-fs": "^4.2.11", "slash": "^3.0.0" @@ -2218,7 +2218,7 @@ "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" }, "peerDependencies": { - "@babel/core": "^7.11.0" + "@babel/core": "^7.11.0 || ^8.0.0-0" } }, "node_modules/babel-plugin-istanbul": { @@ -2242,14 +2242,12 @@ } }, "node_modules/babel-plugin-jest-hoist": { - "version": "30.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-30.0.1.tgz", - "integrity": "sha512-zTPME3pI50NsFW8ZBaVIOeAxzEY7XHlmWeXXu9srI+9kNfzCUTy8MFan46xOGZY8NZThMqq+e3qZUKsvXbasnQ==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-30.2.0.tgz", + "integrity": "sha512-ftzhzSGMUnOzcCXd6WHdBGMyuwy15Wnn0iyyWGKgBDLxf9/s5ABuraCSpBX2uG0jUg4rqJnxsLc5+oYBqoxVaA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/template": "^7.27.2", - "@babel/types": "^7.27.3", "@types/babel__core": "^7.20.5" }, "engines": { @@ -2284,20 +2282,20 @@ } }, "node_modules/babel-preset-jest": { - "version": "30.0.1", - "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-30.0.1.tgz", - "integrity": "sha512-+YHejD5iTWI46cZmcc/YtX4gaKBtdqCHCVfuVinizVpbmyjO3zYmeuyFdfA8duRqQZfgCAMlsfmkVbJ+e2MAJw==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-30.2.0.tgz", + "integrity": "sha512-US4Z3NOieAQumwFnYdUWKvUKh8+YSnS/gB3t6YBiz0bskpu7Pine8pPCheNxlPEW4wnUkma2a94YuW2q3guvCQ==", "dev": true, "license": "MIT", "dependencies": { - "babel-plugin-jest-hoist": "30.0.1", - "babel-preset-current-node-syntax": "^1.1.0" + "babel-plugin-jest-hoist": "30.2.0", + "babel-preset-current-node-syntax": "^1.2.0" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" }, "peerDependencies": { - "@babel/core": "^7.11.0" + "@babel/core": "^7.11.0 || ^8.0.0-beta.1" } }, "node_modules/balanced-match": { @@ -2308,9 +2306,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.8.tgz", - "integrity": "sha512-be0PUaPsQX/gPWWgFsdD+GFzaoig5PXaUC1xLkQiYdDnANU8sMnHoQd8JhbJQuvTWrWLyeFN9Imb5Qtfvr4RrQ==", + "version": "2.8.10", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.10.tgz", + "integrity": "sha512-uLfgBi+7IBNay8ECBO2mVMGZAc1VgZWEChxm4lv+TobGdG82LnXMjuNGo/BSSZZL4UmkWhxEHP2f5ziLNwGWMA==", "dev": true, "license": "Apache-2.0", "bin": { @@ -2402,9 +2400,9 @@ } }, "node_modules/browserslist": { - "version": "4.26.2", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.26.2.tgz", - "integrity": "sha512-ECFzp6uFOSB+dcZ5BK/IBaGWssbSYBHvuMeMt3MMFyhI0Z8SqGgEkBLARgpRH3hutIgPVsALcMwbDrJqPxQ65A==", + "version": "4.26.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.26.3.tgz", + "integrity": "sha512-lAUU+02RFBuCKQPj/P6NgjlbCnLBMp4UtgTx7vNHd3XSIJF87s9a5rA3aH2yw3GS9DqZAUbOtZdCCiZeVRqt0w==", "dev": true, "funding": [ { @@ -2422,9 +2420,9 @@ ], "license": "MIT", "dependencies": { - "baseline-browser-mapping": "^2.8.3", - "caniuse-lite": "^1.0.30001741", - "electron-to-chromium": "^1.5.218", + "baseline-browser-mapping": "^2.8.9", + "caniuse-lite": "^1.0.30001746", + "electron-to-chromium": "^1.5.227", "node-releases": "^2.0.21", "update-browserslist-db": "^1.1.3" }, @@ -2526,9 +2524,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001745", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001745.tgz", - "integrity": "sha512-ywt6i8FzvdgrrrGbr1jZVObnVv6adj+0if2/omv9cmR2oiZs30zL4DIyaptKcbOrBdOIc74QTMoJvSE2QHh5UQ==", + "version": "1.0.30001747", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001747.tgz", + "integrity": "sha512-mzFa2DGIhuc5490Nd/G31xN1pnBnYMadtkyTjefPI7wzypqgCEpeWu9bJr0OnDsyKrW75zA9ZAt7pbQFmwLsQg==", "dev": true, "funding": [ { @@ -3020,9 +3018,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.224", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.224.tgz", - "integrity": "sha512-kWAoUu/bwzvnhpdZSIc6KUyvkI1rbRXMT0Eq8pKReyOyaPZcctMli+EgvcN1PAvwVc7Tdo4Fxi2PsLNDU05mdg==", + "version": "1.5.229", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.229.tgz", + "integrity": "sha512-cwhDcZKGcT/rEthLRJ9eBlMDkh1sorgsuk+6dpsehV0g9CABsIqBxU4rLRjG+d/U6pYU1s37A4lSKrVc5lSQYg==", "dev": true, "license": "ISC" }, @@ -3386,18 +3384,18 @@ } }, "node_modules/expect": { - "version": "30.1.2", - "resolved": "https://registry.npmjs.org/expect/-/expect-30.1.2.tgz", - "integrity": "sha512-xvHszRavo28ejws8FpemjhwswGj4w/BetHIL8cU49u4sGyXDw2+p3YbeDbj6xzlxi6kWTjIRSTJ+9sNXPnF0Zg==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-30.2.0.tgz", + "integrity": "sha512-u/feCi0GPsI+988gU2FLcsHyAHTU0MX1Wg68NhAnN7z/+C5wqG+CY8J53N9ioe8RXgaoz0nBR/TYMf3AycUuPw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/expect-utils": "30.1.2", + "@jest/expect-utils": "30.2.0", "@jest/get-type": "30.1.0", - "jest-matcher-utils": "30.1.2", - "jest-message-util": "30.1.0", - "jest-mock": "30.0.5", - "jest-util": "30.0.5" + "jest-matcher-utils": "30.2.0", + "jest-message-util": "30.2.0", + "jest-mock": "30.2.0", + "jest-util": "30.2.0" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" @@ -3561,15 +3559,6 @@ "dev": true, "license": "MIT" }, - "node_modules/fast-redact": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.5.0.tgz", - "integrity": "sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A==", - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/fast-safe-stringify": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", @@ -4473,16 +4462,16 @@ } }, "node_modules/jest": { - "version": "30.1.3", - "resolved": "https://registry.npmjs.org/jest/-/jest-30.1.3.tgz", - "integrity": "sha512-Ry+p2+NLk6u8Agh5yVqELfUJvRfV51hhVBRIB5yZPY7mU0DGBmOuFG5GebZbMbm86cdQNK0fhJuDX8/1YorISQ==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-30.2.0.tgz", + "integrity": "sha512-F26gjC0yWN8uAA5m5Ss8ZQf5nDHWGlN/xWZIh8S5SRbsEKBovwZhxGd6LJlbZYxBgCYOtreSUyb8hpXyGC5O4A==", "dev": true, "license": "MIT", "dependencies": { - "@jest/core": "30.1.3", - "@jest/types": "30.0.5", + "@jest/core": "30.2.0", + "@jest/types": "30.2.0", "import-local": "^3.2.0", - "jest-cli": "30.1.3" + "jest-cli": "30.2.0" }, "bin": { "jest": "bin/jest.js" @@ -4500,14 +4489,14 @@ } }, "node_modules/jest-changed-files": { - "version": "30.0.5", - "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-30.0.5.tgz", - "integrity": "sha512-bGl2Ntdx0eAwXuGpdLdVYVr5YQHnSZlQ0y9HVDu565lCUAe9sj6JOtBbMmBBikGIegne9piDDIOeiLVoqTkz4A==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-30.2.0.tgz", + "integrity": "sha512-L8lR1ChrRnSdfeOvTrwZMlnWV8G/LLjQ0nG9MBclwWZidA2N5FviRki0Bvh20WRMOX31/JYvzdqTJrk5oBdydQ==", "dev": true, "license": "MIT", "dependencies": { "execa": "^5.1.1", - "jest-util": "30.0.5", + "jest-util": "30.2.0", "p-limit": "^3.1.0" }, "engines": { @@ -4515,29 +4504,29 @@ } }, "node_modules/jest-circus": { - "version": "30.1.3", - "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-30.1.3.tgz", - "integrity": "sha512-Yf3dnhRON2GJT4RYzM89t/EXIWNxKTpWTL9BfF3+geFetWP4XSvJjiU1vrWplOiUkmq8cHLiwuhz+XuUp9DscA==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-30.2.0.tgz", + "integrity": "sha512-Fh0096NC3ZkFx05EP2OXCxJAREVxj1BcW/i6EWqqymcgYKWjyyDpral3fMxVcHXg6oZM7iULer9wGRFvfpl+Tg==", "dev": true, "license": "MIT", "dependencies": { - "@jest/environment": "30.1.2", - "@jest/expect": "30.1.2", - "@jest/test-result": "30.1.3", - "@jest/types": "30.0.5", + "@jest/environment": "30.2.0", + "@jest/expect": "30.2.0", + "@jest/test-result": "30.2.0", + "@jest/types": "30.2.0", "@types/node": "*", "chalk": "^4.1.2", "co": "^4.6.0", "dedent": "^1.6.0", "is-generator-fn": "^2.1.0", - "jest-each": "30.1.0", - "jest-matcher-utils": "30.1.2", - "jest-message-util": "30.1.0", - "jest-runtime": "30.1.3", - "jest-snapshot": "30.1.2", - "jest-util": "30.0.5", + "jest-each": "30.2.0", + "jest-matcher-utils": "30.2.0", + "jest-message-util": "30.2.0", + "jest-runtime": "30.2.0", + "jest-snapshot": "30.2.0", + "jest-util": "30.2.0", "p-limit": "^3.1.0", - "pretty-format": "30.0.5", + "pretty-format": "30.2.0", "pure-rand": "^7.0.0", "slash": "^3.0.0", "stack-utils": "^2.0.6" @@ -4547,21 +4536,21 @@ } }, "node_modules/jest-cli": { - "version": "30.1.3", - "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-30.1.3.tgz", - "integrity": "sha512-G8E2Ol3OKch1DEeIBl41NP7OiC6LBhfg25Btv+idcusmoUSpqUkbrneMqbW9lVpI/rCKb/uETidb7DNteheuAQ==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-30.2.0.tgz", + "integrity": "sha512-Os9ukIvADX/A9sLt6Zse3+nmHtHaE6hqOsjQtNiugFTbKRHYIYtZXNGNK9NChseXy7djFPjndX1tL0sCTlfpAA==", "dev": true, "license": "MIT", "dependencies": { - "@jest/core": "30.1.3", - "@jest/test-result": "30.1.3", - "@jest/types": "30.0.5", + "@jest/core": "30.2.0", + "@jest/test-result": "30.2.0", + "@jest/types": "30.2.0", "chalk": "^4.1.2", "exit-x": "^0.2.2", "import-local": "^3.2.0", - "jest-config": "30.1.3", - "jest-util": "30.0.5", - "jest-validate": "30.1.0", + "jest-config": "30.2.0", + "jest-util": "30.2.0", + "jest-validate": "30.2.0", "yargs": "^17.7.2" }, "bin": { @@ -4580,34 +4569,34 @@ } }, "node_modules/jest-config": { - "version": "30.1.3", - "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-30.1.3.tgz", - "integrity": "sha512-M/f7gqdQEPgZNA181Myz+GXCe8jXcJsGjCMXUzRj22FIXsZOyHNte84e0exntOvdPaeh9tA0w+B8qlP2fAezfw==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-30.2.0.tgz", + "integrity": "sha512-g4WkyzFQVWHtu6uqGmQR4CQxz/CH3yDSlhzXMWzNjDx843gYjReZnMRanjRCq5XZFuQrGDxgUaiYWE8BRfVckA==", "dev": true, "license": "MIT", "dependencies": { "@babel/core": "^7.27.4", "@jest/get-type": "30.1.0", "@jest/pattern": "30.0.1", - "@jest/test-sequencer": "30.1.3", - "@jest/types": "30.0.5", - "babel-jest": "30.1.2", + "@jest/test-sequencer": "30.2.0", + "@jest/types": "30.2.0", + "babel-jest": "30.2.0", "chalk": "^4.1.2", "ci-info": "^4.2.0", "deepmerge": "^4.3.1", "glob": "^10.3.10", "graceful-fs": "^4.2.11", - "jest-circus": "30.1.3", - "jest-docblock": "30.0.1", - "jest-environment-node": "30.1.2", + "jest-circus": "30.2.0", + "jest-docblock": "30.2.0", + "jest-environment-node": "30.2.0", "jest-regex-util": "30.0.1", - "jest-resolve": "30.1.3", - "jest-runner": "30.1.3", - "jest-util": "30.0.5", - "jest-validate": "30.1.0", + "jest-resolve": "30.2.0", + "jest-runner": "30.2.0", + "jest-util": "30.2.0", + "jest-validate": "30.2.0", "micromatch": "^4.0.8", "parse-json": "^5.2.0", - "pretty-format": "30.0.5", + "pretty-format": "30.2.0", "slash": "^3.0.0", "strip-json-comments": "^3.1.1" }, @@ -4632,25 +4621,25 @@ } }, "node_modules/jest-diff": { - "version": "30.1.2", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-30.1.2.tgz", - "integrity": "sha512-4+prq+9J61mOVXCa4Qp8ZjavdxzrWQXrI80GNxP8f4tkI2syPuPrJgdRPZRrfUTRvIoUwcmNLbqEJy9W800+NQ==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-30.2.0.tgz", + "integrity": "sha512-dQHFo3Pt4/NLlG5z4PxZ/3yZTZ1C7s9hveiOj+GCN+uT109NC2QgsoVZsVOAvbJ3RgKkvyLGXZV9+piDpWbm6A==", "dev": true, "license": "MIT", "dependencies": { "@jest/diff-sequences": "30.0.1", "@jest/get-type": "30.1.0", "chalk": "^4.1.2", - "pretty-format": "30.0.5" + "pretty-format": "30.2.0" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-docblock": { - "version": "30.0.1", - "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-30.0.1.tgz", - "integrity": "sha512-/vF78qn3DYphAaIc3jy4gA7XSAz167n9Bm/wn/1XhTLW7tTBIzXtCJpb/vcmc73NIIeeohCbdL94JasyXUZsGA==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-30.2.0.tgz", + "integrity": "sha512-tR/FFgZKS1CXluOQzZvNH3+0z9jXr3ldGSD8bhyuxvlVUwbeLOGynkunvlTMxchC5urrKndYiwCFC0DLVjpOCA==", "dev": true, "license": "MIT", "dependencies": { @@ -4661,56 +4650,56 @@ } }, "node_modules/jest-each": { - "version": "30.1.0", - "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-30.1.0.tgz", - "integrity": "sha512-A+9FKzxPluqogNahpCv04UJvcZ9B3HamqpDNWNKDjtxVRYB8xbZLFuCr8JAJFpNp83CA0anGQFlpQna9Me+/tQ==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-30.2.0.tgz", + "integrity": "sha512-lpWlJlM7bCUf1mfmuqTA8+j2lNURW9eNafOy99knBM01i5CQeY5UH1vZjgT9071nDJac1M4XsbyI44oNOdhlDQ==", "dev": true, "license": "MIT", "dependencies": { "@jest/get-type": "30.1.0", - "@jest/types": "30.0.5", + "@jest/types": "30.2.0", "chalk": "^4.1.2", - "jest-util": "30.0.5", - "pretty-format": "30.0.5" + "jest-util": "30.2.0", + "pretty-format": "30.2.0" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-environment-node": { - "version": "30.1.2", - "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-30.1.2.tgz", - "integrity": "sha512-w8qBiXtqGWJ9xpJIA98M0EIoq079GOQRQUyse5qg1plShUCQ0Ek1VTTcczqKrn3f24TFAgFtT+4q3aOXvjbsuA==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-30.2.0.tgz", + "integrity": "sha512-ElU8v92QJ9UrYsKrxDIKCxu6PfNj4Hdcktcn0JX12zqNdqWHB0N+hwOnnBBXvjLd2vApZtuLUGs1QSY+MsXoNA==", "dev": true, "license": "MIT", "dependencies": { - "@jest/environment": "30.1.2", - "@jest/fake-timers": "30.1.2", - "@jest/types": "30.0.5", + "@jest/environment": "30.2.0", + "@jest/fake-timers": "30.2.0", + "@jest/types": "30.2.0", "@types/node": "*", - "jest-mock": "30.0.5", - "jest-util": "30.0.5", - "jest-validate": "30.1.0" + "jest-mock": "30.2.0", + "jest-util": "30.2.0", + "jest-validate": "30.2.0" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-haste-map": { - "version": "30.1.0", - "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-30.1.0.tgz", - "integrity": "sha512-JLeM84kNjpRkggcGpQLsV7B8W4LNUWz7oDNVnY1Vjj22b5/fAb3kk3htiD+4Na8bmJmjJR7rBtS2Rmq/NEcADg==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-30.2.0.tgz", + "integrity": "sha512-sQA/jCb9kNt+neM0anSj6eZhLZUIhQgwDt7cPGjumgLM4rXsfb9kpnlacmvZz3Q5tb80nS+oG/if+NBKrHC+Xw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/types": "30.0.5", + "@jest/types": "30.2.0", "@types/node": "*", "anymatch": "^3.1.3", "fb-watchman": "^2.0.2", "graceful-fs": "^4.2.11", "jest-regex-util": "30.0.1", - "jest-util": "30.0.5", - "jest-worker": "30.1.0", + "jest-util": "30.2.0", + "jest-worker": "30.2.0", "micromatch": "^4.0.8", "walker": "^1.0.8" }, @@ -4722,49 +4711,49 @@ } }, "node_modules/jest-leak-detector": { - "version": "30.1.0", - "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-30.1.0.tgz", - "integrity": "sha512-AoFvJzwxK+4KohH60vRuHaqXfWmeBATFZpzpmzNmYTtmRMiyGPVhkXpBqxUQunw+dQB48bDf4NpUs6ivVbRv1g==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-30.2.0.tgz", + "integrity": "sha512-M6jKAjyzjHG0SrQgwhgZGy9hFazcudwCNovY/9HPIicmNSBuockPSedAP9vlPK6ONFJ1zfyH/M2/YYJxOz5cdQ==", "dev": true, "license": "MIT", "dependencies": { "@jest/get-type": "30.1.0", - "pretty-format": "30.0.5" + "pretty-format": "30.2.0" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-matcher-utils": { - "version": "30.1.2", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-30.1.2.tgz", - "integrity": "sha512-7ai16hy4rSbDjvPTuUhuV8nyPBd6EX34HkBsBcBX2lENCuAQ0qKCPb/+lt8OSWUa9WWmGYLy41PrEzkwRwoGZQ==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-30.2.0.tgz", + "integrity": "sha512-dQ94Nq4dbzmUWkQ0ANAWS9tBRfqCrn0bV9AMYdOi/MHW726xn7eQmMeRTpX2ViC00bpNaWXq+7o4lIQ3AX13Hg==", "dev": true, "license": "MIT", "dependencies": { "@jest/get-type": "30.1.0", "chalk": "^4.1.2", - "jest-diff": "30.1.2", - "pretty-format": "30.0.5" + "jest-diff": "30.2.0", + "pretty-format": "30.2.0" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-message-util": { - "version": "30.1.0", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-30.1.0.tgz", - "integrity": "sha512-HizKDGG98cYkWmaLUHChq4iN+oCENohQLb7Z5guBPumYs+/etonmNFlg1Ps6yN9LTPyZn+M+b/9BbnHx3WTMDg==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-30.2.0.tgz", + "integrity": "sha512-y4DKFLZ2y6DxTWD4cDe07RglV88ZiNEdlRfGtqahfbIjfsw1nMCPx49Uev4IA/hWn3sDKyAnSPwoYSsAEdcimw==", "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.27.1", - "@jest/types": "30.0.5", + "@jest/types": "30.2.0", "@types/stack-utils": "^2.0.3", "chalk": "^4.1.2", "graceful-fs": "^4.2.11", "micromatch": "^4.0.8", - "pretty-format": "30.0.5", + "pretty-format": "30.2.0", "slash": "^3.0.0", "stack-utils": "^2.0.6" }, @@ -4773,15 +4762,15 @@ } }, "node_modules/jest-mock": { - "version": "30.0.5", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-30.0.5.tgz", - "integrity": "sha512-Od7TyasAAQX/6S+QCbN6vZoWOMwlTtzzGuxJku1GhGanAjz9y+QsQkpScDmETvdc9aSXyJ/Op4rhpMYBWW91wQ==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-30.2.0.tgz", + "integrity": "sha512-JNNNl2rj4b5ICpmAcq+WbLH83XswjPbjH4T7yvGzfAGCPh1rw+xVNbtk+FnRslvt9lkCcdn9i1oAoKUuFsOxRw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/types": "30.0.5", + "@jest/types": "30.2.0", "@types/node": "*", - "jest-util": "30.0.5" + "jest-util": "30.2.0" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" @@ -4816,18 +4805,18 @@ } }, "node_modules/jest-resolve": { - "version": "30.1.3", - "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-30.1.3.tgz", - "integrity": "sha512-DI4PtTqzw9GwELFS41sdMK32Ajp3XZQ8iygeDMWkxlRhm7uUTOFSZFVZABFuxr0jvspn8MAYy54NxZCsuCTSOw==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-30.2.0.tgz", + "integrity": "sha512-TCrHSxPlx3tBY3hWNtRQKbtgLhsXa1WmbJEqBlTBrGafd5fiQFByy2GNCEoGR+Tns8d15GaL9cxEzKOO3GEb2A==", "dev": true, "license": "MIT", "dependencies": { "chalk": "^4.1.2", "graceful-fs": "^4.2.11", - "jest-haste-map": "30.1.0", + "jest-haste-map": "30.2.0", "jest-pnp-resolver": "^1.2.3", - "jest-util": "30.0.5", - "jest-validate": "30.1.0", + "jest-util": "30.2.0", + "jest-validate": "30.2.0", "slash": "^3.0.0", "unrs-resolver": "^1.7.11" }, @@ -4836,46 +4825,46 @@ } }, "node_modules/jest-resolve-dependencies": { - "version": "30.1.3", - "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-30.1.3.tgz", - "integrity": "sha512-DNfq3WGmuRyHRHfEet+Zm3QOmVFtIarUOQHHryKPc0YL9ROfgWZxl4+aZq/VAzok2SS3gZdniP+dO4zgo59hBg==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-30.2.0.tgz", + "integrity": "sha512-xTOIGug/0RmIe3mmCqCT95yO0vj6JURrn1TKWlNbhiAefJRWINNPgwVkrVgt/YaerPzY3iItufd80v3lOrFJ2w==", "dev": true, "license": "MIT", "dependencies": { "jest-regex-util": "30.0.1", - "jest-snapshot": "30.1.2" + "jest-snapshot": "30.2.0" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-runner": { - "version": "30.1.3", - "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-30.1.3.tgz", - "integrity": "sha512-dd1ORcxQraW44Uz029TtXj85W11yvLpDuIzNOlofrC8GN+SgDlgY4BvyxJiVeuabA1t6idjNbX59jLd2oplOGQ==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-30.2.0.tgz", + "integrity": "sha512-PqvZ2B2XEyPEbclp+gV6KO/F1FIFSbIwewRgmROCMBo/aZ6J1w8Qypoj2pEOcg3G2HzLlaP6VUtvwCI8dM3oqQ==", "dev": true, "license": "MIT", "dependencies": { - "@jest/console": "30.1.2", - "@jest/environment": "30.1.2", - "@jest/test-result": "30.1.3", - "@jest/transform": "30.1.2", - "@jest/types": "30.0.5", + "@jest/console": "30.2.0", + "@jest/environment": "30.2.0", + "@jest/test-result": "30.2.0", + "@jest/transform": "30.2.0", + "@jest/types": "30.2.0", "@types/node": "*", "chalk": "^4.1.2", "emittery": "^0.13.1", "exit-x": "^0.2.2", "graceful-fs": "^4.2.11", - "jest-docblock": "30.0.1", - "jest-environment-node": "30.1.2", - "jest-haste-map": "30.1.0", - "jest-leak-detector": "30.1.0", - "jest-message-util": "30.1.0", - "jest-resolve": "30.1.3", - "jest-runtime": "30.1.3", - "jest-util": "30.0.5", - "jest-watcher": "30.1.3", - "jest-worker": "30.1.0", + "jest-docblock": "30.2.0", + "jest-environment-node": "30.2.0", + "jest-haste-map": "30.2.0", + "jest-leak-detector": "30.2.0", + "jest-message-util": "30.2.0", + "jest-resolve": "30.2.0", + "jest-runtime": "30.2.0", + "jest-util": "30.2.0", + "jest-watcher": "30.2.0", + "jest-worker": "30.2.0", "p-limit": "^3.1.0", "source-map-support": "0.5.13" }, @@ -4884,32 +4873,32 @@ } }, "node_modules/jest-runtime": { - "version": "30.1.3", - "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-30.1.3.tgz", - "integrity": "sha512-WS8xgjuNSphdIGnleQcJ3AKE4tBKOVP+tKhCD0u+Tb2sBmsU8DxfbBpZX7//+XOz81zVs4eFpJQwBNji2Y07DA==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-30.2.0.tgz", + "integrity": "sha512-p1+GVX/PJqTucvsmERPMgCPvQJpFt4hFbM+VN3n8TMo47decMUcJbt+rgzwrEme0MQUA/R+1de2axftTHkKckg==", "dev": true, "license": "MIT", "dependencies": { - "@jest/environment": "30.1.2", - "@jest/fake-timers": "30.1.2", - "@jest/globals": "30.1.2", + "@jest/environment": "30.2.0", + "@jest/fake-timers": "30.2.0", + "@jest/globals": "30.2.0", "@jest/source-map": "30.0.1", - "@jest/test-result": "30.1.3", - "@jest/transform": "30.1.2", - "@jest/types": "30.0.5", + "@jest/test-result": "30.2.0", + "@jest/transform": "30.2.0", + "@jest/types": "30.2.0", "@types/node": "*", "chalk": "^4.1.2", "cjs-module-lexer": "^2.1.0", "collect-v8-coverage": "^1.0.2", "glob": "^10.3.10", "graceful-fs": "^4.2.11", - "jest-haste-map": "30.1.0", - "jest-message-util": "30.1.0", - "jest-mock": "30.0.5", + "jest-haste-map": "30.2.0", + "jest-message-util": "30.2.0", + "jest-mock": "30.2.0", "jest-regex-util": "30.0.1", - "jest-resolve": "30.1.3", - "jest-snapshot": "30.1.2", - "jest-util": "30.0.5", + "jest-resolve": "30.2.0", + "jest-snapshot": "30.2.0", + "jest-util": "30.2.0", "slash": "^3.0.0", "strip-bom": "^4.0.0" }, @@ -4918,9 +4907,9 @@ } }, "node_modules/jest-snapshot": { - "version": "30.1.2", - "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-30.1.2.tgz", - "integrity": "sha512-4q4+6+1c8B6Cy5pGgFvjDy/Pa6VYRiGu0yQafKkJ9u6wQx4G5PqI2QR6nxTl43yy7IWsINwz6oT4o6tD12a8Dg==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-30.2.0.tgz", + "integrity": "sha512-5WEtTy2jXPFypadKNpbNkZ72puZCa6UjSr/7djeecHWOu7iYhSXSnHScT8wBz3Rn8Ena5d5RYRcsyKIeqG1IyA==", "dev": true, "license": "MIT", "dependencies": { @@ -4929,20 +4918,20 @@ "@babel/plugin-syntax-jsx": "^7.27.1", "@babel/plugin-syntax-typescript": "^7.27.1", "@babel/types": "^7.27.3", - "@jest/expect-utils": "30.1.2", + "@jest/expect-utils": "30.2.0", "@jest/get-type": "30.1.0", - "@jest/snapshot-utils": "30.1.2", - "@jest/transform": "30.1.2", - "@jest/types": "30.0.5", - "babel-preset-current-node-syntax": "^1.1.0", + "@jest/snapshot-utils": "30.2.0", + "@jest/transform": "30.2.0", + "@jest/types": "30.2.0", + "babel-preset-current-node-syntax": "^1.2.0", "chalk": "^4.1.2", - "expect": "30.1.2", + "expect": "30.2.0", "graceful-fs": "^4.2.11", - "jest-diff": "30.1.2", - "jest-matcher-utils": "30.1.2", - "jest-message-util": "30.1.0", - "jest-util": "30.0.5", - "pretty-format": "30.0.5", + "jest-diff": "30.2.0", + "jest-matcher-utils": "30.2.0", + "jest-message-util": "30.2.0", + "jest-util": "30.2.0", + "pretty-format": "30.2.0", "semver": "^7.7.2", "synckit": "^0.11.8" }, @@ -4977,13 +4966,13 @@ } }, "node_modules/jest-util": { - "version": "30.0.5", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-30.0.5.tgz", - "integrity": "sha512-pvyPWssDZR0FlfMxCBoc0tvM8iUEskaRFALUtGQYzVEAqisAztmy+R8LnU14KT4XA0H/a5HMVTXat1jLne010g==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-30.2.0.tgz", + "integrity": "sha512-QKNsM0o3Xe6ISQU869e+DhG+4CK/48aHYdJZGlFQVTjnbvgpcKyxpzk29fGiO7i/J8VENZ+d2iGnSsvmuHywlA==", "dev": true, "license": "MIT", "dependencies": { - "@jest/types": "30.0.5", + "@jest/types": "30.2.0", "@types/node": "*", "chalk": "^4.1.2", "ci-info": "^4.2.0", @@ -5008,18 +4997,18 @@ } }, "node_modules/jest-validate": { - "version": "30.1.0", - "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-30.1.0.tgz", - "integrity": "sha512-7P3ZlCFW/vhfQ8pE7zW6Oi4EzvuB4sgR72Q1INfW9m0FGo0GADYlPwIkf4CyPq7wq85g+kPMtPOHNAdWHeBOaA==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-30.2.0.tgz", + "integrity": "sha512-FBGWi7dP2hpdi8nBoWxSsLvBFewKAg0+uSQwBaof4Y4DPgBabXgpSYC5/lR7VmnIlSpASmCi/ntRWPbv7089Pw==", "dev": true, "license": "MIT", "dependencies": { "@jest/get-type": "30.1.0", - "@jest/types": "30.0.5", + "@jest/types": "30.2.0", "camelcase": "^6.3.0", "chalk": "^4.1.2", "leven": "^3.1.0", - "pretty-format": "30.0.5" + "pretty-format": "30.2.0" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" @@ -5039,19 +5028,19 @@ } }, "node_modules/jest-watcher": { - "version": "30.1.3", - "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-30.1.3.tgz", - "integrity": "sha512-6jQUZCP1BTL2gvG9E4YF06Ytq4yMb4If6YoQGRR6PpjtqOXSP3sKe2kqwB6SQ+H9DezOfZaSLnmka1NtGm3fCQ==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-30.2.0.tgz", + "integrity": "sha512-PYxa28dxJ9g777pGm/7PrbnMeA0Jr7osHP9bS7eJy9DuAjMgdGtxgf0uKMyoIsTWAkIbUW5hSDdJ3urmgXBqxg==", "dev": true, "license": "MIT", "dependencies": { - "@jest/test-result": "30.1.3", - "@jest/types": "30.0.5", + "@jest/test-result": "30.2.0", + "@jest/types": "30.2.0", "@types/node": "*", "ansi-escapes": "^4.3.2", "chalk": "^4.1.2", "emittery": "^0.13.1", - "jest-util": "30.0.5", + "jest-util": "30.2.0", "string-length": "^4.0.2" }, "engines": { @@ -5059,15 +5048,15 @@ } }, "node_modules/jest-worker": { - "version": "30.1.0", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-30.1.0.tgz", - "integrity": "sha512-uvWcSjlwAAgIu133Tt77A05H7RIk3Ho8tZL50bQM2AkvLdluw9NG48lRCl3Dt+MOH719n/0nnb5YxUwcuJiKRA==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-30.2.0.tgz", + "integrity": "sha512-0Q4Uk8WF7BUwqXHuAjc23vmopWJw5WH7w2tqBoUOZpOjW/ZnR44GXXd1r82RvnmI2GZge3ivrYXk/BE2+VtW2g==", "dev": true, "license": "MIT", "dependencies": { "@types/node": "*", "@ungap/structured-clone": "^1.3.0", - "jest-util": "30.0.5", + "jest-util": "30.2.0", "merge-stream": "^2.0.0", "supports-color": "^8.1.1" }, @@ -5608,14 +5597,14 @@ } }, "node_modules/mongoose": { - "version": "8.18.2", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.18.2.tgz", - "integrity": "sha512-gA6GFlshOHUdNyw9OQTmMLSGzVOPbcbjaSZ1dvR5iMp668N2UUznTuzgTY6V6Q41VtBc4kmL/qqML1RNgXB5Fg==", + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.19.0.tgz", + "integrity": "sha512-Z4iRiBkC7aR7a/rxQxtUAUBasFdiXkBuv3EY4NwkRbs92xKA4pwzi1Q4D+odFBe+ChahMNAYg2JP+7tWzZM0sQ==", "license": "MIT", "dependencies": { "bson": "^6.10.4", "kareem": "2.6.3", - "mongodb": "~6.18.0", + "mongodb": "~6.20.0", "mpath": "0.9.0", "mquery": "5.0.0", "ms": "2.1.3", @@ -5629,52 +5618,6 @@ "url": "https://opencollective.com/mongoose" } }, - "node_modules/mongoose/node_modules/mongodb": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.18.0.tgz", - "integrity": "sha512-fO5ttN9VC8P0F5fqtQmclAkgXZxbIkYRTUi1j8JO6IYwvamkhtYDilJr35jOPELR49zqCJgXZWwCtW7B+TM8vQ==", - "license": "Apache-2.0", - "dependencies": { - "@mongodb-js/saslprep": "^1.1.9", - "bson": "^6.10.4", - "mongodb-connection-string-url": "^3.0.0" - }, - "engines": { - "node": ">=16.20.1" - }, - "peerDependencies": { - "@aws-sdk/credential-providers": "^3.188.0", - "@mongodb-js/zstd": "^1.1.0 || ^2.0.0", - "gcp-metadata": "^5.2.0", - "kerberos": "^2.0.1", - "mongodb-client-encryption": ">=6.0.0 <7", - "snappy": "^7.2.2", - "socks": "^2.7.1" - }, - "peerDependenciesMeta": { - "@aws-sdk/credential-providers": { - "optional": true - }, - "@mongodb-js/zstd": { - "optional": true - }, - "gcp-metadata": { - "optional": true - }, - "kerberos": { - "optional": true - }, - "mongodb-client-encryption": { - "optional": true - }, - "snappy": { - "optional": true - }, - "socks": { - "optional": true - } - } - }, "node_modules/mpath": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", @@ -6164,13 +6107,12 @@ } }, "node_modules/pino": { - "version": "9.11.0", - "resolved": "https://registry.npmjs.org/pino/-/pino-9.11.0.tgz", - "integrity": "sha512-+YIodBB9sxcWeR8PrXC2K3gEDyfkUuVEITOcbqrfcj+z5QW4ioIcqZfYFbrLTYLsmAwunbS7nfU/dpBB6PZc1g==", + "version": "9.13.0", + "resolved": "https://registry.npmjs.org/pino/-/pino-9.13.0.tgz", + "integrity": "sha512-SpTXQhkQXekIKEe7c887S3lk3v90Q+/HVRZVyNAhe98PQc++6I5ec/R0pciH8/CciXjCoVZIZfRNicbC6KZgnw==", "license": "MIT", "dependencies": { "atomic-sleep": "^1.0.0", - "fast-redact": "^3.1.1", "on-exit-leak-free": "^2.1.0", "pino-abstract-transport": "^2.0.0", "pino-std-serializers": "^7.0.0", @@ -6178,6 +6120,7 @@ "quick-format-unescaped": "^4.0.3", "real-require": "^0.2.0", "safe-stable-stringify": "^2.3.1", + "slow-redact": "^0.3.0", "sonic-boom": "^4.0.1", "thread-stream": "^3.0.0" }, @@ -6326,9 +6269,9 @@ } }, "node_modules/pretty-format": { - "version": "30.0.5", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.0.5.tgz", - "integrity": "sha512-D1tKtYvByrBkFLe2wHJl2bwMJIiT8rW+XA+TiataH79/FszLQMrpGEvzUVkzPau7OCO0Qnrhpe87PqtOAIB8Yw==", + "version": "30.2.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.2.0.tgz", + "integrity": "sha512-9uBdv/B4EefsuAL+pWqueZyZS2Ba+LxfFeQ9DN14HU4bN8bhaxKdkpjpB6fs9+pSjIBu+FXQHImEg8j/Lw0+vA==", "dev": true, "license": "MIT", "dependencies": { @@ -6874,6 +6817,12 @@ "node": ">=8" } }, + "node_modules/slow-redact": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/slow-redact/-/slow-redact-0.3.0.tgz", + "integrity": "sha512-cf723wn9JeRIYP9tdtd86GuqoR5937u64Io+CYjlm2i7jvu7g0H+Cp0l0ShAf/4ZL+ISUTVT+8Qzz7RZmp9FjA==", + "license": "MIT" + }, "node_modules/sonic-boom": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.0.tgz", @@ -7184,9 +7133,9 @@ } }, "node_modules/swagger-ui-dist": { - "version": "5.29.0", - "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-5.29.0.tgz", - "integrity": "sha512-gqs7Md3AxP4mbpXAq31o5QW+wGUZsUzVatg70yXpUR245dfIis5jAzufBd+UQM/w2xSfrhvA1eqsrgnl2PbezQ==", + "version": "5.29.2", + "resolved": "https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-5.29.2.tgz", + "integrity": "sha512-MbnWUJT5Qm3eFOZUKNEXwY987n99U121dN0VGezL/yuxYr13ytu1yMWX1Cg2iqJyWwZfWtWyr0pC2Sp+KYYzTw==", "license": "Apache-2.0", "dependencies": { "@scarf/scarf": "=1.4.0" @@ -7405,9 +7354,9 @@ "license": "MIT" }, "node_modules/undici-types": { - "version": "7.12.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.12.0.tgz", - "integrity": "sha512-goOacqME2GYyOZZfb5Lgtu+1IDmAlAEu5xnD3+xTzS10hT0vzpf0SPjkXwAw9Jm+4n/mQGDP3LO8CPbYROeBfQ==", + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.13.0.tgz", + "integrity": "sha512-Ov2Rr9Sx+fRgagJ5AX0qvItZG/JKKoBRAVITs1zk7IqZGTJUwgUr7qoYBpWwakpWilTZFM98rG/AFRocu10iIQ==", "license": "MIT" }, "node_modules/unpipe": { diff --git a/package.json b/package.json index eaa4aa58..0e7caf97 100644 --- a/package.json +++ b/package.json @@ -52,10 +52,10 @@ "jsonwebtoken": "^9.0.2", "moment": "^2.30.1", "mongodb": "^6.20.0", - "mongoose": "^8.18.2", + "mongoose": "^8.19.0", "passport": "^0.7.0", "@node-saml/passport-saml": "^5.1.0", - "pino": "^9.11.0", + "pino": "^9.13.0", "pino-pretty": "^13.1.1", "swagger-ui-express": "^5.0.1", "switcher-client": "^4.4.1", @@ -64,7 +64,7 @@ "devDependencies": { "env-cmd": "^11.0.0", "eslint": "^9.36.0", - "jest": "^30.1.3", + "jest": "^30.2.0", "jest-sonar-reporter": "^2.0.0", "node-notifier": "^10.0.1", "nodemon": "^3.1.10", diff --git a/src/aggregator/permission-resolvers.js b/src/aggregator/permission-resolvers.js index aff6e52e..3ecd10df 100644 --- a/src/aggregator/permission-resolvers.js +++ b/src/aggregator/permission-resolvers.js @@ -26,10 +26,10 @@ export async function resolvePermission(args, admin) { for (const action_perm of args.actions) { try { await verifyOwnership(admin, element, args.domain, action_perm, args.router, false, args.environment); - result[result.length - 1].permissions.push({ action: action_perm.toString(), result: 'ok' }); + result.at(-1).permissions.push({ action: action_perm.toString(), result: 'ok' }); } catch (e) { Logger.debug('resolvePermission', e); - result[result.length - 1].permissions.push({ action: action_perm.toString(), result: 'nok' }); + result.at(-1).permissions.push({ action: action_perm.toString(), result: 'nok' }); } } } @@ -50,5 +50,5 @@ const getElements = async (domain, parent, router) => { return getConfigs({ domain, group: parent }, true); } - return Promise.resolve([]); + return []; }; \ No newline at end of file diff --git a/src/aggregator/resolvers.js b/src/aggregator/resolvers.js index d1067599..7b0c456b 100644 --- a/src/aggregator/resolvers.js +++ b/src/aggregator/resolvers.js @@ -13,12 +13,12 @@ export const resolveConfigByKey = async (domain, key) => Config.findOne({ domain export function resolveEnvValue(source, field, keys) { const arrValue = []; - keys.forEach(k => { + for (const k of keys) { arrValue.push({ env: k, value: source[field][k] }); - }); + } return arrValue; } diff --git a/src/app-server.js b/src/app-server.js index f9371ee1..41cac02b 100644 --- a/src/app-server.js +++ b/src/app-server.js @@ -1,6 +1,6 @@ -import https from 'https'; -import http from 'http'; -import fs from 'fs'; +import https from 'node:https'; +import http from 'node:http'; +import fs from 'node:fs'; import Logger from './helpers/logger.js'; export const createServer = (app) => { diff --git a/src/external/gitops.js b/src/external/gitops.js index 49393519..8ac1c701 100644 --- a/src/external/gitops.js +++ b/src/external/gitops.js @@ -1,5 +1,5 @@ import axios from 'axios'; -import https from 'https'; +import https from 'node:https'; import jwt from 'jsonwebtoken'; const agent = (url) => { diff --git a/src/helpers/index.js b/src/helpers/index.js index 7541a207..36550ee2 100644 --- a/src/helpers/index.js +++ b/src/helpers/index.js @@ -10,9 +10,9 @@ const PATTERN_ALPHANUMERIC = /^[a-zA-Z0-9_-]*$/; export async function checkEnvironmentStatusRemoval(domainId, environmentName, strategy = false) { const environment = await getEnvironments({ domain: domainId }, ['_id', 'name']); - const isValidOperation = environment.filter((e) => + const isValidOperation = environment.some((e) => e.name === environmentName && - !strategy ? environmentName !== EnvType.DEFAULT : strategy).length > 0; + !strategy ? environmentName !== EnvType.DEFAULT : strategy); if (!isValidOperation) { throw new BadRequestError('Invalid environment'); @@ -32,18 +32,18 @@ export function containsValue(arr, value) { } export function formatInput(input, - options = { - toUpper: false, - toLower: false, - autoUnderscore: false, - allowSpace: false - }) { + { + toUpper = false, + toLower = false, + autoUnderscore = false, + allowSpace = false + } = {}) { let regexStr; - if (options.autoUnderscore) { + if (autoUnderscore) { regexStr = PATTERN_ALPHANUMERIC_SPACE; } else { - regexStr = options.allowSpace ? PATTERN_ALPHANUMERIC_SPACE : PATTERN_ALPHANUMERIC; + regexStr = allowSpace ? PATTERN_ALPHANUMERIC_SPACE : PATTERN_ALPHANUMERIC; } const regex = new RegExp(regexStr); @@ -51,14 +51,14 @@ export function formatInput(input, throw new Error('Invalid input format. Use only alphanumeric digits.'); } - if (options.toUpper) { + if (toUpper) { input = input.toUpperCase(); - } else if (options.toLower) { + } else if (toLower) { input = input.toLowerCase(); } - if (options.autoUnderscore) { - input = input.replace(/\s/g, '_'); + if (autoUnderscore) { + input = input.replaceAll(' ', '_'); } return input.trim(); @@ -76,11 +76,11 @@ export function sortBy(args) { } export function validatePagingArgs(args) { - if (args.limit && !Number.isInteger(parseInt(args.limit)) || parseInt(args.limit) < 1) { + if (args.limit && !Number.isInteger(Number.parseInt(args.limit)) || Number.parseInt(args.limit) < 1) { return false; } - if (args.skip && !Number.isInteger(parseInt(args.skip)) || parseInt(args.skip) < 0) { + if (args.skip && !Number.isInteger(Number.parseInt(args.skip)) || Number.parseInt(args.skip) < 0) { return false; } diff --git a/src/middleware/gitops.js b/src/middleware/gitops.js index 1c19ad85..124d7735 100644 --- a/src/middleware/gitops.js +++ b/src/middleware/gitops.js @@ -83,10 +83,10 @@ function validateChangesContent(changes) { for (const change of changes) { if (CONTENT_TYPE_ARRAY.includes(change.diff)) { if (!Array.isArray(change.content)) { - throw new Error('Request has invalid content type [object]'); + throw new TypeError('Request has invalid content type [object]'); } } else if (Array.isArray(change.content)) { - throw new Error('Request has invalid content type [array]'); + throw new TypeError('Request has invalid content type [array]'); } } } \ No newline at end of file diff --git a/src/middleware/limiter.js b/src/middleware/limiter.js index b8753591..295b0dff 100644 --- a/src/middleware/limiter.js +++ b/src/middleware/limiter.js @@ -7,7 +7,7 @@ const ERROR_MESSAGE = { const getMaxRate = (rate_limit) => { if (rate_limit === 0) { - return parseInt(DEFAULT_RATE_LIMIT); + return Number.parseInt(DEFAULT_RATE_LIMIT); } return rate_limit; @@ -17,7 +17,7 @@ export const DEFAULT_RATE_LIMIT = 1000; export const defaultLimiter = rateLimit({ windowMs: DEFAULT_WINDOWMS, - limit: getMaxRate(parseInt(process.env.MAX_REQUEST_PER_MINUTE)), + limit: getMaxRate(Number.parseInt(process.env.MAX_REQUEST_PER_MINUTE)), skip: (request) => request.rate_limit === 0, standardHeaders: 'draft-7', legacyHeaders: false, diff --git a/src/middleware/validators.js b/src/middleware/validators.js index fc3699e8..4551581a 100644 --- a/src/middleware/validators.js +++ b/src/middleware/validators.js @@ -6,7 +6,7 @@ export async function checkEnvironmentStatusChange(args, domain, field) { const environment = await getEnvironments({ domain }, ['_id', 'name']); const updates = Object.keys(field || args); const isValidOperation = updates.every((update) => { - return environment.filter((e) => e.name === update).length > 0; + return environment.some((e) => e.name === update); }); if (!isValidOperation) { diff --git a/src/models/admin.js b/src/models/admin.js index 0bbdd18a..c9826898 100644 --- a/src/models/admin.js +++ b/src/models/admin.js @@ -1,7 +1,7 @@ import mongoose from 'mongoose'; import moment from 'moment'; import bcryptjs from 'bcryptjs'; -import crypto from 'crypto'; +import crypto from 'node:crypto'; import jwt from 'jsonwebtoken'; import { Team } from './team.js'; import { notifyAcCreation, notifyAcDeletion } from '../external/switcher-api-facade.js'; @@ -120,22 +120,20 @@ adminSchema.options.toJSON = { }; adminSchema.methods.generateAuthToken = async function () { - const admin = this; - const options = { expiresIn: process.env.JWT_ADMIN_TOKEN_RENEW_INTERVAL, issuer: 'switcher-api' }; - const token = jwt.sign(({ _id: admin.id.toString(), issued: Date.now() }), process.env.JWT_SECRET, options); + const token = jwt.sign(({ _id: this.id.toString(), issued: Date.now() }), process.env.JWT_SECRET, options); const refreshToken = jwt.sign(({ subject: Admin.extractTokenPart(token) }), process.env.JWT_SECRET); - admin.code = null; - admin.active = true; - admin.token = Admin.extractTokenPart(token); - await admin.save(); + this.code = null; + this.active = true; + this.token = Admin.extractTokenPart(token); + await this.save(); return { token, @@ -144,9 +142,8 @@ adminSchema.methods.generateAuthToken = async function () { }; adminSchema.methods.generateAuthCode = async function () { - const admin = this; - admin.code = Math.random().toString(36).slice(-8); - return admin.code; + this.code = Math.random().toString(36).slice(-8); + return this.code; }; adminSchema.statics.findByCredentials = async (email, password) => { @@ -222,11 +219,9 @@ adminSchema.statics.extractTokenPart = (token) => { }; adminSchema.pre('save', async function (next) { - const admin = this; - - if (admin.isModified('password')) { - admin.password = await bcryptjs.hash(admin.password, EncryptionSalts.ADMIN); - notifyAcCreation(admin._id); + if (this.isModified('password')) { + this.password = await bcryptjs.hash(this.password, EncryptionSalts.ADMIN); + notifyAcCreation(this._id); } next(); @@ -241,15 +236,14 @@ adminSchema.post('save', function(error, _doc, next) { }); adminSchema.pre('deleteOne', { document: true, query: false }, async function (next) { - const admin = this; - const teams = await Team.find({ members: admin._id }).exec(); + const teams = await Team.find({ members: this._id }).exec(); for (const team of teams) { - let indexMmeber = team.members.indexOf(admin._id); + let indexMmeber = team.members.indexOf(this._id); team.members.splice(indexMmeber, 1); await team.save(); } - notifyAcDeletion(admin._id); + notifyAcDeletion(this._id); next(); }); diff --git a/src/models/common/index.js b/src/models/common/index.js index fe0510a5..3feb7cb3 100644 --- a/src/models/common/index.js +++ b/src/models/common/index.js @@ -90,7 +90,7 @@ export async function recordHistory(modifiedField, oldDocument, newDocument, dom modifiedField.forEach(keys => { const keyArr = keys.split('.'); checkDifference(diff, documents, defaultIgnoredFields, - keyArr, keys.replace(/\./g, '/'), 0); + keyArr, keys.replaceAll('.', '/'), 0); }); if (diff.newValues.size > 0) { diff --git a/src/models/component.js b/src/models/component.js index 87b9fc1c..71d276bf 100644 --- a/src/models/component.js +++ b/src/models/component.js @@ -1,7 +1,7 @@ import mongoose from 'mongoose'; import moment from 'moment'; import bcryptjs from 'bcryptjs'; -import { randomUUID } from 'crypto'; +import { randomUUID } from 'node:crypto'; import { Config } from './config.js'; import { EncryptionSalts } from './common/index.js'; @@ -52,12 +52,10 @@ componentSchema.options.toJSON = { }; componentSchema.methods.generateApiKey = async function () { - const component = this; - const apiKey = randomUUID(); const hash = await bcryptjs.hash(apiKey, EncryptionSalts.COMPONENT); - component.apihash = hash; - await component.save(); + this.apihash = hash; + await this.save(); return apiKey; }; @@ -71,11 +69,9 @@ const existComponent = async ({ domain, name, __v }) => { }; componentSchema.pre('validate', async function (next) { - const component = this; - // Verify if component already exists - if (await existComponent(component)) { - const err = new Error(`Unable to complete the operation. Component '${component.name}' already exists for this Domain`); + if (await existComponent(this)) { + const err = new Error(`Unable to complete the operation. Component '${this.name}' already exists for this Domain`); next(err); } @@ -83,14 +79,12 @@ componentSchema.pre('validate', async function (next) { }); componentSchema.pre('deleteOne', { document: true, query: false }, async function (next) { - const component = this; - - const configsToRemoveFrom = await Config.find({ components: { $in: [component._id] } }).exec(); - configsToRemoveFrom.forEach(config => { - const indexValue = config.components.indexOf(component._id); + const configsToRemoveFrom = await Config.find({ components: { $in: [this._id] } }).exec(); + for (const config of configsToRemoveFrom) { + const indexValue = config.components.indexOf(this._id); config.components.splice(indexValue, 1); config.save(); - }); + } next(); }); diff --git a/src/models/config-strategy.js b/src/models/config-strategy.js index 1ed8201d..6ebe623c 100644 --- a/src/models/config-strategy.js +++ b/src/models/config-strategy.js @@ -31,7 +31,7 @@ const StrategyRequirementDefinition = [ strategy: StrategiesType.NETWORK, operations: [OperationsType.EXIST, OperationsType.NOT_EXIST], format: '10.0.0.0/24 (CIDR) or 10.0.0.1 (IPv4 address)', - validator: '^([0-9]{1,3}\\.){3}[0-9]{1,3}(\\/([0-9]|[1-2][0-9]|3[0-2]))?$' + validator: String.raw`^([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?$` }, { strategy: StrategiesType.VALUE, @@ -42,7 +42,7 @@ const StrategyRequirementDefinition = [ operations: [OperationsType.EXIST, OperationsType.NOT_EXIST, OperationsType.EQUAL, OperationsType.NOT_EQUAL, OperationsType.BETWEEN, OperationsType.LOWER, OperationsType.GREATER], format: 'Numeric values (positive/negative or with decimal)', - validator: '^((-[0-9]{1,})|([0-9]{1,}))(\\.[0-9]{1,})?$' + validator: String.raw`^((-[0-9]{1,})|([0-9]{1,}))(\.[0-9]{1,})?$` }, { strategy: StrategiesType.TIME, @@ -59,7 +59,7 @@ const StrategyRequirementDefinition = [ { strategy: StrategiesType.REGEX, operations: [OperationsType.EXIST, OperationsType.NOT_EXIST, OperationsType.EQUAL, OperationsType.NOT_EQUAL], - format: 'Hint: NOT/EQUAL forces \\b (delimiter) flag' + format: String.raw`Hint: NOT/EQUAL forces \b (delimiter) flag` }, { strategy: StrategiesType.PAYLOAD, @@ -116,10 +116,10 @@ const OperationValuesValidation = [ ]; export function validateStrategyValue(strategy, value) { - const strategyRules = StrategyRequirementDefinition.filter(element => element.strategy === strategy); + const strategyRules = StrategyRequirementDefinition.find(element => element.strategy === strategy); - if (!value.match(strategyRules[0].validator)) { - throw new Error(`Value does not match with the requirements for this Strategy. Please, try using: ${strategyRules[0].format}`); + if (!value.match(strategyRules.validator)) { + throw new Error(`Value does not match with the requirements for this Strategy. Please, try using: ${strategyRules.format}`); } return true; } @@ -134,9 +134,9 @@ export function strategyRequirements(strategy) { const operationsAvailable = StrategyRequirementDefinition.find(element => element.strategy === foundStrategy); let operationRequirements = []; - operationsAvailable.operations.forEach((o) => { + for (const o of operationsAvailable.operations) { operationRequirements.push(OperationValuesValidation.find(element => element.operation === o)); - }); + } return { strategy: foundStrategy, @@ -238,49 +238,48 @@ configStrategySchema.options.toJSON = { }; configStrategySchema.pre('deleteOne', { document: true, query: false }, async function (next) { - const strategyConfig = this; - await History.deleteMany({ domainId: strategyConfig.domain, - elementId: strategyConfig._id }).exec(); + await History.deleteMany({ domainId: this.domain, + elementId: this._id }).exec(); next(); }); configStrategySchema.pre('save', async function (next) { - const strategyConfig = this; - - const strategy = strategyConfig.strategy; - const operationStrategy = strategyConfig.operation; - const { min, max } = OperationValuesValidation.filter(element => element.operation === operationStrategy)[0]; + const strategy = this.strategy; + const operationStrategy = this.operation; + const { min, max } = OperationValuesValidation.find(element => element.operation === operationStrategy); // Verify if strategy already exists - if (await existStrategy(strategyConfig)) { + if (await existStrategy(this)) { const err = new Error(`Unable to complete the operation. Strategy '${strategy}' already exists for this configuration and environment`); return next(err); } // Verify strategy value quantity - if (!strategyConfig.values || strategyConfig.values.length < min || strategyConfig.values.length > max) { + if (!this.values || this.values.length < min || this.values.length > max) { const err = new Error(`Unable to complete the operation. The number of values for the operation '${operationStrategy}', are min: ${min} and max: ${max} values`); return next(err); } const operations = StrategyRequirementDefinition.find(element => element.strategy === strategy).operations; - const foundOperation = operations.filter((element) => element === operationStrategy); + const foundOperation = operations.find((element) => element === operationStrategy); // Verify strategy operation requirements - if (!foundOperation.length) { + if (!foundOperation) { const err = new Error(`Unable to complete the operation. The strategy '${strategy}' needs ${operations} as operation`); return next(err); } // Verify strategy values format try { - strategyConfig.values.forEach(value => validateStrategyValue(strategy, value)); + for (const value of this.values) { + validateStrategyValue(strategy, value); + } } catch (err) { return next(err); } - await recordStrategyHistory(strategyConfig, this.modifiedPaths()); + await recordStrategyHistory(this, this.modifiedPaths()); next(); }); diff --git a/src/models/config.js b/src/models/config.js index 2126a36c..854ea2f4 100644 --- a/src/models/config.js +++ b/src/models/config.js @@ -163,7 +163,7 @@ async function recordConfigHistory(config, modifiedField) { } function hasRelayEndpointUpdates(config, modifiedField) { - const hasUpdate = modifiedField.filter(field => field.indexOf('relay.endpoint.') >= 0); + const hasUpdate = modifiedField.filter(field => field.includes('relay.endpoint.')); if (hasUpdate.length) { const environment = hasUpdate[0].split('.')[2]; @@ -181,25 +181,23 @@ configSchema.virtual('configStrategy', { }); configSchema.pre('deleteOne', { document: true, query: false }, async function (next) { - const config = this; - - const strategies = await ConfigStrategy.find({ config: config._id }).exec(); + const strategies = await ConfigStrategy.find({ config: this._id }).exec(); if (strategies) { for (const strategy of strategies) { await Promise.resolve(strategy.deleteOne()); } } - - await History.deleteMany({ domainId: config.domain, elementId: config._id }).exec(); + + await History.deleteMany({ domainId: this.domain, elementId: this._id }).exec(); next(); }); configSchema.pre('save', async function (next) { - const config = this; - await config.populate({ path: 'component_list' }); - await recordConfigHistory(config.toJSON(), this.modifiedPaths()); - await checkMetrics(config); - hasRelayEndpointUpdates(config, this.modifiedPaths()); + await this.populate({ path: 'component_list' }); + await this.populate({ path: 'component_list' }); + await recordConfigHistory(this.toJSON(), this.modifiedPaths()); + await checkMetrics(this); + hasRelayEndpointUpdates(this, this.modifiedPaths()); next(); }); diff --git a/src/models/domain.js b/src/models/domain.js index 551af2da..8c2bf59f 100644 --- a/src/models/domain.js +++ b/src/models/domain.js @@ -109,16 +109,15 @@ domainSchema.options.toJSON = { }; domainSchema.pre('deleteOne', { document: true, query: false }, async function (next) { - const domain = this; - const groups = await GroupConfig.find({ domain: domain._id }).exec(); - + const groups = await GroupConfig.find({ domain: this._id }).exec(); + if (groups) { for (const group of groups) { await Promise.resolve(group.deleteOne()); } } - const teams = await Team.find({ domain: domain._id }).exec(); + const teams = await Team.find({ domain: this._id }).exec(); if (teams) { for (const team of teams) { await Promise.resolve(team.deleteOne()); @@ -126,10 +125,10 @@ domainSchema.pre('deleteOne', { document: true, query: false }, async function ( } await Promise.all([ - Component.deleteMany({ domain: domain._id }), - Environment.deleteMany({ domain: domain._id }), - History.deleteMany({ domainId: domain._id }), - Metric.deleteMany({ domain: domain._id }) + Component.deleteMany({ domain: this._id }), + Environment.deleteMany({ domain: this._id }), + History.deleteMany({ domainId: this._id }), + Metric.deleteMany({ domain: this._id }) ]); next(); @@ -143,8 +142,7 @@ async function recordDomainHistory(domain, modifiedField) { } domainSchema.pre('save', async function (next) { - const domain = this; - await recordDomainHistory(domain, this.modifiedPaths()); + await recordDomainHistory(this, this.modifiedPaths()); next(); }); diff --git a/src/models/group-config.js b/src/models/group-config.js index f219acda..4c4e7841 100644 --- a/src/models/group-config.js +++ b/src/models/group-config.js @@ -75,8 +75,7 @@ groupConfigSchema.virtual('config', { }); groupConfigSchema.pre('deleteOne', { document: true, query: false }, async function (next) { - const group = this; - const configs = await Config.find({ group: group._id }).exec(); + const configs = await Config.find({ group: this._id }).exec(); if (configs) { for (const config of configs) { @@ -84,13 +83,12 @@ groupConfigSchema.pre('deleteOne', { document: true, query: false }, async funct } } - await History.deleteMany({ domainId: group.domain, elementId: group._id }).exec(); + await History.deleteMany({ domainId: this.domain, elementId: this._id }).exec(); next(); }); groupConfigSchema.pre('save', async function (next) { - const group = this; - await recordGroupHistory(group, this.modifiedPaths()); + await recordGroupHistory(this, this.modifiedPaths()); next(); }); diff --git a/src/models/slack.js b/src/models/slack.js index caaf698c..9c952936 100644 --- a/src/models/slack.js +++ b/src/models/slack.js @@ -59,8 +59,7 @@ slackSchema.options.toJSON = { }; slackSchema.pre('deleteOne', { document: true, query: false }, async function (next) { - const slack = this; - await SlackTicket.deleteMany({ slack: slack._id }).exec(); + await SlackTicket.deleteMany({ slack: this._id }).exec(); next(); }); diff --git a/src/models/team.js b/src/models/team.js index 8e4a5650..7256a5ad 100644 --- a/src/models/team.js +++ b/src/models/team.js @@ -67,11 +67,9 @@ const existTeam = async (team) => { }; teamSchema.pre('validate', async function (next) { - const team = this; - // Verify if team already exists - if (await existTeam(team)) { - const err = new Error(`Unable to complete the operation. Team '${team.name}' already exists for this Domain`); + if (await existTeam(this)) { + const err = new Error(`Unable to complete the operation. Team '${this.name}' already exists for this Domain`); next(err); } @@ -79,15 +77,14 @@ teamSchema.pre('validate', async function (next) { }); teamSchema.pre('deleteOne', { document: true, query: false }, async function (next) { - const team = this; - await Permission.deleteMany({ _id: { $in: team.permissions } }).exec(); + await Permission.deleteMany({ _id: { $in: this.permissions } }).exec(); - const membersToRemve = await Admin.find({ teams: team._id }).exec(); - membersToRemve.forEach(member => { - const indexValue = member.teams.indexOf(team._id); + const membersToRemve = await Admin.find({ teams: this._id }).exec(); + for (const member of membersToRemve) { + const indexValue = member.teams.indexOf(this._id); member.teams.splice(indexValue, 1); member.save(); - }); + } next(); }); diff --git a/src/routers/common/index.js b/src/routers/common/index.js index 2c5f6cf0..a4a0c4ee 100644 --- a/src/routers/common/index.js +++ b/src/routers/common/index.js @@ -1,7 +1,7 @@ export function getFields(elements, fields) { return elements.map(element => { const newElement = {}; - fields.split(',').forEach(field => { + for (const field of fields.split(',')) { if (field.includes('.')) { const nestedFields = field.split('.'); const nextNestedFields = field.substring(field.indexOf('.') + 1); @@ -11,7 +11,7 @@ export function getFields(elements, fields) { } else { newElement[field] = getElement(element, field); } - }); + } return newElement; }); } diff --git a/src/routers/component.js b/src/routers/component.js index 4e77c692..42fd7678 100644 --- a/src/routers/component.js +++ b/src/routers/component.js @@ -41,8 +41,8 @@ router.get('/component', auth, [ let components = await Services.getComponents({ domain: req.query.domain }, ['_id', 'name', 'description'], { - skip: parseInt(req.query.skip || 0), - limit: parseInt(req.query.limit || 10), + skip: Number.parseInt(req.query.skip || 0), + limit: Number.parseInt(req.query.limit || 10), sort: { name: req.query.sort === 'desc' ? -1 : 1 } diff --git a/src/routers/config-strategy.js b/src/routers/config-strategy.js index 0c5d84d8..15bbd5f8 100644 --- a/src/routers/config-strategy.js +++ b/src/routers/config-strategy.js @@ -37,8 +37,8 @@ router.get('/configstrategy', auth, [ await config.populate({ path: 'configStrategy', options: { - limit: parseInt(req.query.limit || 10), - skip: parseInt(req.query.skip || 0), + limit: Number.parseInt(req.query.limit || 10), + skip: Number.parseInt(req.query.skip || 0), sort: sortBy(req.query) } }); diff --git a/src/routers/config.js b/src/routers/config.js index 1e568724..677686ad 100644 --- a/src/routers/config.js +++ b/src/routers/config.js @@ -45,8 +45,8 @@ router.get('/config', auth, [ await groupConfig.populate({ path: 'config', options: { - limit: parseInt(req.query.limit || 10), - skip: parseInt(req.query.skip || 0), + limit: Number.parseInt(req.query.limit || 10), + skip: Number.parseInt(req.query.skip || 0), sort: sortBy(req.query) } }); diff --git a/src/routers/domain.js b/src/routers/domain.js index 1bb38729..70babe7c 100644 --- a/src/routers/domain.js +++ b/src/routers/domain.js @@ -30,8 +30,8 @@ router.get('/domain', auth, async (req, res) => { await req.admin.populate({ path: 'domain', options: { - limit: parseInt(req.query.limit || 10), - skip: parseInt(req.query.skip || 0), + limit: Number.parseInt(req.query.limit || 10), + skip: Number.parseInt(req.query.skip || 0), sort: sortBy(req.query) } }); diff --git a/src/routers/environment.js b/src/routers/environment.js index 87c4f4a7..8f3bbf07 100644 --- a/src/routers/environment.js +++ b/src/routers/environment.js @@ -29,8 +29,8 @@ router.get('/environment', auth, [ let environments = await Services.getEnvironments({ domain: req.query.domain }, ['_id', 'name'], { - skip: parseInt(req.query.skip || 0), - limit: parseInt(req.query.limit || 10), + skip: Number.parseInt(req.query.skip || 0), + limit: Number.parseInt(req.query.limit || 10), sort: { name: req.query.sort === 'desc' ? -1 : 1 } diff --git a/src/routers/gitops.js b/src/routers/gitops.js index 8f476935..ba14063f 100644 --- a/src/routers/gitops.js +++ b/src/routers/gitops.js @@ -22,11 +22,11 @@ const windowValidation = (value) => { throw new Error('Invalid window value'); } - if (value.endsWith('s') && parseInt(value) < 30) { + if (value.endsWith('s') && Number.parseInt(value) < 30) { throw new Error('Invalid window value (minimum 30s)'); } - if (parseInt(value) < 1) { + if (Number.parseInt(value) < 1) { throw new Error('Invalid window value (minimum 1[m/h])'); } diff --git a/src/routers/group-config.js b/src/routers/group-config.js index 69a25f34..a10a2e58 100644 --- a/src/routers/group-config.js +++ b/src/routers/group-config.js @@ -37,8 +37,8 @@ router.get('/groupconfig', auth, [ await domain.populate({ path: 'groupConfig', options: { - limit: parseInt(req.query.limit || 10), - skip: parseInt(req.query.skip || 0), + limit: Number.parseInt(req.query.limit || 10), + skip: Number.parseInt(req.query.skip || 0), sort: sortBy(req.query) } }); diff --git a/src/routers/metric.js b/src/routers/metric.js index e3ab2c6d..a5055659 100644 --- a/src/routers/metric.js +++ b/src/routers/metric.js @@ -21,7 +21,7 @@ router.get('/metric/data/', auth, [ try { const page = String(req.query.page); if (isNaN(page)) { - throw new Error('Page value should be a number'); + throw new TypeError('Page value should be a number'); } const data = await getData(req, page); diff --git a/src/services/config.js b/src/services/config.js index 3f512125..3c97c17f 100644 --- a/src/services/config.js +++ b/src/services/config.js @@ -179,7 +179,7 @@ export async function updateConfigRelay(id, args, admin) { config.updatedBy = admin.email; for (const update of Object.keys(args)) { - if (config.relay[update] && 'activated endpoint auth_token'.indexOf(update) >= 0) { + if (config.relay[update] && 'activated endpoint auth_token'.includes(update)) { await checkEnvironmentStatusChange(args, config.domain, args[update]); Object.keys(args[update]).forEach((map) => config.relay[update].set(map, args[update][map])); diff --git a/src/services/domain.js b/src/services/domain.js index 418ad04b..7aa073e8 100644 --- a/src/services/domain.js +++ b/src/services/domain.js @@ -1,4 +1,4 @@ -import { randomUUID } from 'crypto'; +import { randomUUID } from 'node:crypto'; import { checkEnvironmentStatusChange } from '../middleware/validators.js'; import Component from '../models/component.js'; import { Config } from '../models/config.js'; diff --git a/src/services/history.js b/src/services/history.js index f31a8f3e..933aa620 100644 --- a/src/services/history.js +++ b/src/services/history.js @@ -10,8 +10,8 @@ export async function getHistory(query, domainId, elementId, pagingArgs = {}) { return History.find({ domainId, elementId }) .select(query) .sort(sortBy(pagingArgs)) - .limit(parseInt(pagingArgs.limit || 10)) - .skip(parseInt(pagingArgs.skip || 0)) + .limit(Number.parseInt(pagingArgs.limit || 10)) + .skip(Number.parseInt(pagingArgs.skip || 0)) .exec(); } diff --git a/src/services/metric.js b/src/services/metric.js index fae12d34..57d1a897 100644 --- a/src/services/metric.js +++ b/src/services/metric.js @@ -15,11 +15,11 @@ export async function getData(req, page) { args.config = config._id; } - const skip = parseInt((process.env.METRICS_MAX_PAGE * parseInt(page)) - process.env.METRICS_MAX_PAGE); + const skip = Number.parseInt((process.env.METRICS_MAX_PAGE * Number.parseInt(page)) - process.env.METRICS_MAX_PAGE); return Metric.find({ ...args }, 'config component entry result reason message group environment date -_id', { skip, - limit: parseInt(process.env.METRICS_MAX_PAGE) + limit: Number.parseInt(process.env.METRICS_MAX_PAGE) }).sort(req.query.sortBy ? String(req.query.sortBy).replace(';', ' ') : 'date') .populate({ path: 'config', select: 'key -_id' }).exec(); } @@ -45,11 +45,11 @@ export async function getStatistics(req) { let result = {}; const options = String(req.query.statistics); await Promise.all([ - RegExp(/(switchers)|(all)/).exec(options) ? + new RegExp(/(switchers)|(all)/).exec(options) ? aggregateSwitchers(switcher.aggregate, dateGroupPattern, result) : Promise.resolve(), - RegExp(/(components)|(all)/).exec(options) ? + new RegExp(/(components)|(all)/).exec(options) ? aggregateComponents(components.aggregate, dateGroupPattern, result) : Promise.resolve(), - RegExp(/(reasons)|(all)/).exec(options) ? + new RegExp(/(reasons)|(all)/).exec(options) ? aggreagateReasons(reasons.aggregate, result) : Promise.resolve() ]); @@ -220,18 +220,18 @@ function buildMetricsFilter(req) { export function buildStatistics(aggregatedData, dataKey, timeframe = false) { let compiledData = []; - aggregatedData.forEach(data => { + for (const data of aggregatedData) { const entry = compiledData.filter(dataEntry => dataEntry[`${dataKey}`] === data[`${dataKey}`]); const result = data.result ? 'positive' : 'negative'; if (entry.length) { entry[0][`${result}`] += data.total; - entry[0].total = entry[0][`${result}`] + entry[0][`${!data.result ? 'positive' : 'negative'}`]; + entry[0].total = entry[0][`${result}`] + entry[0][`${data.result ? 'negative' : 'positive'}`]; } else { const newEntry = { [`${dataKey}`]: data[`${dataKey}`], [`${result}`]: data.total, - [`${!data.result ? 'positive' : 'negative'}`]: 0, + [`${data.result ? 'negative' : 'positive'}`]: 0, total: data.total }; if (!timeframe) { @@ -244,7 +244,7 @@ export function buildStatistics(aggregatedData, dataKey, timeframe = false) { } compiledData.push(newEntry); } - }); + } return compiledData; } diff --git a/src/services/permission.js b/src/services/permission.js index 1fcb211b..5bed8a89 100644 --- a/src/services/permission.js +++ b/src/services/permission.js @@ -71,11 +71,11 @@ export async function deletePermission(id, admin) { const team = await verifyRequestedTeamByPermission(permission._id, admin, ActionTypes.DELETE); const teams = await getTeams({ permissions: permission._id }); - teams.forEach(pTeam => { + for (const pTeam of teams) { const indexValue = pTeam.permissions.indexOf(permission._id); pTeam.permissions.splice(indexValue, 1); pTeam.save(); - }); + } permissionCache.permissionReset(team.domain, permission.action, permission.router); return permission.deleteOne(); diff --git a/src/services/relay.js b/src/services/relay.js index baefe316..e9a4038c 100644 --- a/src/services/relay.js +++ b/src/services/relay.js @@ -1,5 +1,5 @@ import axios from 'axios'; -import https from 'https'; +import https from 'node:https'; import { checkHttpsAgent } from '../external/switcher-api-facade.js'; import Logger from '../helpers/logger.js'; diff --git a/src/services/team.js b/src/services/team.js index f6025738..876a84fc 100644 --- a/src/services/team.js +++ b/src/services/team.js @@ -48,8 +48,8 @@ export async function getTeams(where) { export async function getTeamsSort(where, projection, skip, limit, sort) { return Team.find(where, projection, { - skip: parseInt(skip || 0), - limit: parseInt(limit || 10), + skip: Number.parseInt(skip || 0), + limit: Number.parseInt(limit || 10), sort: { name: sort === 'desc' ? -1 : 1 } diff --git a/tests/config-strategy.test.js b/tests/config-strategy.test.js index 68c7672a..c96cc6ab 100644 --- a/tests/config-strategy.test.js +++ b/tests/config-strategy.test.js @@ -678,7 +678,7 @@ describe('Testing update strategies #1', () => { value: 'USER_4' }).expect(200); - expect(response.body.values[response.body.values.length - 1]).toEqual('USER_4'); + expect(response.body.values.at(-1)).toEqual('USER_4'); // DB validation const configStrategy = await ConfigStrategy.findOne({ _id: configStrategyId }).lean().exec(); @@ -765,7 +765,7 @@ describe('Testing update strategies #1', () => { newvalue: 'USER_THREE' }).expect(200); - expect(response.body.values[response.body.values.length - 1]).toEqual('USER_THREE'); + expect(response.body.values.at(-1)).toEqual('USER_THREE'); // DB validation const configStrategy = await ConfigStrategy.findOne({ _id: configStrategyId }).lean().exec(); diff --git a/tests/fixtures/db_api.js b/tests/fixtures/db_api.js index bbf7da69..05d5ab89 100644 --- a/tests/fixtures/db_api.js +++ b/tests/fixtures/db_api.js @@ -1,6 +1,6 @@ import mongoose from 'mongoose'; import bcryptjs from 'bcryptjs'; -import { randomUUID } from 'crypto'; +import { randomUUID } from 'node:crypto'; import jwt from 'jsonwebtoken'; import Admin from '../../src/models/admin'; import Domain from '../../src/models/domain'; diff --git a/tests/fixtures/db_client.js b/tests/fixtures/db_client.js index 9444761b..5732c0eb 100644 --- a/tests/fixtures/db_client.js +++ b/tests/fixtures/db_client.js @@ -1,7 +1,7 @@ import mongoose from 'mongoose'; import jwt from 'jsonwebtoken'; import bcryptjs from 'bcryptjs'; -import { randomUUID } from 'crypto'; +import { randomUUID } from 'node:crypto'; import Admin from '../../src/models/admin'; import Domain from '../../src/models/domain'; import GroupConfig from '../../src/models/group-config'; diff --git a/tests/fixtures/db_client_payload.js b/tests/fixtures/db_client_payload.js index 7e302416..a3601e8d 100644 --- a/tests/fixtures/db_client_payload.js +++ b/tests/fixtures/db_client_payload.js @@ -1,7 +1,7 @@ import mongoose from 'mongoose'; import jwt from 'jsonwebtoken'; import bcryptjs from 'bcryptjs'; -import { randomUUID } from 'crypto'; +import { randomUUID } from 'node:crypto'; import Admin from '../../src/models/admin'; import Domain from '../../src/models/domain'; import GroupConfig from '../../src/models/group-config'; diff --git a/tests/fixtures/db_metrics.js b/tests/fixtures/db_metrics.js index b59814ae..2d1671b8 100644 --- a/tests/fixtures/db_metrics.js +++ b/tests/fixtures/db_metrics.js @@ -1,7 +1,7 @@ import mongoose from 'mongoose'; import jwt from 'jsonwebtoken'; import bcryptjs from 'bcryptjs'; -import { randomUUID } from 'crypto'; +import { randomUUID } from 'node:crypto'; import { Metric } from '../../src/models/metric'; import Admin from '../../src/models/admin'; import { EnvType } from '../../src/models/environment';