diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dbccc1..549ca19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ ## Changelog -### [v6.1.0](https://github.com/panates/valgen/compare/v6.0.3...v6.1.0) - +### [v6.2.0](https://github.com/panates/valgen/compare/v6.1.0...v6.2.0) - + +#### 🚀 New Features + +- feat: Added `fixed` validator @Eray Hanoğlu + +#### 🛠 Refactoring and Updates + +- refactor: Replaced hardcoded validator names with function names, added nullable validator and tests @Eray Hanoğlu + +### [v6.1.0](https://github.com/panates/valgen/compare/v6.0.3...v6.1.0) - 30 April 2026 #### 🚀 New Features diff --git a/package-lock.json b/package-lock.json index cc4944d..dcd38f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "valgen", - "version": "6.1.0", + "version": "6.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "valgen", - "version": "6.1.0", + "version": "6.2.0", "license": "MIT", "dependencies": { "@browsery/validator": "^13.15.35", @@ -21,18 +21,18 @@ "@panates/eslint-config-ts": "^2.1.6", "@panates/tsconfig": "^2.1.6", "@swc-node/register": "^1.11.1", - "@swc/core": "^1.15.32", + "@swc/core": "^1.15.33", "@swc/helpers": "^0.5.21", "@types/mocha": "^10.0.10", - "@types/node": "^25.6.0", - "auto-changelog": "^2.5.0", + "@types/node": "^25.7.0", + "auto-changelog": "^2.5.1", "c8": "^11.0.0", - "dpdm": "^4.0.1", - "expect": "^30.3.0", - "globals": "^17.5.0", + "dpdm": "^4.2.0", + "expect": "^30.4.1", + "globals": "^17.6.0", "husky": "^9.1.7", "mocha": "^11.7.5", - "npm-check-updates": "^22.0.1", + "npm-check-updates": "^22.2.0", "prettier": "^3.8.3", "rimraf": "^6.1.3", "ts-cleanup": "^1.3.0", @@ -413,9 +413,9 @@ } }, "node_modules/@jest/diff-sequences": { - "version": "30.3.0", - "resolved": "https://registry.npmjs.org/@jest/diff-sequences/-/diff-sequences-30.3.0.tgz", - "integrity": "sha512-cG51MVnLq1ecVUaQ3fr6YuuAOitHK1S4WUJHnsPFE/quQr33ADUx1FfrTCpMCRxvy0Yr9BThKpDjSlcTi91tMA==", + "version": "30.4.0", + "resolved": "https://registry.npmjs.org/@jest/diff-sequences/-/diff-sequences-30.4.0.tgz", + "integrity": "sha512-zOpzlfUs45l6u7jm39qr87JCHUDsaeCtvL+kQe/Vn9jSnRB4/5IPXISm0h9I1vZW/o00Kn4UTJ2MOlhnUGwv3g==", "dev": true, "license": "MIT", "engines": { @@ -423,9 +423,9 @@ } }, "node_modules/@jest/expect-utils": { - "version": "30.3.0", - "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-30.3.0.tgz", - "integrity": "sha512-j0+W5iQQ8hBh7tHZkTQv3q2Fh/M7Je72cIsYqC4OaktgtO7v1So9UTjp6uPBHIaB6beoF/RRsCgMJKvti0wADA==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-30.4.1.tgz", + "integrity": "sha512-ZBn5CglH8fBsQsvs4VWNzD4aWfUYks+IdOOQU3MEK71ol/BcVm+P+rtb1KpiFBpSWSCE27uOahyyf1vfqOVbcQ==", "dev": true, "license": "MIT", "dependencies": { @@ -446,23 +446,23 @@ } }, "node_modules/@jest/pattern": { - "version": "30.0.1", - "resolved": "https://registry.npmjs.org/@jest/pattern/-/pattern-30.0.1.tgz", - "integrity": "sha512-gWp7NfQW27LaBQz3TITS8L7ZCQ0TLvtmI//4OwlQRx4rnWxcPNIYjxZpDcN4+UlGxgm3jS5QPz8IPTCkb59wZA==", + "version": "30.4.0", + "resolved": "https://registry.npmjs.org/@jest/pattern/-/pattern-30.4.0.tgz", + "integrity": "sha512-RAWn3+f9u8BsHijKJ71uHcFp6vmyEt6VvoWXkl6hKF3qVIuWNmudVjg12DlBPGup/frIl5UcUlH5HfEuvHpEXg==", "dev": true, "license": "MIT", "dependencies": { "@types/node": "*", - "jest-regex-util": "30.0.1" + "jest-regex-util": "30.4.0" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/@jest/schemas": { - "version": "30.0.5", - "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-30.0.5.tgz", - "integrity": "sha512-DmdYgtezMkh3cpU8/1uyXakv3tJRcmcXxBOcO0tbaozPwpmh4YMsnWrQm9ZmZMfa5ocbxzbFk6O4bDPEc/iAnA==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-30.4.1.tgz", + "integrity": "sha512-i6b4qw5qnP8c5FEeBJg/uZQ4ddrkN6Ca8qISJh0pr7a5hfn3h3v5x60BEbOC7OYAGZNMs1LfFLwnW2CuK8F57Q==", "dev": true, "license": "MIT", "dependencies": { @@ -473,14 +473,14 @@ } }, "node_modules/@jest/types": { - "version": "30.3.0", - "resolved": "https://registry.npmjs.org/@jest/types/-/types-30.3.0.tgz", - "integrity": "sha512-JHm87k7bA33hpBngtU8h6UBub/fqqA9uXfw+21j5Hmk7ooPHlboRNxHq0JcMtC+n8VJGP1mcfnD3Mk+XKe1oSw==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-30.4.1.tgz", + "integrity": "sha512-f1x/vJXIfjOlEmejYpbkbgw1gOqpPECwMvMEtBqe47j7H2Hg8h8w3o3ikhSXq3MI15kg+oQ0exWO0uCtTNJLoQ==", "dev": true, "license": "MIT", "dependencies": { - "@jest/pattern": "30.0.1", - "@jest/schemas": "30.0.5", + "@jest/pattern": "30.4.0", + "@jest/schemas": "30.4.1", "@types/istanbul-lib-coverage": "^2.0.6", "@types/istanbul-reports": "^3.0.4", "@types/node": "*", @@ -727,9 +727,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -744,9 +741,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -761,9 +755,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -778,9 +769,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -795,9 +783,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -812,9 +797,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -829,9 +811,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -846,9 +825,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1069,9 +1045,9 @@ } }, "node_modules/@swc/core": { - "version": "1.15.32", - "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.15.32.tgz", - "integrity": "sha512-/eWL0n43D64QWEUHLtTE+jDqjkJhyidjkDhv6f0uJohOUAhywxQ9wXYp845DNNds0JpCdI4Uo0a9bl+vbXf+ew==", + "version": "1.15.33", + "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.15.33.tgz", + "integrity": "sha512-jOlwnFV2xhuuZeAUILGFULeR6vDPfijEJ57evfocwznQldLU3w2cZ9bSDryY9ip+AsM3r1NJKzf47V2NXebkeQ==", "dev": true, "hasInstallScript": true, "license": "Apache-2.0", @@ -1087,18 +1063,18 @@ "url": "https://opencollective.com/swc" }, "optionalDependencies": { - "@swc/core-darwin-arm64": "1.15.32", - "@swc/core-darwin-x64": "1.15.32", - "@swc/core-linux-arm-gnueabihf": "1.15.32", - "@swc/core-linux-arm64-gnu": "1.15.32", - "@swc/core-linux-arm64-musl": "1.15.32", - "@swc/core-linux-ppc64-gnu": "1.15.32", - "@swc/core-linux-s390x-gnu": "1.15.32", - "@swc/core-linux-x64-gnu": "1.15.32", - "@swc/core-linux-x64-musl": "1.15.32", - "@swc/core-win32-arm64-msvc": "1.15.32", - "@swc/core-win32-ia32-msvc": "1.15.32", - "@swc/core-win32-x64-msvc": "1.15.32" + "@swc/core-darwin-arm64": "1.15.33", + "@swc/core-darwin-x64": "1.15.33", + "@swc/core-linux-arm-gnueabihf": "1.15.33", + "@swc/core-linux-arm64-gnu": "1.15.33", + "@swc/core-linux-arm64-musl": "1.15.33", + "@swc/core-linux-ppc64-gnu": "1.15.33", + "@swc/core-linux-s390x-gnu": "1.15.33", + "@swc/core-linux-x64-gnu": "1.15.33", + "@swc/core-linux-x64-musl": "1.15.33", + "@swc/core-win32-arm64-msvc": "1.15.33", + "@swc/core-win32-ia32-msvc": "1.15.33", + "@swc/core-win32-x64-msvc": "1.15.33" }, "peerDependencies": { "@swc/helpers": ">=0.5.17" @@ -1110,9 +1086,9 @@ } }, "node_modules/@swc/core-darwin-arm64": { - "version": "1.15.32", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.15.32.tgz", - "integrity": "sha512-/YWMvJDPu+AAwuUsM2G+DNQ/7zhodURGzdQyewEqcvgklAdDHs3LwQmLLnyn6SJl8DT8UOxkbzK+D1PmPeelRg==", + "version": "1.15.33", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.15.33.tgz", + "integrity": "sha512-N+L0uXhuO7FIfzqwgxmzv0zIpV0qEp8wPX3QQs2p4atjMoywup2JTeDlXPw+z9pWJGCae3JjM+tZ6myclI+2gA==", "cpu": [ "arm64" ], @@ -1127,9 +1103,9 @@ } }, "node_modules/@swc/core-darwin-x64": { - "version": "1.15.32", - "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.15.32.tgz", - "integrity": "sha512-KOTXJXdAhWL+hZ77MYP3z+4pcMFaQhQ74yqyN1uz093q0YnbxpqMtYpPISbYvMHzVRNNx5kN+9RZAXEaadhWVA==", + "version": "1.15.33", + "resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.15.33.tgz", + "integrity": "sha512-/Il4QHSOhV4FekbsDtkrNmKbsX26oSysvgrRswa/RYOHXAkwXDbB4jaeKq6PsJLSPkzJ2KzQ061gtBnk0vNHfA==", "cpu": [ "x64" ], @@ -1144,9 +1120,9 @@ } }, "node_modules/@swc/core-linux-arm-gnueabihf": { - "version": "1.15.32", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.15.32.tgz", - "integrity": "sha512-oOoxLweljlc0A4X8ybsgxV7cVaYTwBOg2iMDJcFR3Sr48C+lsv9VzSmqdK/IVIXF4W4GjLc3VqTAdSMXlfVLuQ==", + "version": "1.15.33", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.15.33.tgz", + "integrity": "sha512-C64hBnBxq4viOPQ8hlx+2lJ23bzZBGnjw7ryALmS+0Q3zHmwO8lw1/DArLENw4Q18/0w5wdEO1k3m1wWNtKGqQ==", "cpu": [ "arm" ], @@ -1161,16 +1137,13 @@ } }, "node_modules/@swc/core-linux-arm64-gnu": { - "version": "1.15.32", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.15.32.tgz", - "integrity": "sha512-oDzEkdl6D6BAWdMtU5KGO7y3HR5fJcvByNLyEk9+ugj8nP5Ovb7P4kBcStBXc4MPExFGQryehiINMlmY8HlclA==", + "version": "1.15.33", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.15.33.tgz", + "integrity": "sha512-TRJfnJbX3jqpxRDRoieMzRiCBS5jOmXNb3iQXmcgjFEHKLnAgK1RZRU8Cq1MsPqO4jAJp/ld1G4O3fXuxv85uw==", "cpu": [ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0 AND MIT", "optional": true, "os": [ @@ -1181,16 +1154,13 @@ } }, "node_modules/@swc/core-linux-arm64-musl": { - "version": "1.15.32", - "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.15.32.tgz", - "integrity": "sha512-omcqjoZP/b8D8PuczVoRwJieC6ibj7qIxTftNYokz4/aSmKFHvsd7nIFfPk5ZvtzncbH4AY7+Dkr/Lp2gWxYeA==", + "version": "1.15.33", + "resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.15.33.tgz", + "integrity": "sha512-il7tYM+CpUNzieQbwAjFT1P8zqAhmGWNAGhQZBnxurXZ0aNn+5nqYFTEUKNZl7QibtT0uQXzTZrNGHCIj6Y1Og==", "cpu": [ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "Apache-2.0 AND MIT", "optional": true, "os": [ @@ -1201,16 +1171,13 @@ } }, "node_modules/@swc/core-linux-ppc64-gnu": { - "version": "1.15.32", - "resolved": "https://registry.npmjs.org/@swc/core-linux-ppc64-gnu/-/core-linux-ppc64-gnu-1.15.32.tgz", - "integrity": "sha512-KGkTMyz/Tbn3PBNu0AVZ4GTDFKnICrYcTiNPZq8DrvK42pnFsf3GNDrIG9E5AtQlTmC0YigkWKmu0eMcfTrmgA==", + "version": "1.15.33", + "resolved": "https://registry.npmjs.org/@swc/core-linux-ppc64-gnu/-/core-linux-ppc64-gnu-1.15.33.tgz", + "integrity": "sha512-ZtNBwN0Z7CFj9Il0FcPaKdjgP7URyKu/3RfH46vq+0paOBqLj4NYldD6Qo//Duif/7IOtAraUfDOmp0PLAufog==", "cpu": [ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0 AND MIT", "optional": true, "os": [ @@ -1221,16 +1188,13 @@ } }, "node_modules/@swc/core-linux-s390x-gnu": { - "version": "1.15.32", - "resolved": "https://registry.npmjs.org/@swc/core-linux-s390x-gnu/-/core-linux-s390x-gnu-1.15.32.tgz", - "integrity": "sha512-G3Aa4tVS/3OGZBkoNIwUF9F6RAy+Osb4GOlo62SinLmDiErz/ykmM7KH0wkz6l9kM8jJq1HyAM6atJTUEbBk7g==", + "version": "1.15.33", + "resolved": "https://registry.npmjs.org/@swc/core-linux-s390x-gnu/-/core-linux-s390x-gnu-1.15.33.tgz", + "integrity": "sha512-De1IyajoOmhOYYjw/lx66bKlyDpHZTueqwpDrWgf5O7T6d1ODeJJO9/OqMBmrBQc5C+dNnlmIufHsp4QVCWufA==", "cpu": [ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0 AND MIT", "optional": true, "os": [ @@ -1241,16 +1205,13 @@ } }, "node_modules/@swc/core-linux-x64-gnu": { - "version": "1.15.32", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.15.32.tgz", - "integrity": "sha512-ERsjfGcj6CBmj3vJnGDO8m8rTvw6RqMcWo1dogOtNx3/+/0+NNpJiXDobJrr1GwInI/BHAEkvSFIH6d2LqPcUQ==", + "version": "1.15.33", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.15.33.tgz", + "integrity": "sha512-mGTH0YxmUN+x6vRN/I6NOk5X0ogNktkwPnJ94IMvR7QjhRDwL0O8RXEDhyUM0YtwWrryBOqaJQBX4zruxEPRGw==", "cpu": [ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "Apache-2.0 AND MIT", "optional": true, "os": [ @@ -1261,16 +1222,13 @@ } }, "node_modules/@swc/core-linux-x64-musl": { - "version": "1.15.32", - "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.15.32.tgz", - "integrity": "sha512-N4Ggahe/8SUbTX50P6EdhbW9YWcgbZVb52R4cq6MK+zsoMjRq7rGvV5ztA05QnbaCYqMYx8rTY7KAIA3Crdo4Q==", + "version": "1.15.33", + "resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.15.33.tgz", + "integrity": "sha512-hj628ZkSEJf6zMf5VMbYrG2O6QqyTIp2qwY6VlCjvIa9lAEZ5c2lfPblCLVGYubTeLJDxadLB/CxqQYOQABeEQ==", "cpu": [ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "Apache-2.0 AND MIT", "optional": true, "os": [ @@ -1281,9 +1239,9 @@ } }, "node_modules/@swc/core-win32-arm64-msvc": { - "version": "1.15.32", - "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.15.32.tgz", - "integrity": "sha512-01yN0o9jvo8xBTP12aPK2wW8b41jmOlGbDDlAnoynotc4pO6xA0zby9f1z6j++qXDpGBttLySq1omgVrlQKYcw==", + "version": "1.15.33", + "resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.15.33.tgz", + "integrity": "sha512-GV2oohtN2/5+KSccl86VULu3aT+LrISC8uzgSq0FRnikpD+Zwc+sBlXmoKQ+Db6jI57ITUOIB8jRkdGMABC29g==", "cpu": [ "arm64" ], @@ -1298,9 +1256,9 @@ } }, "node_modules/@swc/core-win32-ia32-msvc": { - "version": "1.15.32", - "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.15.32.tgz", - "integrity": "sha512-fLagI9XZYNpTcmlqAcp3KBtmj7E19WCmYD80Jxj1Kn5tGNa7yxNLd3NNdWxuZGUPl5iC0/KqZru7g08gF6Fsrw==", + "version": "1.15.33", + "resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.15.33.tgz", + "integrity": "sha512-gtyvzSNR8DHKfFEA2uqb8Ld1myqi6uEg2jyeUq3ikn5ytYs7H8RpZYC8mdy4NXr8hfcdJfCLXPlYaqqfBXpoEQ==", "cpu": [ "ia32" ], @@ -1315,9 +1273,9 @@ } }, "node_modules/@swc/core-win32-x64-msvc": { - "version": "1.15.32", - "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.15.32.tgz", - "integrity": "sha512-gbc2bQ/T2CiR+w0OvcVKwLOFAcPZBvmWmolbwpg1E8UrpeC03DGtyMUApOHNXNYWA3SHFrYXCQtosrcMza1YFg==", + "version": "1.15.33", + "resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.15.33.tgz", + "integrity": "sha512-d6fRqQSkJI+kmMEBWaDQ7TMl8+YjLYbwRUPZQ9DY0ORBJeTzOrG0twvfvlZ2xgw6jA0ScQKgfBm4vHLSLl5Hqg==", "cpu": [ "x64" ], @@ -1359,9 +1317,9 @@ } }, "node_modules/@tybys/wasm-util": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.1.tgz", - "integrity": "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==", + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.2.tgz", + "integrity": "sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg==", "dev": true, "license": "MIT", "optional": true, @@ -1378,9 +1336,9 @@ "peer": true }, "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", "dev": true, "license": "MIT", "peer": true @@ -1428,13 +1386,13 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "25.6.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-25.6.0.tgz", - "integrity": "sha512-+qIYRKdNYJwY3vRCZMdJbPLJAtGjQBudzZzdzwQYkEPQd+PJGixUL5QfvCLDaULoLv+RhT3LDkwEfKaAkgSmNQ==", + "version": "25.7.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.7.0.tgz", + "integrity": "sha512-z+pdZyxE+RTQE9AcboAZCb4otwcrvgHD+GlBpPgn0emDVt0ohrTMhAwlr2Wd9nZ+nihhYFxO2pThz3C5qSu2Eg==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~7.19.0" + "undici-types": "~7.21.0" } }, "node_modules/@types/stack-utils": { @@ -1462,18 +1420,18 @@ "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.59.1.tgz", - "integrity": "sha512-BOziFIfE+6osHO9FoJG4zjoHUcvI7fTNBSpdAwrNH0/TLvzjsk2oo8XSSOT2HhqUyhZPfHv4UOffoJ9oEEQ7Ag==", + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.59.3.tgz", + "integrity": "sha512-PwFvSKsXGShKGW6n5bZOhGHEcCZXM8HofLK9fNsEwZXzFRjoY+XT1Vsf1zgyXdwTr0ZYz1/2tkZ0DBTT9jZjhw==", "dev": true, "license": "MIT", "peer": true, "dependencies": { "@eslint-community/regexpp": "^4.12.2", - "@typescript-eslint/scope-manager": "8.59.1", - "@typescript-eslint/type-utils": "8.59.1", - "@typescript-eslint/utils": "8.59.1", - "@typescript-eslint/visitor-keys": "8.59.1", + "@typescript-eslint/scope-manager": "8.59.3", + "@typescript-eslint/type-utils": "8.59.3", + "@typescript-eslint/utils": "8.59.3", + "@typescript-eslint/visitor-keys": "8.59.3", "ignore": "^7.0.5", "natural-compare": "^1.4.0", "ts-api-utils": "^2.5.0" @@ -1486,7 +1444,7 @@ "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^8.59.1", + "@typescript-eslint/parser": "^8.59.3", "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", "typescript": ">=4.8.4 <6.1.0" } @@ -1503,17 +1461,17 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.59.1.tgz", - "integrity": "sha512-HDQH9O/47Dxi1ceDhBXdaldtf/WV9yRYMjbjCuNk3qnaTD564qwv61Y7+gTxwxRKzSrgO5uhtw584igXVuuZkA==", + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.59.3.tgz", + "integrity": "sha512-HPwA+hVkfcriajbNvTmZv4VRauibay+cWArYUYq7u7W7PmGShMxbPxLvrwDme55a6d5alG3nrYfhyJ/G28XlLg==", "dev": true, "license": "MIT", "peer": true, "dependencies": { - "@typescript-eslint/scope-manager": "8.59.1", - "@typescript-eslint/types": "8.59.1", - "@typescript-eslint/typescript-estree": "8.59.1", - "@typescript-eslint/visitor-keys": "8.59.1", + "@typescript-eslint/scope-manager": "8.59.3", + "@typescript-eslint/types": "8.59.3", + "@typescript-eslint/typescript-estree": "8.59.3", + "@typescript-eslint/visitor-keys": "8.59.3", "debug": "^4.4.3" }, "engines": { @@ -1529,15 +1487,15 @@ } }, "node_modules/@typescript-eslint/project-service": { - "version": "8.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.59.1.tgz", - "integrity": "sha512-+MuHQlHiEr00Of/IQbE/MmEoi44znZHbR/Pz7Opq4HryUOlRi+/44dro9Ycy8Fyo+/024IWtw8m4JUMCGTYxDg==", + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.59.3.tgz", + "integrity": "sha512-ECiUWa/KYRGDFUqTNehaRgzDshnJfkTABJxVemHk4ko22gcr0ukloKjWvyQ64g8YCV/UI47kN1dbmjf/GaQYng==", "dev": true, "license": "MIT", "peer": true, "dependencies": { - "@typescript-eslint/tsconfig-utils": "^8.59.1", - "@typescript-eslint/types": "^8.59.1", + "@typescript-eslint/tsconfig-utils": "^8.59.3", + "@typescript-eslint/types": "^8.59.3", "debug": "^4.4.3" }, "engines": { @@ -1552,15 +1510,15 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.59.1.tgz", - "integrity": "sha512-LwuHQI4pDOYVKvmH2dkaJo6YZCSgouVgnS/z7yBPKBMvgtBvyLqiLy9Z6b7+m/TRcX1NFYUqZetI5Y+aT4GEfg==", + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.59.3.tgz", + "integrity": "sha512-t2LvZnoEfzKtnPjgeEu41xw5gxq9mQVfYy4OoZ4Vlt0sk3JwxmhCca/AR7DwOiHrjWgjAj6as4AhRLKSDfvZIA==", "dev": true, "license": "MIT", "peer": true, "dependencies": { - "@typescript-eslint/types": "8.59.1", - "@typescript-eslint/visitor-keys": "8.59.1" + "@typescript-eslint/types": "8.59.3", + "@typescript-eslint/visitor-keys": "8.59.3" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1571,9 +1529,9 @@ } }, "node_modules/@typescript-eslint/tsconfig-utils": { - "version": "8.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.59.1.tgz", - "integrity": "sha512-/0nEyPbX7gRsk0Uwfe4ALwwgxuA66d/l2mhRDNlAvaj4U3juhUtJNq0DsY8M2AYwwb9rEq2hrC3IcIcEt++iJA==", + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.59.3.tgz", + "integrity": "sha512-PcIJHjmaREXLgIAIzLnSY9VucEzz8FKXsRgFa1DmdGCK/5tJpW03TKJF01Q6VZd1lLdz2sIKPWaDUZN9dp//dw==", "dev": true, "license": "MIT", "peer": true, @@ -1589,16 +1547,16 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.59.1.tgz", - "integrity": "sha512-klWPBR2ciQHS3f++ug/mVnWKPjBUo7icEL3FAO1lhAR1Z1i5NQYZ1EannMSRYcq5qCv5wNALlXr6fksRHyYl7w==", + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.59.3.tgz", + "integrity": "sha512-g71d8QD8UaiHGvrJwyIS1hCX5r63w6Jll+4VEYhEAHXTDIqX1JgxhTAbEHtKntL9kuc4jRo7/GWw5xfCepSccQ==", "dev": true, "license": "MIT", "peer": true, "dependencies": { - "@typescript-eslint/types": "8.59.1", - "@typescript-eslint/typescript-estree": "8.59.1", - "@typescript-eslint/utils": "8.59.1", + "@typescript-eslint/types": "8.59.3", + "@typescript-eslint/typescript-estree": "8.59.3", + "@typescript-eslint/utils": "8.59.3", "debug": "^4.4.3", "ts-api-utils": "^2.5.0" }, @@ -1615,9 +1573,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.59.1.tgz", - "integrity": "sha512-ZDCjgccSdYPw5Bxh+my4Z0lJU96ZDN7jbBzvmEn0FZx3RtU1C7VWl6NbDx94bwY3V5YsgwRzJPOgeY2Q/nLG8A==", + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.59.3.tgz", + "integrity": "sha512-ePFoH0g4ludssdRFqqDxQePCxU4WQyRa9+XVwjm7yLn0FKhMeoetC+qBEEI1Eyb1pGSDveTIT09Bvw2WhlGayg==", "dev": true, "license": "MIT", "peer": true, @@ -1630,17 +1588,17 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.59.1.tgz", - "integrity": "sha512-OUd+vJS05sSkOip+BkZ/2NS8RMxrAAJemsC6vU3kmfLyeaJT0TftHkV9mcx2107MmsBVXXexhVu4F0TZXyMl4g==", + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.59.3.tgz", + "integrity": "sha512-CbRjVRAf7Lr9Kr8RopKcbY45p2VfmmHrm0ygOCYFi7oU8q19m0Fs/6iHS7kNOmwpp+ob07ZVcAqlxUod9lYdmg==", "dev": true, "license": "MIT", "peer": true, "dependencies": { - "@typescript-eslint/project-service": "8.59.1", - "@typescript-eslint/tsconfig-utils": "8.59.1", - "@typescript-eslint/types": "8.59.1", - "@typescript-eslint/visitor-keys": "8.59.1", + "@typescript-eslint/project-service": "8.59.3", + "@typescript-eslint/tsconfig-utils": "8.59.3", + "@typescript-eslint/types": "8.59.3", + "@typescript-eslint/visitor-keys": "8.59.3", "debug": "^4.4.3", "minimatch": "^10.2.2", "semver": "^7.7.3", @@ -1659,17 +1617,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.59.1.tgz", - "integrity": "sha512-3pIeoXhCeYH9FSCBI8P3iNwJlGuzPlYKkTlen2O9T1DSeeg8UG8jstq6BLk+Mda0qup7mgk4z4XL4OzRaxZ8LA==", + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.59.3.tgz", + "integrity": "sha512-JAvT14goBzRzzzZyqq3P9BLArIxTtQURUtFgQ/V7FO+eU+Gg6ES+5ymOPP1wRxXcxAYeivCk4uS3jCKWI1K8Zg==", "dev": true, "license": "MIT", "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", - "@typescript-eslint/scope-manager": "8.59.1", - "@typescript-eslint/types": "8.59.1", - "@typescript-eslint/typescript-estree": "8.59.1" + "@typescript-eslint/scope-manager": "8.59.3", + "@typescript-eslint/types": "8.59.3", + "@typescript-eslint/typescript-estree": "8.59.3" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1684,14 +1642,14 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.59.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.59.1.tgz", - "integrity": "sha512-LdDNl6C5iJExcM0Yh0PwAIBb9PrSiCsWamF/JyEZawm3kFDnRoaq3LGE4bpyRao/fWeGKKyw7icx0YxrLFC5Cg==", + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.59.3.tgz", + "integrity": "sha512-f1UQF7ggd42YiwI5wGrRaPsa+P0CINBlrkLPmGfpq/u/I/oVtecoEIfFR9ag/oa1sLOsRNZ6xehf6qMZhQGBDg==", "dev": true, "license": "MIT", "peer": true, "dependencies": { - "@typescript-eslint/types": "8.59.1", + "@typescript-eslint/types": "8.59.3", "eslint-visitor-keys": "^5.0.0" }, "engines": { @@ -1815,9 +1773,6 @@ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1833,9 +1788,6 @@ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1851,9 +1803,6 @@ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1869,9 +1818,6 @@ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1887,9 +1833,6 @@ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1905,9 +1848,6 @@ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1923,9 +1863,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1941,9 +1878,6 @@ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -2132,24 +2066,23 @@ "license": "Python-2.0" }, "node_modules/auto-changelog": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/auto-changelog/-/auto-changelog-2.5.0.tgz", - "integrity": "sha512-UTnLjT7I9U2U/xkCUH5buDlp8C7g0SGChfib+iDrJkamcj5kaMqNKHNfbKJw1kthJUq8sUo3i3q2S6FzO/l/wA==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/auto-changelog/-/auto-changelog-2.5.1.tgz", + "integrity": "sha512-vpG10KkmGaeMHwvCK2G+4j6e1+ZxVnhDadHnbG0sFuiB2fzAPIybicp5782btmf4+UGfHklVCUcHWZyN3YiXKg==", "dev": true, "license": "MIT", "dependencies": { "commander": "^7.2.0", - "handlebars": "^4.7.7", + "handlebars": "^4.7.9", "import-cwd": "^3.0.0", - "node-fetch": "^2.6.1", - "parse-github-url": "^1.0.3", - "semver": "^7.3.5" + "parse-github-url": "^1.0.4", + "semver": "^7.7.4" }, "bin": { "auto-changelog": "src/index.js" }, "engines": { - "node": ">=8.3" + "node": ">= 10" } }, "node_modules/balanced-match": { @@ -2176,9 +2109,9 @@ } }, "node_modules/brace-expansion": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.5.tgz", - "integrity": "sha512-VZznLgtwhn+Mact9tfiwx64fA9erHH/MCXEUfB/0bX/6Fz6ny5EGTXYltMocqg4xFAQZtnO3DHWWXi8RiuN7cQ==", + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz", + "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==", "dev": true, "license": "MIT", "dependencies": { @@ -2529,9 +2462,9 @@ } }, "node_modules/dpdm": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/dpdm/-/dpdm-4.0.1.tgz", - "integrity": "sha512-9NutC+V6A/4GHgqsqRTMQNDlhipK3lyPWBJ8zIVT8lTncy71d1BzR7sbCO0Dv2zTZ4XSxvbEfMyd0NDDLU0+fw==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/dpdm/-/dpdm-4.2.0.tgz", + "integrity": "sha512-Vq862fZ9UE66rlr2VcMhU8ZstTH3ItqmniLSCtAeg6T2AYeB2oD3Z6lGjiFDjyUvxLbfLyBBNWagCLMehpmo5g==", "dev": true, "license": "MIT", "dependencies": { @@ -2698,9 +2631,9 @@ } }, "node_modules/eslint": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.2.1.tgz", - "integrity": "sha512-wiyGaKsDgqXvF40P8mDwiUp/KQjE1FdrIEJsM8PZ3XCiniTMXS3OHWWUe5FI5agoCnr8x4xPrTDZuxsBlNHl+Q==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.3.0.tgz", + "integrity": "sha512-XbEXaRva5cF0ZQB8w6MluHA0kZZfV2DuCMJ3ozyEOHLwDpZX2Lmm/7Pp0xdJmI0GL1W05VH5VwIFHEm1Vcw2gw==", "dev": true, "license": "MIT", "peer": true, @@ -3000,18 +2933,18 @@ } }, "node_modules/expect": { - "version": "30.3.0", - "resolved": "https://registry.npmjs.org/expect/-/expect-30.3.0.tgz", - "integrity": "sha512-1zQrciTiQfRdo7qJM1uG4navm8DayFa2TgCSRlzUyNkhcJ6XUZF3hjnpkyr3VhAqPH7i/9GkG7Tv5abz6fqz0Q==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/expect/-/expect-30.4.1.tgz", + "integrity": "sha512-PMARsyh/JtqC20HoGqlFcIlQAyqUtW4PlI1rup1uhYJtKuwAjbvWi3GQMAn+STdHum/dk8xrKfUM1+5SAwpolA==", "dev": true, "license": "MIT", "dependencies": { - "@jest/expect-utils": "30.3.0", + "@jest/expect-utils": "30.4.1", "@jest/get-type": "30.1.0", - "jest-matcher-utils": "30.3.0", - "jest-message-util": "30.3.0", - "jest-mock": "30.3.0", - "jest-util": "30.3.0" + "jest-matcher-utils": "30.4.1", + "jest-message-util": "30.4.1", + "jest-mock": "30.4.1", + "jest-util": "30.4.1" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" @@ -3203,9 +3136,9 @@ } }, "node_modules/fs-extra": { - "version": "11.3.4", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.4.tgz", - "integrity": "sha512-CTXd6rk/M3/ULNQj8FBqBWHYBVYybQ3VPBw0xGKFe3tuH7ytT6ACnvzpIQ3UZtB8yvUKC2cXn1a+x+5EVQLovA==", + "version": "11.3.5", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.5.tgz", + "integrity": "sha512-eKpRKAovdpZtR1WopLHxlBWvAgPny3c4gX1G5Jhwmmw4XJj0ifSD5qB5TOo8hmA0wlRKDAOAhEE1yVPgs6Fgcg==", "dev": true, "license": "MIT", "dependencies": { @@ -3243,9 +3176,9 @@ } }, "node_modules/get-east-asian-width": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.5.0.tgz", - "integrity": "sha512-CQ+bEO+Tva/qlmw24dCejulK5pMzVnUOFOijVogd3KQs07HnRIgp8TGipvCCRT06xeYEbpbgwaCxglFyiuIcmA==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.6.0.tgz", + "integrity": "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==", "dev": true, "license": "MIT", "engines": { @@ -3302,9 +3235,9 @@ } }, "node_modules/globals": { - "version": "17.5.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-17.5.0.tgz", - "integrity": "sha512-qoV+HK2yFl/366t2/Cb3+xxPUo5BuMynomoDmiaZBIdbs+0pYbjfZU+twLhGKp4uCZ/+NbtpVepH5bGCxRyy2g==", + "version": "17.6.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.6.0.tgz", + "integrity": "sha512-sepffkT8stwnIYbsMBpoCHJuJM5l98FUF2AnE07hfvE0m/qp3R586hw4jF4uadbhvg1ooIdzuu7CsfD2jzCaNA==", "dev": true, "license": "MIT", "engines": { @@ -3599,16 +3532,16 @@ } }, "node_modules/jest-diff": { - "version": "30.3.0", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-30.3.0.tgz", - "integrity": "sha512-n3q4PDQjS4LrKxfWB3Z5KNk1XjXtZTBwQp71OP0Jo03Z6V60x++K5L8k6ZrW8MY8pOFylZvHM0zsjS1RqlHJZQ==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-30.4.1.tgz", + "integrity": "sha512-CRpFK0RtLriVDGcPPAnR6HMVI8bSR2jnUIgralhauzYQZIb4RH9AtEInTuQr65LmmGggGcRT6HIASxwqsVsmlA==", "dev": true, "license": "MIT", "dependencies": { - "@jest/diff-sequences": "30.3.0", + "@jest/diff-sequences": "30.4.0", "@jest/get-type": "30.1.0", "chalk": "^4.1.2", - "pretty-format": "30.3.0" + "pretty-format": "30.4.1" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" @@ -3648,16 +3581,16 @@ } }, "node_modules/jest-matcher-utils": { - "version": "30.3.0", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-30.3.0.tgz", - "integrity": "sha512-HEtc9uFQgaUHkC7nLSlQL3Tph4Pjxt/yiPvkIrrDCt9jhoLIgxaubo1G+CFOnmHYMxHwwdaSN7mkIFs6ZK8OhA==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-30.4.1.tgz", + "integrity": "sha512-zvYfX5CaeEkFrrLS9suWe9rvJrm9J1Iv3ua8kIBv9GEPzcnsfBf0bob37la7s67fs0nlBC3EuvkOLnXQKxtx4A==", "dev": true, "license": "MIT", "dependencies": { "@jest/get-type": "30.1.0", "chalk": "^4.1.2", - "jest-diff": "30.3.0", - "pretty-format": "30.3.0" + "jest-diff": "30.4.1", + "pretty-format": "30.4.1" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" @@ -3697,19 +3630,20 @@ } }, "node_modules/jest-message-util": { - "version": "30.3.0", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-30.3.0.tgz", - "integrity": "sha512-Z/j4Bo+4ySJ+JPJN3b2Qbl9hDq3VrXmnjjGEWD/x0BCXeOXPTV1iZYYzl2X8c1MaCOL+ewMyNBcm88sboE6YWw==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-30.4.1.tgz", + "integrity": "sha512-kwCKIvq0MCW1HzLoGola9Te6JUdzgV0loyKJ3Qghrkz9i5/RRIHsL95BMQc2HBBhlBKC4j22K9p11TGHH8RBpQ==", "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.27.1", - "@jest/types": "30.3.0", + "@jest/types": "30.4.1", "@types/stack-utils": "^2.0.3", "chalk": "^4.1.2", "graceful-fs": "^4.2.11", + "jest-util": "30.4.1", "picomatch": "^4.0.3", - "pretty-format": "30.3.0", + "pretty-format": "30.4.1", "slash": "^3.0.0", "stack-utils": "^2.0.6" }, @@ -3751,24 +3685,24 @@ } }, "node_modules/jest-mock": { - "version": "30.3.0", - "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-30.3.0.tgz", - "integrity": "sha512-OTzICK8CpE+t4ndhKrwlIdbM6Pn8j00lvmSmq5ejiO+KxukbLjgOflKWMn3KE34EZdQm5RqTuKj+5RIEniYhog==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-30.4.1.tgz", + "integrity": "sha512-/i8SVb8/NSB7RfNi8gfqu8gxLV23KaL5EpAttyb9iz8qWRIqXRLflycz/32wXsYkOnaUlx8NAKnJYtpsmXUmfw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/types": "30.3.0", + "@jest/types": "30.4.1", "@types/node": "*", - "jest-util": "30.3.0" + "jest-util": "30.4.1" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" } }, "node_modules/jest-regex-util": { - "version": "30.0.1", - "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-30.0.1.tgz", - "integrity": "sha512-jHEQgBXAgc+Gh4g0p3bCevgRCVRkB4VB70zhoAE48gxeSr1hfUOsM/C2WoJgVL7Eyg//hudYENbm3Ne+/dRVVA==", + "version": "30.4.0", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-30.4.0.tgz", + "integrity": "sha512-mWlvLviKIgIQ8VCuM1xRdD0TWp3zlzionlmDBjuXVBs+VkmXq6FgW9T4Emr7oGz/Rk6feDCGyiugolcQEyp3mg==", "dev": true, "license": "MIT", "engines": { @@ -3776,13 +3710,13 @@ } }, "node_modules/jest-util": { - "version": "30.3.0", - "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-30.3.0.tgz", - "integrity": "sha512-/jZDa00a3Sz7rdyu55NLrQCIrbyIkbBxareejQI315f/i8HjYN+ZWsDLLpoQSiUIEIyZF/R8fDg3BmB8AtHttg==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-30.4.1.tgz", + "integrity": "sha512-vjQb1sACEiv13DKJMDToJpzVW0joCsIQrmbg0fi7CyOOt+g9jTuQl2A216pWRBYhOVt53XbL/2LbMKg1BECWOw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/types": "30.3.0", + "@jest/types": "30.4.1", "@types/node": "*", "chalk": "^4.1.2", "ci-info": "^4.2.0", @@ -3976,9 +3910,9 @@ } }, "node_modules/lru-cache": { - "version": "11.3.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.3.5.tgz", - "integrity": "sha512-NxVFwLAnrd9i7KUBxC4DrUhmgjzOs+1Qm50D3oF1/oL+r1NpZ4gA7xvG0/zJ8evR7zIKn4vLf7qTNduWFtCrRw==", + "version": "11.3.6", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.3.6.tgz", + "integrity": "sha512-Gf/KoL3C/MlI7Bt0PGI9I+TeTC/I6r/csU58N4BSNc4lppLBeKsOdFYkK+dX0ABDUMJNfCHTyPpzwwO21Awd3A==", "dev": true, "license": "BlueOak-1.0.0", "engines": { @@ -4258,27 +4192,6 @@ "dev": true, "license": "MIT" }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dev": true, - "license": "MIT", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -4290,9 +4203,9 @@ } }, "node_modules/npm-check-updates": { - "version": "22.0.1", - "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-22.0.1.tgz", - "integrity": "sha512-K8PDu7l9v7UKIwDSxLnqA9LHT76Mu4eCjGjp0JwSeSsyKWmX/YZY+AoBxw4oVdKwQLthWbzg1g+OKysHYGQCjQ==", + "version": "22.2.0", + "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-22.2.0.tgz", + "integrity": "sha512-kaxgbkGkCOtoSrsUXShgcEiEfrRPqmOGk6Yeya+5hoNptblu9vuE8/PLABUSJz+IeNgKJBFxcC3UrBYmKsB8iA==", "dev": true, "license": "Apache-2.0", "bin": { @@ -4585,15 +4498,16 @@ } }, "node_modules/pretty-format": { - "version": "30.3.0", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.3.0.tgz", - "integrity": "sha512-oG4T3wCbfeuvljnyAzhBvpN45E8iOTXCU/TD3zXW80HA3dQ4ahdqMkWGiPWZvjpQwlbyHrPTWUAqUzGzv4l1JQ==", + "version": "30.4.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-30.4.1.tgz", + "integrity": "sha512-K6KiKMHTL4jjX4u3Kir2EW07nRfcqVTXIImx50wbjHQTcZPgg+gjVeNTIT3l3L1Rd4UefxfogquC9J37SoFyyw==", "dev": true, "license": "MIT", "dependencies": { - "@jest/schemas": "30.0.5", + "@jest/schemas": "30.4.1", "ansi-styles": "^5.2.0", - "react-is": "^18.3.1" + "react-is-18": "npm:react-is@^18.3.1", + "react-is-19": "npm:react-is@^19.2.5" }, "engines": { "node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0" @@ -4641,13 +4555,22 @@ "safe-buffer": "^5.1.0" } }, - "node_modules/react-is": { + "node_modules/react-is-18": { + "name": "react-is", "version": "18.3.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz", "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", "dev": true, "license": "MIT" }, + "node_modules/react-is-19": { + "name": "react-is", + "version": "19.2.6", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.6.tgz", + "integrity": "sha512-XjBR15BhXuylgWGuslhDKqlSayuqvqBX91BP8pauG8kd1zY8kotkNWbXksTCNRarse4kuGbe2kIY05ARtwNIvw==", + "dev": true, + "license": "MIT" + }, "node_modules/readdirp": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", @@ -4815,9 +4738,9 @@ } }, "node_modules/semver": { - "version": "7.7.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", - "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.0.tgz", + "integrity": "sha512-AcM7dV/5ul4EekoQ29Agm5vri8JNqRyj39o0qpX6vDF2GZrtutZl5RwgD1XnZjiTAfncsJhMI48QQH3sN87YNA==", "dev": true, "license": "ISC", "bin": { @@ -5136,13 +5059,6 @@ "node": ">=8.0" } }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true, - "license": "MIT" - }, "node_modules/ts-api-utils": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", @@ -5291,17 +5207,17 @@ } }, "node_modules/typescript-eslint": { - "version": "8.59.1", - "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.59.1.tgz", - "integrity": "sha512-xqDcFVBmlrltH64lklOVp1wYxgJr6LVdg3NamBgH2OOQDLFdTKfIZXF5PfghrnXQKXZGTQs8tr1vL7fJvq8CTQ==", + "version": "8.59.3", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.59.3.tgz", + "integrity": "sha512-KgusgyDgG4LI8Ih/sWaCtZ06tckLAS5CvT5A4D1Q7bYVoAAyzwiZvE4BmwDHkhRVkvhRBepKeASoFzQetha7Fg==", "dev": true, "license": "MIT", "peer": true, "dependencies": { - "@typescript-eslint/eslint-plugin": "8.59.1", - "@typescript-eslint/parser": "8.59.1", - "@typescript-eslint/typescript-estree": "8.59.1", - "@typescript-eslint/utils": "8.59.1" + "@typescript-eslint/eslint-plugin": "8.59.3", + "@typescript-eslint/parser": "8.59.3", + "@typescript-eslint/typescript-estree": "8.59.3", + "@typescript-eslint/utils": "8.59.3" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -5330,9 +5246,9 @@ } }, "node_modules/undici-types": { - "version": "7.19.2", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.19.2.tgz", - "integrity": "sha512-qYVnV5OEm2AW8cJMCpdV20CDyaN3g0AjDlOGf1OW4iaDEx8MwdtChUp4zu4H0VP3nDRF/8RKWH+IPp9uW0YGZg==", + "version": "7.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.21.0.tgz", + "integrity": "sha512-w9IMgQrz4O0YN1LtB7K5P63vhlIOvC7opSmouCJ+ZywlPAlO9gIkJ+otk6LvGpAs2wg4econaCz3TvQ9xPoyuQ==", "dev": true, "license": "MIT" }, @@ -5408,24 +5324,6 @@ "node": ">=10.12.0" } }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true, - "license": "BSD-2-Clause" - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dev": true, - "license": "MIT", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", diff --git a/package.json b/package.json index d2c9c5c..e2576ab 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "valgen", "description": "Fast runtime type validator, converter and io (encoding/decoding) library", - "version": "6.1.0", + "version": "6.2.0", "author": "Panates", "license": "MIT", "private": true, @@ -18,18 +18,18 @@ "@panates/eslint-config-ts": "^2.1.6", "@panates/tsconfig": "^2.1.6", "@swc-node/register": "^1.11.1", - "@swc/core": "^1.15.32", + "@swc/core": "^1.15.33", "@swc/helpers": "^0.5.21", "@types/mocha": "^10.0.10", - "@types/node": "^25.6.0", - "auto-changelog": "^2.5.0", + "@types/node": "^25.7.0", + "auto-changelog": "^2.5.1", "c8": "^11.0.0", - "expect": "^30.3.0", - "globals": "^17.5.0", + "expect": "^30.4.1", + "globals": "^17.6.0", "husky": "^9.1.7", - "dpdm": "^4.0.1", + "dpdm": "^4.2.0", "mocha": "^11.7.5", - "npm-check-updates": "^22.0.1", + "npm-check-updates": "^22.2.0", "prettier": "^3.8.3", "rimraf": "^6.1.3", "ts-cleanup": "^1.3.0", diff --git a/src/index.ts b/src/index.ts index c43d3ee..2a2ed5a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,6 +8,7 @@ import * as vg from './rules/index.js'; export * from './constants.js'; export * from './core/index.js'; +export * from './core/types.js'; const isInstanceOfCache = new WeakMap(); const isAlpha = vg.isAlpha(); diff --git a/src/rules/format-rules/is-alpha.ts b/src/rules/format-rules/is-alpha.ts index a6b3c03..e0ac224 100644 --- a/src/rules/format-rules/is-alpha.ts +++ b/src/rules/format-rules/is-alpha.ts @@ -12,7 +12,7 @@ import { */ export function isAlpha(options?: isAlpha.Options) { return validator( - 'isAlpha', + isAlpha.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isAlpha(input)) return input; context.fail(_this, `"Value must be an alpha string`, input); diff --git a/src/rules/format-rules/is-alphanumeric.ts b/src/rules/format-rules/is-alphanumeric.ts index 45c95e4..47d45ba 100644 --- a/src/rules/format-rules/is-alphanumeric.ts +++ b/src/rules/format-rules/is-alphanumeric.ts @@ -12,7 +12,7 @@ import { */ export function isAlphanumeric(options?: isAlphanumeric.Options) { return validator( - 'isAlphanumeric', + isAlphanumeric.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isAlphanumeric(input)) { return input; diff --git a/src/rules/format-rules/is-ascii.ts b/src/rules/format-rules/is-ascii.ts index 290503b..2ab2388 100644 --- a/src/rules/format-rules/is-ascii.ts +++ b/src/rules/format-rules/is-ascii.ts @@ -12,7 +12,7 @@ import { */ export function isAscii(options?: isAscii.Options) { return validator( - 'isAscii', + isAscii.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isAscii(input)) return input; context.fail(_this, `Value must be an ascii string`, input); diff --git a/src/rules/format-rules/is-base64.ts b/src/rules/format-rules/is-base64.ts index fcb3185..c645bec 100644 --- a/src/rules/format-rules/is-base64.ts +++ b/src/rules/format-rules/is-base64.ts @@ -14,7 +14,7 @@ import { */ export function isBase64(options?: isBase64.Options) { return validator( - 'isBase64', + isBase64.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isBase64(input, options)) { return input; diff --git a/src/rules/format-rules/is-btc-address.ts b/src/rules/format-rules/is-btc-address.ts index 7407470..13d31a4 100644 --- a/src/rules/format-rules/is-btc-address.ts +++ b/src/rules/format-rules/is-btc-address.ts @@ -12,7 +12,7 @@ import { */ export function isBtcAddress(options?: isBtcAddress.Options) { return validator( - 'isBtcAddress', + isBtcAddress.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isBtcAddress(input)) { return input; diff --git a/src/rules/format-rules/is-credit-card.ts b/src/rules/format-rules/is-credit-card.ts index 77f29be..c5aa1b5 100644 --- a/src/rules/format-rules/is-credit-card.ts +++ b/src/rules/format-rules/is-credit-card.ts @@ -14,7 +14,7 @@ import { */ export function isCreditCard(options?: isCreditCard.Options) { return validator( - 'isCreditCard', + isCreditCard.name, (input: unknown, context: Context, _this): Nullish => { if ( typeof input === 'string' && diff --git a/src/rules/format-rules/is-decimal.ts b/src/rules/format-rules/is-decimal.ts index 9998a8c..7020c64 100644 --- a/src/rules/format-rules/is-decimal.ts +++ b/src/rules/format-rules/is-decimal.ts @@ -13,7 +13,7 @@ import { */ export function isDecimal(options?: isDecimal.Options) { return validator( - 'isDecimal', + isDecimal.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isDecimal(input)) { return input; diff --git a/src/rules/format-rules/is-ean.ts b/src/rules/format-rules/is-ean.ts index 2a7d228..d1d362f 100644 --- a/src/rules/format-rules/is-ean.ts +++ b/src/rules/format-rules/is-ean.ts @@ -12,7 +12,7 @@ import { */ export function isEAN(options?: isEAN.Options) { return validator( - 'isEAN', + isEAN.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isEAN(input)) return input; context.fail( diff --git a/src/rules/format-rules/is-email.ts b/src/rules/format-rules/is-email.ts index 5ff296e..752cb6b 100644 --- a/src/rules/format-rules/is-email.ts +++ b/src/rules/format-rules/is-email.ts @@ -20,7 +20,7 @@ export function isEmail(options?: isEmail.Options) { allow_ip_domain: options?.allowIpDomain, }; return validator( - 'isEmail', + isEmail.name, (input: unknown, context: Context, _this): Nullish => { if ( typeof input === 'string' && diff --git a/src/rules/format-rules/is-eth-address.ts b/src/rules/format-rules/is-eth-address.ts index 61f7dd3..c4fadf2 100644 --- a/src/rules/format-rules/is-eth-address.ts +++ b/src/rules/format-rules/is-eth-address.ts @@ -12,7 +12,7 @@ import { */ export function isETHAddress(options?: isETHAddress.Options) { return validator( - 'isETHAddress', + isETHAddress.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isEthereumAddress(input)) { return input; diff --git a/src/rules/format-rules/is-fqdn.ts b/src/rules/format-rules/is-fqdn.ts index 5b1c6ec..4153e8f 100644 --- a/src/rules/format-rules/is-fqdn.ts +++ b/src/rules/format-rules/is-fqdn.ts @@ -17,7 +17,7 @@ export function isFQDN(options?: isFQDN.Options) { allow_wildcard: options?.allowWildcard, }; return validator( - 'isFQDN', + isFQDN.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isFQDN(input, opts)) { return input; diff --git a/src/rules/format-rules/is-hash.ts b/src/rules/format-rules/is-hash.ts index 6ab4fbe..957ef89 100644 --- a/src/rules/format-rules/is-hash.ts +++ b/src/rules/format-rules/is-hash.ts @@ -17,7 +17,7 @@ export function isHash( options?: ValidationOptions, ) { return validator( - 'isHash', + isHash.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isHash(input, algorithm)) { return input; diff --git a/src/rules/format-rules/is-hex-color.ts b/src/rules/format-rules/is-hex-color.ts index dcb8bbe..1b8af0a 100644 --- a/src/rules/format-rules/is-hex-color.ts +++ b/src/rules/format-rules/is-hex-color.ts @@ -12,7 +12,7 @@ import { */ export function isHexColor(options?: isHexColor.Options) { return validator( - 'isHexColor', + isHexColor.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isHexColor(input)) { return input; diff --git a/src/rules/format-rules/is-hex.ts b/src/rules/format-rules/is-hex.ts index 0b9ccad..1c1714b 100644 --- a/src/rules/format-rules/is-hex.ts +++ b/src/rules/format-rules/is-hex.ts @@ -12,7 +12,7 @@ import { */ export function isHex(options?: isHex.Options) { return validator( - 'isHex', + isHex.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isHexadecimal(input)) { return input; diff --git a/src/rules/format-rules/is-iban.ts b/src/rules/format-rules/is-iban.ts index 45cc020..476350b 100644 --- a/src/rules/format-rules/is-iban.ts +++ b/src/rules/format-rules/is-iban.ts @@ -12,7 +12,7 @@ import { */ export function isIBAN(options?: isIBAN.Options) { return validator( - 'isIBAN', + isIBAN.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isIBAN(input)) return input; context.fail( diff --git a/src/rules/format-rules/is-ip.ts b/src/rules/format-rules/is-ip.ts index f362e32..ebefa70 100644 --- a/src/rules/format-rules/is-ip.ts +++ b/src/rules/format-rules/is-ip.ts @@ -12,7 +12,7 @@ import { */ export function isIP(version?: isIP.IPVersion, options?: ValidationOptions) { return validator( - 'isIP', + isIP.name, (input: unknown, context: Context, _this): Nullish => { if ( input != null && @@ -40,7 +40,7 @@ export function isIPRange( options?: ValidationOptions, ) { return validator( - 'isIPRange', + isIPRange.name, (input: unknown, context: Context, _this): Nullish => { if ( input != null && diff --git a/src/rules/format-rules/is-issn.ts b/src/rules/format-rules/is-issn.ts index e6bbac2..84091b1 100644 --- a/src/rules/format-rules/is-issn.ts +++ b/src/rules/format-rules/is-issn.ts @@ -17,7 +17,7 @@ export function isISSN(options?: isISSN.Options) { case_sensitive: options?.caseSensitive, }; return validator( - 'isISSN', + isISSN.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isISSN(input, opts)) { return input; diff --git a/src/rules/format-rules/is-jwt.ts b/src/rules/format-rules/is-jwt.ts index 81251e3..c9ec0ad 100644 --- a/src/rules/format-rules/is-jwt.ts +++ b/src/rules/format-rules/is-jwt.ts @@ -12,7 +12,7 @@ import { */ export function isJWT(options?: isJWT.Options) { return validator( - 'isJWT', + isJWT.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isJWT(input)) return input; context.fail(_this, `Value must be valid JWT token`, input); diff --git a/src/rules/format-rules/is-lowercase.ts b/src/rules/format-rules/is-lowercase.ts index 6669f5f..a23c391 100644 --- a/src/rules/format-rules/is-lowercase.ts +++ b/src/rules/format-rules/is-lowercase.ts @@ -12,7 +12,7 @@ import { */ export function isLowercase(options?: isLowercase.Options) { return validator( - 'isLowercase', + isLowercase.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isLowercase(input)) { return input; diff --git a/src/rules/format-rules/is-mac-address.ts b/src/rules/format-rules/is-mac-address.ts index 6345e3c..3ac2de1 100644 --- a/src/rules/format-rules/is-mac-address.ts +++ b/src/rules/format-rules/is-mac-address.ts @@ -18,7 +18,7 @@ export function isMACAddress(options?: isMACAddress.Options) { eui: options?.eui, }; return validator( - 'isMACAddress', + isMACAddress.name, (input: unknown, context: Context, _this): Nullish => { if ( input != null && diff --git a/src/rules/format-rules/is-mobile-phone.ts b/src/rules/format-rules/is-mobile-phone.ts index b1f11b3..1e0fa66 100644 --- a/src/rules/format-rules/is-mobile-phone.ts +++ b/src/rules/format-rules/is-mobile-phone.ts @@ -18,7 +18,7 @@ export function isMobilePhone(options?: isMobilePhone.Options) { strictMode: options?.strictMode, }; return validator( - 'isMobilePhone', + isMobilePhone.name, (input: unknown, context: Context, _this): Nullish => { if ( typeof input === 'string' && diff --git a/src/rules/format-rules/is-object-id.ts b/src/rules/format-rules/is-object-id.ts index 08f7833..d3e1abf 100644 --- a/src/rules/format-rules/is-object-id.ts +++ b/src/rules/format-rules/is-object-id.ts @@ -12,7 +12,7 @@ import { */ export function isObjectId(options?: ValidationOptions) { return validator( - 'isObjectId', + isObjectId.name, ( input: any, context: Context, diff --git a/src/rules/format-rules/is-passport-number.ts b/src/rules/format-rules/is-passport-number.ts index 7d59e4c..3eb61c7 100644 --- a/src/rules/format-rules/is-passport-number.ts +++ b/src/rules/format-rules/is-passport-number.ts @@ -15,7 +15,7 @@ export function isPassportNumber( options?: isPassportNumber.Options, ) { return validator( - 'isPassportNumber', + isPassportNumber.name, (input: unknown, context: Context, _this): Nullish => { if ( typeof input === 'string' && diff --git a/src/rules/format-rules/is-port.ts b/src/rules/format-rules/is-port.ts index fb2d06b..dfcdf2b 100644 --- a/src/rules/format-rules/is-port.ts +++ b/src/rules/format-rules/is-port.ts @@ -12,7 +12,7 @@ import { */ export function isPort(options?: isPort.Options) { return validator( - 'isPort', + isPort.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'number') input = String(input); if ( diff --git a/src/rules/format-rules/is-swift.ts b/src/rules/format-rules/is-swift.ts index 4be7731..76491e5 100644 --- a/src/rules/format-rules/is-swift.ts +++ b/src/rules/format-rules/is-swift.ts @@ -12,7 +12,7 @@ import { */ export function isSWIFT(options?: isSWIFT.Options) { return validator( - 'isSWIFT', + isSWIFT.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isBIC(input)) return input; context.fail( diff --git a/src/rules/format-rules/is-time.ts b/src/rules/format-rules/is-time.ts index 9c68152..fdb144e 100644 --- a/src/rules/format-rules/is-time.ts +++ b/src/rules/format-rules/is-time.ts @@ -13,7 +13,7 @@ const TIME_PATTERN = /^(\d{2}):?(\d{2})(?::?(\d{2})?(?:\.(\d{1,3}))?)?$/; */ export function isTime(options?: isTime.Options) { return validator( - 'isTime', + isTime.name, (input: unknown, context: Context, _this): Nullish => { if (input != null) { const coerce = options?.coerce ?? context.coerce; diff --git a/src/rules/format-rules/is-uppercase.ts b/src/rules/format-rules/is-uppercase.ts index 20a7258..4b27af8 100644 --- a/src/rules/format-rules/is-uppercase.ts +++ b/src/rules/format-rules/is-uppercase.ts @@ -12,7 +12,7 @@ import { */ export function isUppercase(options?: isUppercase.Options) { return validator( - 'isUppercase', + isUppercase.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isUppercase(input)) { return input; diff --git a/src/rules/format-rules/is-url.ts b/src/rules/format-rules/is-url.ts index e9a9d1c..8d245c6 100644 --- a/src/rules/format-rules/is-url.ts +++ b/src/rules/format-rules/is-url.ts @@ -14,7 +14,7 @@ import { */ export function isURL(options?: isURL.Options) { return validator( - 'isURL', + isURL.name, (input: unknown, context: Context, _this): Nullish => { if ( input != null && diff --git a/src/rules/format-rules/is-uuid.ts b/src/rules/format-rules/is-uuid.ts index e9cdd22..4f9c1e8 100644 --- a/src/rules/format-rules/is-uuid.ts +++ b/src/rules/format-rules/is-uuid.ts @@ -14,7 +14,7 @@ import { */ export function isUUID(version?: isUUID.UUIDVersion, options?: isUUID.Options) { return validator( - 'isUUID', + isUUID.name, (input: unknown, context: Context, _this): Nullish => { if ( input != null && diff --git a/src/rules/format-rules/is-vat-number.ts b/src/rules/format-rules/is-vat-number.ts index 6bd490c..1abcc43 100644 --- a/src/rules/format-rules/is-vat-number.ts +++ b/src/rules/format-rules/is-vat-number.ts @@ -17,7 +17,7 @@ export function isVATNumber( options?: isVATNumber.Options, ) { return validator( - 'isVATNumber', + isVATNumber.name, (input: unknown, context: Context, _this): Nullish => { if (typeof input === 'string' && validatorJS.isVAT(input, countryCode)) { return input; diff --git a/src/rules/format-rules/matches.ts b/src/rules/format-rules/matches.ts index 9966adc..ff3829a 100644 --- a/src/rules/format-rules/matches.ts +++ b/src/rules/format-rules/matches.ts @@ -13,7 +13,7 @@ export function matches(format: string | RegExp, options?: matches.Options) { const regExp = format instanceof RegExp ? format : new RegExp(format); const formatName = options?.formatName; return validator( - 'matches', + matches.name, (input: unknown, context: Context, _this): Nullish => { if (input == null) return; if (typeof input === 'string' && regExp.test(input)) return input; diff --git a/src/rules/index.ts b/src/rules/index.ts index b4c940a..8aa8436 100644 --- a/src/rules/index.ts +++ b/src/rules/index.ts @@ -55,7 +55,9 @@ export * from './type-rules/is-tuple.js'; export * from './type-rules/is-undefined.js'; export * from './utility-rules/all-of.js'; export * from './utility-rules/exists.js'; +export * from './utility-rules/fixed.js'; export * from './utility-rules/get-length.js'; +export * from './utility-rules/nullable.js'; export * from './utility-rules/one-of.js'; export * from './utility-rules/optional.js'; export * from './utility-rules/pipe.js'; diff --git a/src/rules/logical-rules/is-defined.ts b/src/rules/logical-rules/is-defined.ts index 7e4e839..c9a270d 100644 --- a/src/rules/logical-rules/is-defined.ts +++ b/src/rules/logical-rules/is-defined.ts @@ -10,7 +10,7 @@ import { */ export function isDefined(options?: isDefined.Options) { return validator( - 'is-defined', + isDefined.name, (input: unknown, context: Context, _this) => { if (input !== undefined) return input; context.fail(_this, `Value must be defined`, input); diff --git a/src/rules/logical-rules/is-empty.ts b/src/rules/logical-rules/is-empty.ts index bbcab92..e5c2a4b 100644 --- a/src/rules/logical-rules/is-empty.ts +++ b/src/rules/logical-rules/is-empty.ts @@ -10,7 +10,7 @@ import { */ export function isEmpty(options?: isEmpty.Options) { return validator( - 'isEmpty', + isEmpty.name, (input: unknown, context: Context, _this) => { if (input == null) return input; if (typeof input === 'string') { diff --git a/src/rules/logical-rules/is-equal.ts b/src/rules/logical-rules/is-equal.ts index bc69abb..e5bcf2b 100644 --- a/src/rules/logical-rules/is-equal.ts +++ b/src/rules/logical-rules/is-equal.ts @@ -10,7 +10,7 @@ import { */ export function isEqual(compare: T, options?: isEqual.Options) { return validator( - 'isEqual', + isEqual.name, (input: unknown, context: Context, _this) => { if (input == null) return input; if (input !== compare) @@ -31,7 +31,7 @@ export namespace isEqual { */ export function isNotEqual(compare: any, options?: isNotEqual.Options) { return validator( - 'isNotEqual', + isNotEqual.name, (input: unknown, context: Context, _this) => { if (input == null) return input; if (input === compare) { diff --git a/src/rules/logical-rules/is-gt.ts b/src/rules/logical-rules/is-gt.ts index ccae890..0051d10 100644 --- a/src/rules/logical-rules/is-gt.ts +++ b/src/rules/logical-rules/is-gt.ts @@ -15,8 +15,8 @@ export function isGt( minValue: T, options?: isGt.Options, ): Validator { - return validator( - 'isGt', + return validator( + isGt.name, (input: T, context: Context, _this): Nullish => { if ( (typeof minValue === 'number' || typeof minValue === 'bigint') && diff --git a/src/rules/logical-rules/is-gte.ts b/src/rules/logical-rules/is-gte.ts index 9943c37..49f969f 100644 --- a/src/rules/logical-rules/is-gte.ts +++ b/src/rules/logical-rules/is-gte.ts @@ -14,9 +14,9 @@ import type { range } from './range.js'; export function isGte( minValue: T, options?: isGte.Options, -): Validator { - return validator( - 'isGte', +): Validator { + return validator( + isGte.name, (input: T, context: Context, _this): Nullish => { if ( (typeof minValue === 'number' || typeof minValue === 'bigint') && diff --git a/src/rules/logical-rules/is-lt.ts b/src/rules/logical-rules/is-lt.ts index 241305f..22c7070 100644 --- a/src/rules/logical-rules/is-lt.ts +++ b/src/rules/logical-rules/is-lt.ts @@ -15,8 +15,8 @@ export function isLt( maxValue: T, options?: isLt.Options, ): Validator { - return validator( - 'isLt', + return validator( + isLt.name, (input: T, context: Context, _this): Nullish => { if ( (typeof maxValue === 'number' || typeof maxValue === 'bigint') && diff --git a/src/rules/logical-rules/is-lte.ts b/src/rules/logical-rules/is-lte.ts index bdd80c1..5634274 100644 --- a/src/rules/logical-rules/is-lte.ts +++ b/src/rules/logical-rules/is-lte.ts @@ -15,8 +15,8 @@ export function isLte( maxValue: T, options?: isLte.Options, ): Validator { - return validator( - 'isLte', + return validator( + isLte.name, (input: T, context: Context, _this): Nullish => { if ( (typeof maxValue === 'number' || typeof maxValue === 'bigint') && diff --git a/src/rules/logical-rules/range.ts b/src/rules/logical-rules/range.ts index 8eeaed1..803a73d 100644 --- a/src/rules/logical-rules/range.ts +++ b/src/rules/logical-rules/range.ts @@ -15,7 +15,7 @@ export function range( options?: range.Options, ) { return validator( - 'range', + range.name, (input: range.Input, context: Context, _this): Nullish => { if ( (typeof minValue === 'number' || typeof minValue === 'bigint') && diff --git a/src/rules/type-rules/is-any.ts b/src/rules/type-rules/is-any.ts index 0676f50..b48a094 100644 --- a/src/rules/type-rules/is-any.ts +++ b/src/rules/type-rules/is-any.ts @@ -5,4 +5,4 @@ import { validator } from '../../core/index.js'; * @validator isAny */ export const isAny = () => - validator('is-any', (input: unknown): any => input); + validator(isAny.name, (input: unknown): any => input); diff --git a/src/rules/type-rules/is-array.ts b/src/rules/type-rules/is-array.ts index 8f3a6c6..d418dfc 100644 --- a/src/rules/type-rules/is-array.ts +++ b/src/rules/type-rules/is-array.ts @@ -17,7 +17,7 @@ export function isArray( options?: isArray.Options, ) { return validator( - 'isArray', + isArray.name, (input: unknown, context: Context, _this): Nullish => { const coerce = options?.coerce ?? context.coerce; let output: any = input; diff --git a/src/rules/type-rules/is-bigint.ts b/src/rules/type-rules/is-bigint.ts index cfd2de5..91fdc49 100644 --- a/src/rules/type-rules/is-bigint.ts +++ b/src/rules/type-rules/is-bigint.ts @@ -12,7 +12,7 @@ import { */ export function isBigint(options?: isBigint.Options) { return validator( - 'isBigint', + isBigint.name, (input: unknown, context: Context, _this): Nullish => { const coerce = options?.coerce ?? context.coerce; if (typeof input === 'bigint') return input; diff --git a/src/rules/type-rules/is-boolean.ts b/src/rules/type-rules/is-boolean.ts index 3ca0bbf..c45efe7 100644 --- a/src/rules/type-rules/is-boolean.ts +++ b/src/rules/type-rules/is-boolean.ts @@ -15,7 +15,7 @@ const FALSE_PATTERN = /^false|f|0|no|n$/i; */ export function isBoolean(options?: isBoolean.Options) { return validator( - 'isBoolean', + isBoolean.name, (input: unknown, context: Context, _this): Nullish => { const coerce = options?.coerce ?? context.coerce; let output: any = input; diff --git a/src/rules/type-rules/is-date.ts b/src/rules/type-rules/is-date.ts index e95055e..9eeef39 100644 --- a/src/rules/type-rules/is-date.ts +++ b/src/rules/type-rules/is-date.ts @@ -14,7 +14,7 @@ import { export function isDate(options?: isDate.Options) { const trim = options?.trim; return validator( - 'isDate', + isDate.name, (input: any, context: Context, _this) => { const coerce = options?.coerce ?? context.coerce; let d: Date | undefined; @@ -81,7 +81,7 @@ export function isDateString(options?: isDateString.Options) { PRECISION_INDEX_VALUES.indexOf(precisionMinIdx) ] || precisionMin) as any; return validator( - 'isDateString', + isDateString.name, (input: any, context: Context, _this): Nullish => { const coerce = options?.coerce ?? context.coerce; const parsed = coerceDateString(input, trim ? precisionMax : undefined); diff --git a/src/rules/type-rules/is-enum.ts b/src/rules/type-rules/is-enum.ts index f52ebe0..69b2f51 100644 --- a/src/rules/type-rules/is-enum.ts +++ b/src/rules/type-rules/is-enum.ts @@ -33,7 +33,7 @@ export function isEnum( ); return validator( - 'isEnum', + isEnum.name, (input: any, context: Context, _this) => { if ( input != null && diff --git a/src/rules/type-rules/is-instanceof.ts b/src/rules/type-rules/is-instanceof.ts index ed177b4..6827670 100644 --- a/src/rules/type-rules/is-instanceof.ts +++ b/src/rules/type-rules/is-instanceof.ts @@ -16,7 +16,7 @@ export function isInstanceOf( options?: isInstanceOf.Options, ) { return validator( - 'isInstanceOf', + isInstanceOf.name, (input: unknown, context: Context, _this): Nullish => { if ((options?.coerce ?? context.coerce) && isPlainObject(input)) { Object.setPrototypeOf(input, clazz.prototype); diff --git a/src/rules/type-rules/is-integer.ts b/src/rules/type-rules/is-integer.ts index fc29ad6..2a7ccbc 100644 --- a/src/rules/type-rules/is-integer.ts +++ b/src/rules/type-rules/is-integer.ts @@ -12,7 +12,7 @@ import { */ export function isInteger(options?: isInteger.Options) { return validator( - 'isInteger', + isInteger.name, (input: unknown, context: Context, _this): Nullish => { const coerce = options?.coerce ?? context.coerce; let output: any = input; diff --git a/src/rules/type-rules/is-null.ts b/src/rules/type-rules/is-null.ts index 8cc5bf3..7cc015d 100644 --- a/src/rules/type-rules/is-null.ts +++ b/src/rules/type-rules/is-null.ts @@ -10,7 +10,7 @@ import { */ export function isNull(options?: isNull.Options) { return validator( - 'isNull', + isNull.name, (input: unknown, context: Context, _this) => { if (input === null) return input; context.fail(_this, `Value must be null`, input); @@ -29,7 +29,7 @@ export namespace isNull { */ export function isNotNull(options?: isNotNull.Options) { return validator( - 'isNotNull', + isNotNull.name, (input: unknown, context: Context, _this) => { if (input !== null) return input; context.fail(_this, `{{label}} is null`, input); @@ -48,7 +48,7 @@ export namespace isNotNull { */ export function isNullish(options?: isNullish.Options) { return validator( - 'isNullish', + isNullish.name, (input: unknown, context: Context, _this) => { if (input == null) return input; context.fail(_this, `{{label}} is not nullish`, input); @@ -67,7 +67,7 @@ export namespace isNullish { */ export function isNotNullish(options?: isNotNullish.Options) { return validator( - 'isNotNullish', + isNotNullish.name, (input: unknown, context: Context, _this) => { if (input != null) return input; if (input === null) context.fail(_this, `{{label}} is null`, input); diff --git a/src/rules/type-rules/is-number.ts b/src/rules/type-rules/is-number.ts index da75627..0f6746a 100644 --- a/src/rules/type-rules/is-number.ts +++ b/src/rules/type-rules/is-number.ts @@ -12,7 +12,7 @@ import { */ export function isNumber(options?: isNumber.Options) { return validator( - 'isNumber', + isNumber.name, (input: unknown, context: Context, _this): Nullish => { const coerce = options?.coerce ?? context.coerce; let output: any = input; diff --git a/src/rules/type-rules/is-object.ts b/src/rules/type-rules/is-object.ts index db6be7a..2caec01 100644 --- a/src/rules/type-rules/is-object.ts +++ b/src/rules/type-rules/is-object.ts @@ -51,7 +51,7 @@ export function isObject( } const _rule = validator( - 'isObject', + isObject.name, ( input: any, context: Context & { circMap?: Map }, diff --git a/src/rules/type-rules/is-record.ts b/src/rules/type-rules/is-record.ts index 0095b4c..31841e3 100644 --- a/src/rules/type-rules/is-record.ts +++ b/src/rules/type-rules/is-record.ts @@ -18,7 +18,7 @@ export function isRecord( options?: isRecord.Options, ) { return validator>( - 'isRecord', + isRecord.name, ( input: object | undefined, context: Context, diff --git a/src/rules/type-rules/is-string.ts b/src/rules/type-rules/is-string.ts index 89ac4b8..8a21037 100644 --- a/src/rules/type-rules/is-string.ts +++ b/src/rules/type-rules/is-string.ts @@ -12,7 +12,7 @@ import { */ export function isString(options?: isString.Options) { return validator( - 'isString', + isString.name, (input: any, context: Context, _this): Nullish => { const coerce = options?.coerce ?? context.coerce; let output: any = input; diff --git a/src/rules/type-rules/is-tuple.ts b/src/rules/type-rules/is-tuple.ts index 309d65d..114dc16 100644 --- a/src/rules/type-rules/is-tuple.ts +++ b/src/rules/type-rules/is-tuple.ts @@ -67,7 +67,7 @@ export function isTuple( >; export function isTuple(items: Validator[], options?: ValidationOptions) { return validator( - 'isTuple', + isTuple.name, (input: unknown, context: Context, _this) => { const coerce = options?.coerce ?? context.coerce; let output: any = input; diff --git a/src/rules/type-rules/is-undefined.ts b/src/rules/type-rules/is-undefined.ts index 2403308..6b2851b 100644 --- a/src/rules/type-rules/is-undefined.ts +++ b/src/rules/type-rules/is-undefined.ts @@ -11,7 +11,7 @@ import { */ export function isUndefined(options?: isUndefined.Options) { return validator( - 'isUndefined', + isUndefined.name, (input: unknown, context: Context, _this): Nullish => { if (options?.coerce ?? context.coerce) return undefined; if (input === undefined) return; diff --git a/src/rules/utility-rules/all-of.ts b/src/rules/utility-rules/all-of.ts index f08e155..23b2c9c 100644 --- a/src/rules/utility-rules/all-of.ts +++ b/src/rules/utility-rules/all-of.ts @@ -13,7 +13,7 @@ export function allOf( rules: Validator[], options?: allOf.Options, ): Validator { - return validator('allOf', (input: any, context: Context): any => { + return validator(allOf.name, (input: any, context: Context): any => { let i: number; let c: Validator; const l = rules.length; diff --git a/src/rules/utility-rules/exists.ts b/src/rules/utility-rules/exists.ts index 3753eb8..d7e2992 100644 --- a/src/rules/utility-rules/exists.ts +++ b/src/rules/utility-rules/exists.ts @@ -10,7 +10,7 @@ import { */ export function exists(options?: exists.Options) { return validator( - 'exists', + exists.name, (input: unknown, context: Context, _this) => { if ( input !== undefined || diff --git a/src/rules/utility-rules/fixed.ts b/src/rules/utility-rules/fixed.ts new file mode 100644 index 0000000..f3c38ee --- /dev/null +++ b/src/rules/utility-rules/fixed.ts @@ -0,0 +1,11 @@ +import { validator } from '../../core/index.js'; + +/** + * Check if value is not nullish before calling nested rule + * @validator required + */ +export function fixed(value: T) { + return validator(fixed.name, (): T => { + return value; + }); +} diff --git a/src/rules/utility-rules/get-length.ts b/src/rules/utility-rules/get-length.ts index 2fd457b..2d90f81 100644 --- a/src/rules/utility-rules/get-length.ts +++ b/src/rules/utility-rules/get-length.ts @@ -13,7 +13,7 @@ type ExtractLengthInput = */ export function getLength() { return validator( - 'getLength', + getLength.name, (input: any, context: Context, _this): Nullish => { if (typeof input === 'string') return input.length; if (Array.isArray(input)) return input.length; diff --git a/src/rules/utility-rules/nullable.ts b/src/rules/utility-rules/nullable.ts new file mode 100644 index 0000000..1d831b0 --- /dev/null +++ b/src/rules/utility-rules/nullable.ts @@ -0,0 +1,29 @@ +import type { Maybe, Nullish } from 'ts-gems'; +import { + type Context, + type ValidationOptions, + type Validator, + validator, +} from '../../core/index.js'; + +/** + * Makes the sub-rule nullable (undefined of null) + * @validator optional + */ +export function nullable( + nested: Validator, + options?: nullable.Options, +) { + return validator, Nullish>( + nullable.name, + (input: Nullish, context: Context): Maybe => { + if (input == null) return input as any; + return nested(input as I, context) as T; + }, + options, + ); +} + +export namespace nullable { + export interface Options extends ValidationOptions {} +} diff --git a/src/rules/utility-rules/one-of.ts b/src/rules/utility-rules/one-of.ts index d4e32b7..96d6c96 100644 --- a/src/rules/utility-rules/one-of.ts +++ b/src/rules/utility-rules/one-of.ts @@ -15,7 +15,7 @@ export function oneOf( options?: oneOf.Options, ) { const l = rules.length; - return validator('union', (input: any, context: Context, _this): any => { + return validator(oneOf.name, (input: any, context: Context, _this): any => { let i: number; let c: Validator; let discriminator: DiscriminatorRecord | undefined; diff --git a/src/rules/utility-rules/optional.ts b/src/rules/utility-rules/optional.ts index 6a27cab..25da712 100644 --- a/src/rules/utility-rules/optional.ts +++ b/src/rules/utility-rules/optional.ts @@ -1,4 +1,4 @@ -import type { Nullish } from 'ts-gems'; +import type { Maybe } from 'ts-gems'; import { type Context, type ValidationOptions, @@ -14,10 +14,10 @@ export function optional( nested: Validator, options?: optional.Options, ) { - return validator, Nullish>( - 'optional', - (input: Nullish, context: Context): Nullish => { - if (input == null) return input as any; + return validator, Maybe>( + optional.name, + (input: Maybe, context: Context): Maybe => { + if (input === undefined) return input as any; return nested(input as I, context) as T; }, options, diff --git a/src/rules/utility-rules/pipe.ts b/src/rules/utility-rules/pipe.ts index 656158a..ba5e7a0 100644 --- a/src/rules/utility-rules/pipe.ts +++ b/src/rules/utility-rules/pipe.ts @@ -17,7 +17,7 @@ export function pipe( const l = rules.length; const returnIndex = options?.returnIndex; return validator( - 'pipe', + pipe.name, (input: unknown, context: Context): Nullish => { let i: number; let c: Validator; diff --git a/src/rules/utility-rules/required.ts b/src/rules/utility-rules/required.ts index b701cd9..cb1aa4a 100644 --- a/src/rules/utility-rules/required.ts +++ b/src/rules/utility-rules/required.ts @@ -15,7 +15,7 @@ export function required( options?: RequiredValidatorOptions, ) { return validator, I>( - 'required', + required.name, (input: I, context: Context, _this): Nullish => { if (input == null) input = options?.default; if (input == null) { diff --git a/src/rules/utility-rules/string-utils.ts b/src/rules/utility-rules/string-utils.ts index 87d37d7..b38a652 100644 --- a/src/rules/utility-rules/string-utils.ts +++ b/src/rules/utility-rules/string-utils.ts @@ -29,7 +29,7 @@ export function stringReplace( ); export function stringReplace(searchValue: any, replacer: any) { return validator( - 'stringReplace', + stringReplace.name, (input: unknown): Nullish => { if (input == null) return input; return String(input).replace(searchValue, replacer); @@ -47,7 +47,7 @@ export function stringSplit( limit?: number, ); export function stringSplit(splitter: any, limit: any) { - return validator('stringSplit', (input: unknown) => { + return validator(stringSplit.name, (input: unknown) => { if (input == null) return input; return String(input).split(splitter, limit); }); @@ -58,7 +58,7 @@ export function stringSplit(splitter: any, limit: any) { * @validator trim */ export function trim() { - return validator('trim', (input: unknown) => { + return validator(trim.name, (input: unknown) => { if (input == null) return input; return String(input).trim(); }); @@ -70,15 +70,15 @@ export function trim() { * Removes whitespace from the end of a string * @validator trimEnd */ -export const trimEnd = () => trimEndRule; - -const trimEndRule = validator( - 'trimEnd', - (input: unknown): Nullish => { - if (input == null) return input; - return String(input).trimEnd(); - }, -); +export function trimEnd() { + return validator( + trimEnd.name, + (input: unknown): Nullish => { + if (input == null) return input; + return String(input).trimEnd(); + }, + ); +} // ************************************************************* @@ -86,12 +86,12 @@ const trimEndRule = validator( * Removes whitespace from the beginning of a string * @validator trimStart */ -export const trimStart = () => trimStartRule; - -const trimStartRule = validator( - 'trimStart', - (input: unknown): Nullish => { - if (input == null) return input; - return String(input).trimStart(); - }, -); +export function trimStart() { + return validator( + trimStart.name, + (input: unknown): Nullish => { + if (input == null) return input; + return String(input).trimStart(); + }, + ); +} diff --git a/test/core/validator.spec.ts b/test/core/validator.spec.ts index 9dd0e25..b18b977 100644 --- a/test/core/validator.spec.ts +++ b/test/core/validator.spec.ts @@ -3,7 +3,7 @@ import { isNumber, kOptions, kValidatorFn, - ValidationOptions, + type ValidationOptions, validator, } from 'valgen'; diff --git a/test/tsconfig.json b/test/tsconfig.json index 259bb20..8a939cd 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -4,7 +4,6 @@ "compilerOptions": { "types": ["node", "mocha"], "sourceMap": true, - "baseUrl": "./", "paths": { "valgen": ["../src/index.js"] } diff --git a/test/type-rules/is-object.spec.ts b/test/type-rules/is-object.spec.ts index 4a05551..269863d 100644 --- a/test/type-rules/is-object.spec.ts +++ b/test/type-rules/is-object.spec.ts @@ -2,7 +2,6 @@ import { expect } from 'expect'; import { forwardRef, isNumber, - IsObject, isString, postValidation, preValidation, @@ -20,11 +19,11 @@ class Person { declare address?: Address; } -const addressDef: IsObject.Schema = { +const addressDef: vg.isObject.Schema = { city: [vg.optional(isString), { label: 'City' }], country: [vg.required(isString), { label: 'Country' }], }; -const personDef: IsObject.Schema = { +const personDef: vg.isObject.Schema = { name: [vg.required(isString), { label: 'Full Name', as: 'fullName' }], age: [vg.required(isNumber), { label: 'Age' }], address: vg.optional(vg.isObject(addressDef, { ctor: Address })), diff --git a/test/utility-rules/fixed.spec.ts b/test/utility-rules/fixed.spec.ts new file mode 100644 index 0000000..dd41c80 --- /dev/null +++ b/test/utility-rules/fixed.spec.ts @@ -0,0 +1,9 @@ +import { expect } from 'expect'; +import { vg } from 'valgen'; + +describe('fixed', () => { + it('should validate value exists', () => { + expect(vg.fixed(0)(1)).toStrictEqual(0); + expect(vg.fixed(null)(1)).toStrictEqual(null); + }); +}); diff --git a/test/utility-rules/nullable.spec.ts b/test/utility-rules/nullable.spec.ts new file mode 100644 index 0000000..c3083ba --- /dev/null +++ b/test/utility-rules/nullable.spec.ts @@ -0,0 +1,11 @@ +import { expect } from 'expect'; +import { isNumber, isString, vg } from 'valgen'; + +describe('nullable', () => { + it('should validate optional value', () => { + expect(vg.nullable(isNumber)(0)).toStrictEqual(0); + expect(vg.nullable(isString)('')).toStrictEqual(''); + expect(vg.nullable(isString)(undefined)).toStrictEqual(undefined); + expect(vg.nullable(isString)(null)).toStrictEqual(null); + }); +}); diff --git a/test/utility-rules/is-optional.spec.ts b/test/utility-rules/optional.spec.ts similarity index 77% rename from test/utility-rules/is-optional.spec.ts rename to test/utility-rules/optional.spec.ts index 7511dc8..42ce44b 100644 --- a/test/utility-rules/is-optional.spec.ts +++ b/test/utility-rules/optional.spec.ts @@ -1,11 +1,11 @@ import { expect } from 'expect'; import { isNumber, isString, vg } from 'valgen'; -describe('isOptional', () => { +describe('optional', () => { it('should validate optional value', () => { expect(vg.optional(isNumber)(0)).toStrictEqual(0); expect(vg.optional(isString)('')).toStrictEqual(''); expect(vg.optional(isString)(undefined)).toStrictEqual(undefined); - expect(vg.optional(isString)(null)).toStrictEqual(null); + expect(() => vg.optional(isString)(null)).toThrow(); }); }); diff --git a/tsconfig.json b/tsconfig.json index 8499a82..919273d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "./tsconfig-base.json", - "compilerOptions": { - "types": ["node"] - }, "include": ["src"], "exclude": ["node_modules", "build"] }