{"_id":"@aidenhadisi/joi-decorators","_rev":"4-ad561fa09481f726fb24c33f77565762","name":"@aidenhadisi/joi-decorators","dist-tags":{"latest":"1.3.0"},"versions":{"1.0.0":{"name":"@aidenhadisi/joi-decorators","version":"1.0.0","description":"Typescript decorators for Joi validator.","exports":"./dist/index.js","author":{"name":"Aiden Hadisi"},"license":"MIT","engines":{"node":">=12"},"scripts":{"build":"del dist && tsc","prepare":"npm run build","test":"jest","coverage":"jest --coverage"},"types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/AidenHadisi/Joi-Decorators.git"},"keywords":["joi","validation","validator","decorator","valid","validate"],"bugs":{"url":"https://github.com/AidenHadisi/Joi-Decorators/issues"},"homepage":"https://github.com/AidenHadisi/Joi-Decorators#readme","dependencies":{"joi":"^17.4.2","tslib":"^2.3.1"},"devDependencies":{"@types/jest":"^27.0.1","@types/node":"^16.7.1","jest":"^27.0.6","reflect-metadata":"^0.1.13","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.3.5"},"jest":{"globals":{"ts-jest":{"isolatedModules":true}}},"ts-node":{"files":true},"gitHead":"be40752b71e6bd3615bda76823eabf413420e7ec","_id":"@aidenhadisi/joi-decorators@1.0.0","_nodeVersion":"14.17.3","_npmVersion":"6.14.13","dist":{"integrity":"sha512-IeOKI2Y0+ZEo/b2founBl9u5WrfCJA9Iniy/S2q8ZepRAC1YzhX/lOzLgl2nw8nQ7Ml0WoHYmppXHNFgqL5+jg==","shasum":"7957180e6b54e3c695ffa54fe581a1010fe9405f","tarball":"https://registry.npmjs.org/@aidenhadisi/joi-decorators/-/joi-decorators-1.0.0.tgz","fileCount":11,"unpackedSize":8878,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJWnQCRA9TVsSAnZWagAAP64P/R4X/C21m2yE6C4wvnhs\nAVe9+SFU3d6BWL8N2W/VOTQKpRqKe87NqaLESF2m4Coe4STnOTM8H9BoETbU\nKcSU0mglPS6YUD1OSzNdR5//y1DrKEmcZxxFn+vDOnylzb3WuGyH/zJnHaIf\n8kSibhGyCWfsVrmPLueHZPNAQOOtPTolle1BSO8s/c/Hxs4qjImpYaS+IAfE\nzMEUopCAfuKhv9u6R4AnxRVI2Kiqf4pRdqnUbjje+DdL9t9IWbi3N8quNiF0\nqwokmAQMQUusoHPhA3hr5XBJTKPenvP4s9fdFWVscXTiZbFBPbQXYiuLx7iQ\nDLwfR3xahEYAQ2RkAQUoNhM+puBQmI82JE04+KPqxMHi0U+unwGuvYRXX1F1\nsDPaI3qfBFfQH27oeJBAUHjYXBTFxbVh45OZaeNMp8CirkBBPdYXVX1xnk1k\nI8FB7nM0EA6aHOFi2j1vT7l3Q+DYnUeIeHZBgQrKXshJeDbqF9IP+KSl30RK\neeEF6RuH9zMmdSEP8w0Z11mP5GS38vQEFNGQrFkXNkM1PadDI7DbyUqhshE2\nd9pz7oK3QEnipnRxc//oXd9zjPVYk+OMPbz1cNWL9i78gp1dwOxoBENaIzt1\n/UJexabTu4C/QlDgVymbtdRqdbkL2q+lde3HBXCUf0Lz95za/T8oBrC30+oE\nJXjd\r\n=GWOQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDC3D5+Vytjp+MYi+A/y7TwCK33x86+OzKLHeCVSJ77jAiBaDbtYz1+ToYO9whBJXUYEXkQoYE4c+8BSIs5nyXNRsQ=="}]},"_npmUser":{"name":"aidenhadisi","email":"so.hadisi@gmail.com"},"directories":{},"maintainers":[{"name":"aidenhadisi","email":"so.hadisi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/joi-decorators_1.0.0_1629841872216_0.6934897520958878"},"_hasShrinkwrap":false},"1.1.0":{"name":"@aidenhadisi/joi-decorators","version":"1.1.0","description":"Typescript decorators for Joi validator.","main":"dist/index.js","types":"dist/index.d.ts","author":{"name":"Aiden Hadisi"},"license":"MIT","engines":{"node":">=12"},"scripts":{"build":"del dist && tsc","prepare":"npm run build","test":"jest","coverage":"jest --coverage"},"repository":{"type":"git","url":"git+https://github.com/AidenHadisi/Joi-Decorators.git"},"keywords":["joi","validation","validator","decorator","valid","validate"],"bugs":{"url":"https://github.com/AidenHadisi/Joi-Decorators/issues"},"homepage":"https://github.com/AidenHadisi/Joi-Decorators#readme","dependencies":{"joi":"^17.4.2","tslib":"^2.3.1"},"devDependencies":{"@types/jest":"^27.0.1","@types/node":"^16.7.1","jest":"^27.0.6","reflect-metadata":"^0.1.13","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.3.5"},"jest":{"globals":{"ts-jest":{"isolatedModules":true}}},"ts-node":{"files":true},"gitHead":"be40752b71e6bd3615bda76823eabf413420e7ec","_id":"@aidenhadisi/joi-decorators@1.1.0","_nodeVersion":"14.17.3","_npmVersion":"6.14.13","dist":{"integrity":"sha512-VZL5KTvIiksLSG2frcbitCg/872UQGBx508qcN12oZFbIAIhMkKjCApP+JTDreQ01vOUKC42L+TOaKHVdHMlbQ==","shasum":"1cdab376cfc5a10c2e97c78aa0573a37bfbef026","tarball":"https://registry.npmjs.org/@aidenhadisi/joi-decorators/-/joi-decorators-1.1.0.tgz","fileCount":26,"unpackedSize":19245,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJe09CRA9TVsSAnZWagAAoPcQAJkSmS4zlYBcjkcUm+d0\naRYtcujtZmTa0KElfG3kCUARZLmK2LUVhy75r+8KLwx1J+NcYESOVICs7i4h\nfhcIAiNz3rUl5HcMWtWox0NgB6/PpCINSPfQJNi7HOEmKMVT21faPyJInqTs\nNp7+c9DpZruVOGzhBZTxQQ7ft9e22GXra23Wqlw597lD/VhNH5rUiB8oAoXk\nnnuNcfqcsGRMGWe1fbkf5fiXrjyF37pf/h1TvluNSRk0eZ9mfnx1JXSQFluL\nyrr9lHMB7Anu8BnB5WRQsU3PtGuVieR1hZhbpSluUFWsqkRgMx0D4CgcWvW8\n6DJ1gzHG/Kr7QRCUt83MoPC6nlJIjUlCSuyHA24QAFR2DFKc4tADl+7D/OKT\nYADrzbYEDwHLJh1lmnzkqFchVbbjF3MEYMwPpBLpmbepYWRwBu934DOWKEFm\nqEikIKcE/yqN6CwQeQubUkAK6IOrEe8gmh7rNEVTP5iWgz7OMFtdn4KFOBcg\nlrMueZVUHq9xBXA1Q5nyLrVLJoXjby5M7w1gLR5SZaKpCtCMK8yZ94voCMsu\nBfwwgxKIUcBziENA+bPjsFMphYfWfDtq9vDcc3pvKxT+PnIAezBsEEcGjY54\ngpy2HpZCI4u+9PcyguBwRs9u3RHkVuEesSk2KSc9EqIP7UKB0LTNcpPJZgIO\njMqy\r\n=35GR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHcs83xwdrK7AG4skh3Rh6r55ZwdJRDFvR0KXEv1AAYeAiAo1gOpAs/zh258OJ4iYKM8wr/RhYLRVMTKcyUBbtQWOw=="}]},"_npmUser":{"name":"aidenhadisi","email":"so.hadisi@gmail.com"},"directories":{},"maintainers":[{"name":"aidenhadisi","email":"so.hadisi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/joi-decorators_1.1.0_1629875517584_0.7027759784560417"},"_hasShrinkwrap":false},"1.2.0":{"name":"@aidenhadisi/joi-decorators","version":"1.2.0","description":"Typescript decorators for Joi validator.","main":"dist/index.js","types":"dist/index.d.ts","author":{"name":"Aiden Hadisi"},"license":"MIT","engines":{"node":">=12"},"scripts":{"build":"tsc","clean":"rimraf ./dist","prepare":"yarn clean && yarn build","test":"jest","coverage":"jest --coverage"},"repository":{"type":"git","url":"git+https://github.com/AidenHadisi/Joi-Decorators.git"},"keywords":["joi","validation","validator","decorator","valid","validate"],"bugs":{"url":"https://github.com/AidenHadisi/Joi-Decorators/issues"},"homepage":"https://github.com/AidenHadisi/Joi-Decorators#readme","dependencies":{"joi":"^17.4.2","tslib":"^2.3.1"},"devDependencies":{"@types/jest":"^27.0.1","@types/node":"^16.7.1","jest":"^27.0.6","reflect-metadata":"^0.1.13","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.3.5"},"jest":{"globals":{"ts-jest":{"isolatedModules":true}}},"ts-node":{"files":true},"gitHead":"1ab54110bf8134ce5a0d77f1dac6dffdadd54c84","_id":"@aidenhadisi/joi-decorators@1.2.0","_nodeVersion":"14.17.3","_npmVersion":"6.14.13","dist":{"integrity":"sha512-kvpMr50yngQh+LIE8JUoCLQ5hq6GPSm6xP76DGmurEypToVyVP4OuPK+DViG1QHlPtJbMtxpFOCjwFva3/wyfA==","shasum":"bb2999f97f1acbe0b955b391e3b214265c81f638","tarball":"https://registry.npmjs.org/@aidenhadisi/joi-decorators/-/joi-decorators-1.2.0.tgz","fileCount":27,"unpackedSize":19113,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJo9fCRA9TVsSAnZWagAAH5UP/32E915Ykv5yNqB6MQew\nX9YeGqlvsYPpPI7GJihkMLaLoegswIXS5gUfFLaZt7jC0znIAA0jBckR4vgx\neiuK01DcvZS9bFq2t+PYlxzEnuRj3us+OHjl2du8JgdJ4N3MPmMvPRwlulZ/\nv049DIgYADohmL88rLYX7Iu24Id4ZdRcfWtQmKjGTkZLNn40BlSFYoXbMTeY\nF4spWPHC1a/X3Y5LGW4ehVRnNwp4b7YGxlLdHZvz5CNbaR7gG88VOWlotFXZ\nYWZScu6AhmJAgG2uAt4qK5H5DFa/QBGv0gNeNPeKqy7IjgfEHVV24+P+A7sn\nuZ2hsc3RucwCluvmzHQRWoWmlEFOtKiwnvdXWX2kXc8i/ntc4XgEEHaogUeA\nihIpF5q1z35U5DAfFNeOjT47PqRLvDdmwFxdAVpqwxdXvpDzIxLRiRAMoFNP\nFUKUMgWvGegVsyw21Sd/EilE1NQeU1Vetp5h9tc5/pPjvFQ5mEPiYUkvLthg\nvn2gvQliC7YBWlAEuomcCpjZe0ZCpV0z9txrrZjFUnPnD5W4ZhKjfEAyrmM+\nzTnWNAnvQoQjZmZn9hX/M1e5PnFEfJ1942y5tjzOaqvQ+6trr7yKIH5qg555\nJl1oS+1U1K/5WuogyCbPBMRuSIXkTsZyVxiEOgRFmDHzzCRvNPedUyKgySrq\nFi+3\r\n=TYtn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICu6xYdXW2U8ConoznZQTu3i4hUfFAX/xeTad/Q7v3mNAiEAjtL5GGiD9i1P6AoB576zgY7w8LcHJbYF+mV8GREzIiY="}]},"_npmUser":{"name":"aidenhadisi","email":"so.hadisi@gmail.com"},"directories":{},"maintainers":[{"name":"aidenhadisi","email":"so.hadisi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/joi-decorators_1.2.0_1629917023778_0.31456400379289273"},"_hasShrinkwrap":false},"1.3.0":{"name":"@aidenhadisi/joi-decorators","version":"1.3.0","description":"Typescript decorators for Joi validator.","main":"dist/index.js","types":"dist/index.d.ts","author":{"name":"Aiden Hadisi"},"license":"MIT","engines":{"node":">=12"},"scripts":{"build":"tsc","clean":"rimraf ./dist","prepare":"yarn clean && yarn build","test":"jest","coverage":"jest --coverage"},"repository":{"type":"git","url":"git+https://github.com/AidenHadisi/Joi-Decorators.git"},"keywords":["joi","validation","validator","decorator","valid","validate"],"bugs":{"url":"https://github.com/AidenHadisi/Joi-Decorators/issues"},"homepage":"https://github.com/AidenHadisi/Joi-Decorators#readme","dependencies":{"joi":"^17.4.2","tslib":"^2.3.1"},"devDependencies":{"@types/jest":"^27.0.1","@types/node":"^16.7.1","jest":"^27.0.6","reflect-metadata":"^0.1.13","ts-jest":"^27.0.5","ts-node":"^10.2.1","typescript":"^4.3.5"},"jest":{"globals":{"ts-jest":{"isolatedModules":true}}},"ts-node":{"files":true},"licenseText":"MIT License\n\nCopyright (c) Aiden Hadisi\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@aidenhadisi/joi-decorators@1.3.0","dist":{"shasum":"dfa952701287e0b74a62946241d3ee8ca2a4b71c","integrity":"sha512-fMYlqFDdSb+NQxaLycewMr/gSxxCHXDOfOeoCIfkynoc16oq7SCZvjMJLJ+bOKE5j62sLHyFVWbS84O4AOMEvg==","tarball":"https://registry.npmjs.org/@aidenhadisi/joi-decorators/-/joi-decorators-1.3.0.tgz","fileCount":31,"unpackedSize":19102,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhJq7ICRA9TVsSAnZWagAA+vMP/37gUgsJXjMTJBXVY016\nU0/7qV2l7otBJSdUe8ZY2fTeOJB6Wy7ZjgMGyjjKN8qpxk2hrr4XwwfQrB98\n24tx39QesbKoGIpdnUAOaYUxG1aLJ0Upw57rPz6Bgb+O/bpP8bti5E566Owz\n9I9tAG8CPzTMHn3dAdWHSbsAH9m9Ch34P3jmhhC5QVB8UNQ5I8UYf5YglXzm\n3JIUbFxGTExjFKykivDusWF6LSstX2dOATyyrBwo8xtSwt9lQwDZHZe9UDsO\nDibcNSP3B3xSMyRHGfBrzbWbGufJNxr4XE3aa1/pCo4EOdvDkGG6PQs4iNnY\n1oupjdzo40cMQu0OXhTzGriBxblIcVHd03cZh9D5Xkgw22AttPPp5PNh/uJo\nYQ5PBPEE60aScE34Nzo6aIaEb7likSGcotJza2E4ghEywIAcp3ZquKRhOgET\n3cMkevcSpr7tY9ZIjsylfDE5YDOz1BmAoO1Zak2EJt8V5Rd2y3LPZjqZ55fO\n2JfY0aotopE5z338NWHKTrlXQc0lb3DVSQAw8wawoZxbGqmDy7vLluhJixGD\ntj2dmpsPcHdXLZw0jGTiGJDATtpvVkhyUTYRPVIdMIpb6dJ+KiPPeiQnNCx0\nWbbz901R+26VA+ZNqLs7Uz8M6VY6bZAhmZL8s8zTmpWoHhXOAWI2VbQ8A3Td\n62fb\r\n=yveD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFxRA2/ibQR4czk9++0XklzQBLIT5kuYpZbO9IFNBOiWAiBT3R89axCY59xHtTO6nywnMVl+12oie72171b0NfUATA=="}]},"_npmUser":{"name":"aidenhadisi","email":"so.hadisi@gmail.com"},"directories":{},"maintainers":[{"name":"aidenhadisi","email":"so.hadisi@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/joi-decorators_1.3.0_1629925064184_0.4318939479894013"},"_hasShrinkwrap":false}},"time":{"created":"2021-08-24T21:51:12.132Z","1.0.0":"2021-08-24T21:51:12.391Z","modified":"2022-04-04T12:16:40.074Z","1.1.0":"2021-08-25T07:11:57.684Z","1.2.0":"2021-08-25T18:43:43.981Z","1.3.0":"2021-08-25T20:57:44.409Z"},"maintainers":[{"name":"aidenhadisi","email":"so.hadisi@gmail.com"}],"description":"Typescript decorators for Joi validator.","homepage":"https://github.com/AidenHadisi/Joi-Decorators#readme","keywords":["joi","validation","validator","decorator","valid","validate"],"repository":{"type":"git","url":"git+https://github.com/AidenHadisi/Joi-Decorators.git"},"author":{"name":"Aiden Hadisi"},"bugs":{"url":"https://github.com/AidenHadisi/Joi-Decorators/issues"},"license":"MIT","readme":"# Joi-Decorators\n\n> Joi validation decorators for TypeScript.\n\nEasily validate your classes, method parameters, and properties using Joi decorators.\n\n## Install\n\nInstall using **npm**:\n\n```\n$ npm install @aidenhadisi/joi-decorators\n```\n\nOr using **yarn**:\n\n```\n$ yarn add @aidenhadisi/joi-decorators\n```\n\n## Usage\n\n### Validate Class Properties\n\n`Valid` decorator validates class properties whenever the property is set or modified. Anytime the value is modified the validation schema will be applied.\n\n```js\nimport { Valid } from \"@aidenhadisi/joi-decorators\";\n\n//Create a Joi Schema:\nlet schema = Joi.string().max(5);\n\nclass Employee {\n\t//Pass schema to decorator\n\t@Valid(schema)\n\tpublic id: string\n\n\tpublic name: string;\n\n\tconstructor() {\n\t\tthis.name = \"John Doe\"\n\t\tthis.id = \"valid\";\n\t}\n}\n\nlet employee = new Employee();\n\n//Throws Joi.ValidationError\nemployee.id = \"invalid\";\n\n```\n\nFurthermore, If an invalid value is provided during the class construction, the constructor function will throw.\n\n```js\nimport { Valid } from \"@aidenhadisi/joi-decorators\";\n\n//Create a Joi Schema:\nlet schema = Joi.string().max(5);\n\nclass Employee {\n\t//Pass schema to decorator\n\t@Valid(schema)\n\tpublic id: string\n\n\tpublic name: string;\n\n\tconstructor() {\n\t\tthis.name = \"John Doe\"\n\t\t//Invalid value in constructor\n\t\tthis.id = \"Invalid\";\n\t}\n}\n\n//Throws Joi.ValidationError\nlet employee = new Employee();\n\n\n```\n\n### Validating Constructor Parameters\n\n`Validate` and `Valid` decorators can be used to validate constructor parameters.\n\n```js\nimport { Valid, Validate } from \"@aidenhadisi/joi-decorators\";\n\n//Create a Joi Schema:\nlet schema = Joi.string().max(5);\n\n//Mark class with Validate\n@Validate()\nclass Employee {\n\tpublic id: string\n\tpublic name: string;\n\n\t//Mark the parameter with Valid decorator and pass the Joi schema\n\tconstructor(@Valid(schema) id: string) {\n\t\tthis.name = \"John Doe\"\n\t\tthis.id = id;\n\t}\n}\n\n//Throws Joi.ValidationError\nlet employee = new Employee(\"Invalid\");\n\n\n```\n\n### Validating Method Parameters\n\n`Validate` and `Valid` decorators can be used to validate method parameters.\n\n```js\nimport { Valid, Validate } from \"@aidenhadisi/joi-decorators\";\n\n//Create a Joi Schema:\nlet schema = Joi.string().max(5);\n\nclass Employee {\n\tpublic id: string\n\tpublic name: string;\n\n\tconstructor() {\n\t\tthis.name = \"John Doe\"\n\t\tthis.id = \"valid\";\n\t}\n\n\t//Mark the method with validate\n\t//and mark the parameter with Valid decorator and pass the Joi schema\n\t@Validate()\n\tpublic changeId(@Valid(schema) id: string) {\n\t\tthis.id = id;\n\t}\n}\n\n\nlet employee = new Employee();\n\n//Throws Joi.ValidationError\nemployee.changeId(\"invalid\");\n\n```\n\n### Contributing\n\nContributions are welcome. Feel free to add new features and improve the code.\n","readmeFilename":"README.md"}