{"_id":"@abhiram2k03/input-validation","_rev":"7-dcf3f90e307f5bcf9016a7a8035162af","name":"@abhiram2k03/input-validation","dist-tags":{"latest":"1.4.0"},"versions":{"1.0.0":{"name":"@abhiram2k03/input-validation","version":"1.0.0","keywords":[],"author":"","license":"ISC","_id":"@abhiram2k03/input-validation@1.0.0","maintainers":[{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"}],"dist":{"shasum":"459e3057c6ea40ab96b4d11aba9f0c12c1b8a332","tarball":"https://registry.npmjs.org/@abhiram2k03/input-validation/-/input-validation-1.0.0.tgz","fileCount":5,"integrity":"sha512-rjVp4PPrUW+p/qJKf78iaGudQ4r5WRCvE4XXjiIKxnU5cu/x2huYEPZKJ5dVyiLcjfkiWLD6TZ+JEE0xin47YA==","signatures":[{"sig":"MEYCIQD/pg/p21rOIbCHwgBa9NqvskTkvu3psUrOgnXxm+Xd6QIhAMwOPyUeXqR+tVfUpPdRrB9iD9BwL5B5cUABp3TQ3dmY","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":17311},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"bd37538e2b50b52e8826f0799223871e45dfa2fa","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"},"_npmVersion":"10.5.0","description":"This package provides a set of Zod schemas for validating user inputs in various authentication-related scenarios, such as sign-up, sign-in, forgot password, and reset password. It utilizes the powerful Zod library for data validation and type inference.","directories":{},"_nodeVersion":"21.7.1","dependencies":{"zod":"^3.22.4"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/input-validation_1.0.0_1712332664420_0.8752750679513837","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@abhiram2k03/input-validation","version":"1.0.1","keywords":["input","validation","zod","forms","signin","login"],"author":"","license":"MIT","_id":"@abhiram2k03/input-validation@1.0.1","maintainers":[{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"}],"homepage":"https://github.com/saiabhiramjaini/-abhiram2k03-input-validation#readme","bugs":{"url":"https://github.com/saiabhiramjaini/-abhiram2k03-input-validation/issues"},"dist":{"shasum":"8df20d3a8f67610f03457b5f301df9e2ed96781b","tarball":"https://registry.npmjs.org/@abhiram2k03/input-validation/-/input-validation-1.0.1.tgz","fileCount":5,"integrity":"sha512-fcbAN6mVgtO2A4vbjfgZPl/U7tAfE5wnu9n6wJ/fDTXgadducJbilQOT7F2URC3dg2zqet+ywSdBoSxaHRXd3w==","signatures":[{"sig":"MEUCIGHAlpdMRymEBoP27JG6+CZKAe/SRubp3egfQVU4R6DAAiEAxA99ojTK1iyk2qaV7i6o9+IsC49hYRvNTiFa0kJPRN4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":17500},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"c752d40b1be91c781069aa6ba3b1154a79d7f4d2","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"},"repository":{"url":"git+https://github.com/saiabhiramjaini/-abhiram2k03-input-validation.git"},"_npmVersion":"10.5.0","description":"This package provides a set of Zod schemas for validating user inputs in various authentication-related scenarios, such as sign-up, sign-in, forgot password, and reset password. It utilizes the powerful Zod library for data validation and type inference.","directories":{},"_nodeVersion":"21.7.1","dependencies":{"zod":"^3.22.4"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/input-validation_1.0.1_1712334300427_0.312289974945664","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"@abhiram2k03/input-validation","version":"1.1.0","keywords":["input","validation","zod","forms","signin","login"],"author":"","license":"MIT","_id":"@abhiram2k03/input-validation@1.1.0","maintainers":[{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"}],"homepage":"https://github.com/saiabhiramjaini/-abhiram2k03-input-validation#readme","bugs":{"url":"https://github.com/saiabhiramjaini/-abhiram2k03-input-validation/issues"},"dist":{"shasum":"688cc9955a75484c17bce2e1c624e908fd04f977","tarball":"https://registry.npmjs.org/@abhiram2k03/input-validation/-/input-validation-1.1.0.tgz","fileCount":5,"integrity":"sha512-UXsULfqhk3ljZ0TP+vBfGm260LC+FRJR1x/XZ/YjDXWs6e6wxRxfFIP7N/UoTNvna1Z6jQqE5FMU6e6+KPlGqg==","signatures":[{"sig":"MEQCIF8D/+FOHzv2ycE2IcmUXGDWOZAYj/xw/6SdP8d7/t4eAiB7zuRKVn9VOGv93OqjifIYuZUtRwVlCUsofu4ZSC+C9A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":18284},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"1e2b5bde7066303b77bc80826753fbb2ae8f243b","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"},"repository":{"url":"git+https://github.com/saiabhiramjaini/-abhiram2k03-input-validation.git"},"_npmVersion":"10.5.0","description":"This package provides a set of Zod schemas for validating user inputs in various authentication-related scenarios, such as sign-up, sign-in, forgot password, and reset password. It utilizes the powerful Zod library for data validation and type inference.","directories":{},"_nodeVersion":"21.7.1","dependencies":{"zod":"^3.22.4"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/input-validation_1.1.0_1712675584099_0.7277907061175413","host":"s3://npm-registry-packages"}},"1.2.0":{"name":"@abhiram2k03/input-validation","version":"1.2.0","keywords":["input","validation","zod","forms","signin","login"],"author":"","license":"MIT","_id":"@abhiram2k03/input-validation@1.2.0","maintainers":[{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"}],"homepage":"https://github.com/saiabhiramjaini/-abhiram2k03-input-validation#readme","bugs":{"url":"https://github.com/saiabhiramjaini/-abhiram2k03-input-validation/issues"},"dist":{"shasum":"6b037e4bd5ad9cdcd2dfdbd96d18ecebb0a5b77a","tarball":"https://registry.npmjs.org/@abhiram2k03/input-validation/-/input-validation-1.2.0.tgz","fileCount":5,"integrity":"sha512-WZFlJP4PsjBKoJgskkjy51dBuH0+WmdrJnJVKtBQE+18md442Y2WAvOMe+c2CiJpIpGqfeqMP0JPrqdZE3nCIA==","signatures":[{"sig":"MEYCIQC8RqKlimmTvYN6XE5beaJ+Neiu6Hqh6L4/gDzUTRN6OwIhAOW4+xJ853ADWsncw+S+e84d/12EDfa+0/hCQx3ytz8o","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":18284},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"1cda5e4992dffe024af0b37a810a9f173012be7a","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"},"repository":{"url":"git+https://github.com/saiabhiramjaini/-abhiram2k03-input-validation.git"},"_npmVersion":"10.5.0","description":"This package provides a set of Zod schemas for validating user inputs in various authentication-related scenarios, such as sign-up, sign-in, forgot password, and reset password. It utilizes the powerful Zod library for data validation and type inference.","directories":{},"_nodeVersion":"21.7.1","dependencies":{"zod":"^3.22.4"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/input-validation_1.2.0_1712676239349_0.28807930950815575","host":"s3://npm-registry-packages"}},"1.2.1":{"name":"@abhiram2k03/input-validation","version":"1.2.1","keywords":["input","validation","zod","forms","signin","login"],"author":"","license":"MIT","_id":"@abhiram2k03/input-validation@1.2.1","maintainers":[{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"}],"homepage":"https://github.com/saiabhiramjaini/-abhiram2k03-input-validation#readme","bugs":{"url":"https://github.com/saiabhiramjaini/-abhiram2k03-input-validation/issues"},"dist":{"shasum":"58a87111fb47fe5e9d58552cfa5d9c7eac44c552","tarball":"https://registry.npmjs.org/@abhiram2k03/input-validation/-/input-validation-1.2.1.tgz","fileCount":5,"integrity":"sha512-AOcQBDS1RIGS4PYT//4GaQ7fA+DoWnlL3GfvIMGzf/JFEL1UT1O8eMtDdoHcoMJSkAxSW5uL6ZerzLboyMoyHA==","signatures":[{"sig":"MEUCIGnwNikMBll/vijtSDJN1xwlgvREvc6XxCiWU6F7i6mNAiEAnn9y27AyorSwQFLtpTbvsaqthv6UzR9Komdp7kzZmTE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":18265},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"f0ec654dd31c9dc73bd71ed92e9c2c818b8bb042","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"},"repository":{"url":"git+https://github.com/saiabhiramjaini/-abhiram2k03-input-validation.git"},"_npmVersion":"10.5.0","description":"This package provides a set of Zod schemas for validating user inputs in various authentication-related scenarios, such as sign-up, sign-in, forgot password, and reset password. It utilizes the powerful Zod library for data validation and type inference.","directories":{},"_nodeVersion":"21.7.1","dependencies":{"zod":"^3.22.4"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/input-validation_1.2.1_1712682567801_0.9569695798483926","host":"s3://npm-registry-packages"}},"1.2.2":{"name":"@abhiram2k03/input-validation","version":"1.2.2","keywords":["input","validation","zod","forms","signin","login"],"author":"","license":"MIT","_id":"@abhiram2k03/input-validation@1.2.2","maintainers":[{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"}],"homepage":"https://github.com/saiabhiramjaini/-abhiram2k03-input-validation#readme","bugs":{"url":"https://github.com/saiabhiramjaini/-abhiram2k03-input-validation/issues"},"dist":{"shasum":"c209f12693ed7bf223ee8d31e6fdf0b527ea3018","tarball":"https://registry.npmjs.org/@abhiram2k03/input-validation/-/input-validation-1.2.2.tgz","fileCount":5,"integrity":"sha512-8B+uugGVRPxurfyo/NUJLGubW/sGd5U2jRYx1IHEd+53zHFzboVF0PhFx7mfyl9ke5XFJWKFWqFBXSivDlLfQg==","signatures":[{"sig":"MEYCIQCoQG+jN/FnqfIT2BgTsaM+hZH3OLqw8lnyqTPKEfxZMgIhANKMXUlzRqabNHW74RHwTKZAsad5MNzNYkH5atkhO1aD","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":18139},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"9fe9f80a44c256e2b1b2a727ce5902c60c7eb4da","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"},"repository":{"url":"git+https://github.com/saiabhiramjaini/-abhiram2k03-input-validation.git"},"_npmVersion":"10.5.0","description":"This package provides a set of Zod schemas for validating user inputs in various authentication-related scenarios, such as sign-up, sign-in, forgot password, and reset password. It utilizes the powerful Zod library for data validation and type inference.","directories":{},"_nodeVersion":"21.7.1","dependencies":{"zod":"^3.22.4"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/input-validation_1.2.2_1712683055007_0.5886945214724773","host":"s3://npm-registry-packages"}},"1.3.0":{"name":"@abhiram2k03/input-validation","version":"1.3.0","keywords":["input","validation","zod","forms","signin","login"],"author":"","license":"MIT","_id":"@abhiram2k03/input-validation@1.3.0","maintainers":[{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"}],"homepage":"https://github.com/saiabhiramjaini/-abhiram2k03-input-validation#readme","bugs":{"url":"https://github.com/saiabhiramjaini/-abhiram2k03-input-validation/issues"},"dist":{"shasum":"5ee8074262aac81b03b897ad5d148b8433a17b6b","tarball":"https://registry.npmjs.org/@abhiram2k03/input-validation/-/input-validation-1.3.0.tgz","fileCount":5,"integrity":"sha512-/hgDVxVOrzXtRORwz8/kg3sKHyR7FL/iVgDVEByoBm7PfG3fSXa8r8Aa8AeDHER39ulIX+1dO5Z5b4LQuRtRvw==","signatures":[{"sig":"MEYCIQDfgB5kV/Jdm/wh4U/qMBv/xSEF+EiK/wX9A7MLtWP4UQIhAIJH7JlqYYs1qyF56anZKkDg802a5tNL7AlUdnbukDMu","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":18139},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"7c72f1e49593bb871d173824bf19c403857d4015","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"},"repository":{"url":"git+https://github.com/saiabhiramjaini/-abhiram2k03-input-validation.git"},"_npmVersion":"10.9.0","description":"This package provides a set of Zod schemas for validating user inputs in various authentication-related scenarios, such as sign-up, sign-in, forgot password, and reset password. It utilizes the powerful Zod library for data validation and type inference.","directories":{},"_nodeVersion":"22.9.0","dependencies":{"zod":"^3.22.4"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/input-validation_1.3.0_1729104778697_0.9652186096153743","host":"s3://npm-registry-packages"}},"1.4.0":{"name":"@abhiram2k03/input-validation","version":"1.4.0","description":"This package provides a set of Zod schemas for validating user inputs in various authentication-related scenarios, such as sign-up, sign-in, forgot password, and reset password. It utilizes the powerful Zod library for data validation and type inference.","main":"dist/index.js","repository":{"url":"git+https://github.com/saiabhiramjaini/-abhiram2k03-input-validation.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["input","validation","zod","forms","signin","login"],"author":"","license":"MIT","dependencies":{"zod":"^3.22.4"},"_id":"@abhiram2k03/input-validation@1.4.0","gitHead":"7c72f1e49593bb871d173824bf19c403857d4015","types":"./dist/index.d.ts","bugs":{"url":"https://github.com/saiabhiramjaini/-abhiram2k03-input-validation/issues"},"homepage":"https://github.com/saiabhiramjaini/-abhiram2k03-input-validation#readme","_nodeVersion":"22.9.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-nGcQow+F3xUGSPiVfRmUwhFjvZG52efTPI25FwNsij1KhW1KMBM9rSt1aUBxRs8D2kGYzwn6n9j6BJnctkB9Dw==","shasum":"9618f342c4b3f679da404a80b1a1d52fc97c2fd5","tarball":"https://registry.npmjs.org/@abhiram2k03/input-validation/-/input-validation-1.4.0.tgz","fileCount":5,"unpackedSize":18625,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIACVwYWLSDQEHbecfwsRsWfHannLwfOhX4ltyheNpcQ3AiAWLTL3sD439aEs8cClDZ0lWh26HUUz21PFR3LxnQwnLw=="}]},"_npmUser":{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"},"directories":{},"maintainers":[{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/input-validation_1.4.0_1729104797993_0.21576269958502992"},"_hasShrinkwrap":false}},"time":{"created":"2024-04-05T15:57:44.337Z","modified":"2024-10-16T18:53:18.389Z","1.0.0":"2024-04-05T15:57:44.591Z","1.0.1":"2024-04-05T16:25:00.628Z","1.1.0":"2024-04-09T15:13:04.245Z","1.2.0":"2024-04-09T15:23:59.528Z","1.2.1":"2024-04-09T17:09:27.943Z","1.2.2":"2024-04-09T17:17:35.196Z","1.3.0":"2024-10-16T18:52:58.945Z","1.4.0":"2024-10-16T18:53:18.203Z"},"bugs":{"url":"https://github.com/saiabhiramjaini/-abhiram2k03-input-validation/issues"},"license":"MIT","homepage":"https://github.com/saiabhiramjaini/-abhiram2k03-input-validation#readme","keywords":["input","validation","zod","forms","signin","login"],"repository":{"url":"git+https://github.com/saiabhiramjaini/-abhiram2k03-input-validation.git"},"description":"This package provides a set of Zod schemas for validating user inputs in various authentication-related scenarios, such as sign-up, sign-in, forgot password, and reset password. It utilizes the powerful Zod library for data validation and type inference.","maintainers":[{"name":"abhiram2k03","email":"abhiramjaini28@gmail.com"}],"readme":"# Input Validation Package\n\nThis package provides a set of Zod schemas for validating user inputs in various authentication-related scenarios, such as sign-up, sign-in, forgot password, and reset password. It utilizes the powerful Zod library for data validation and type inference.\n\n## Installation\n\nTo install the package, run the following command:\n\n```\nnpm install @abhiram2k03/input-validation\n```\n\n## Usage\n\nImport the required schema and type from the package:\n\n```typescript\nimport { signupSchema, SignupInput } from '@abhiram2k03/input-validation';\n```\n\n```javascript\nconst { signupSchema, SignupInput } = require('@abhiram2k03/input-validation');\n```\n\nThen, you can use the schema to validate the input data:\n\n```typescript\n\ntry{\n  const {username, email, password, cPassword} = signupSchema.parse(req.body);\n\n  // handle the data here as required\n  \n}\ncatch (error: any) {\n  // If validation fails, return error message\n  if (error.errors && error.errors[0].message) {\n    const message = error.errors[0].message;\n    return res.json({ msg: message });\n  }\n  // For any other errors, print \"Internal Server Error\"\n  console.error(error); // Log the error for debugging purposes\n  return res.json({ msg: \"Internal Server Error\" });\n}\n```\n\nYou can use the types in the frontend as follows:\n\n```javascript\nconst [signupData, setSignupData] = useState<SignupInput>({\n  username: '',\n  email: '',\n  password: '',\n  cPassword: '',\n});\n\nconst handleSubmit = async (e: React.MouseEvent<HTMLButtonElement>) => {\n  e.preventDefault();\n  try {\n    const response = await axios.post('enter_address_here', { \n      username: signupData.username,\n      email: signupData.email,\n      password: signupData.password,\n      cPassword: signupData.cPassword\n     });\n  } catch (e) {\n    console.log(e);\n  }\n};\n\n\n<input type=\"text\"  \n  onChange={(e) => {\n    setSignupData({\n      ...signupData,\n      username: e.target.value\n    })\n  }}\n/>\n\n// similarly, all other inputs are validated \n\n```\n\n## Schemas\n\nThe package provides the following schemas:\n\n### `signupSchema`\n\nThis schema validates the sign-up input data, ensuring that the `username` is a string, `email` is a valid email address, `password` is a string with a minimum length of 8 characters, and `cPassword` (confirmation password) is a string with a minimum length of 8 characters.\n\n### `signinSchema`\n\nThis schema validates the sign-in input data, ensuring that `email` is a valid email address and `password` is a string with a minimum length of 8 characters.\n\n### `forgotPasswordSchema`\n\nThis schema validates the forgot password input data, ensuring that `email` is a valid email address.\n\n### `resetPasswordSchema`\n\nThis schema validates the reset password input data, ensuring that `password` is a string with a minimum length of 8 characters, and `cPassword` (confirmation password) is a string with a minimum length of 8 characters.\n\n## Type Inference\n\nThe package also provides type inference for each schema, allowing you to easily access the validated data types in your TypeScript code. The inferred types are:\n\n- `SignupInput`\n- `SigninInput`\n- `ForgotPasswordInput`\n- `ResetPasswordInput`\n\n## Contributing\n\nContributions to this package are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the package's GitHub repository.\n\n","readmeFilename":"readme.md"}