{"_id":"@parkhub/circe-validate-topic","_rev":"51-12aa92a248cb93ca4ea0ee70476a59ed","name":"@parkhub/circe-validate-topic","dist-tags":{"latest":"2.1.0"},"versions":{"1.0.0":{"name":"@parkhub/circe-validate-topic","version":"1.0.0","author":{"name":"Daniel Olivares"},"_id":"@parkhub/circe-validate-topic@1.0.0","maintainers":[{"name":"sirmyztiq","email":"fuzzoli87@gmail.com"}],"homepage":"https://github.com/parkhub/circe-validate-topic#readme","bugs":{"url":"https://github.com/parkhub/circe-validate-topic/issues"},"dist":{"shasum":"cbb23f7c7df7f4ec03e5610d119ed41eb89b6bbd","tarball":"https://registry.npmjs.org/@parkhub/circe-validate-topic/-/circe-validate-topic-1.0.0.tgz","integrity":"sha512-GmHdEgDhmgtlw3RCxJijoa32Y7sKst48/GNMSn2oBZvAVxCTES6te/j94quW3HGkzfvLXTcSh8HWz1B/n3YHVw==","signatures":[{"sig":"MEUCIQC9nhWakML/vhUQTVTsDxvJHEiE3xMTxGQUpGyaMkgWHAIgf/j+6piidvEoJQCRHmGX8TyXyAB2cTm221Q6Ts8aOLA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"jest":{"verbose":true,"testMatch":["**/src/**/?(*.)test.js?(x)"],"collectCoverage":true,"coverageThreshold":{"global":{"lines":100,"branches":100,"functions":100,"statements":100}},"modulePathIgnorePatterns":["dist/*"],"coveragePathIgnorePatterns":["/node_modules/","/dist/"]},"main":"dist/index.js","files":["dist"],"config":{"commitizen":{"path":"cz-conventional-changelog"}},"engines":{"npm":">=3","node":">=8.0.0"},"gitHead":"5d5132b51f35543a6312adad896c4109c9c08fcb","release":{"debug":false,"verifyConditions":"condition-codefresh"},"scripts":{"start":"nps","commitmsg":"opt --in commit-msg --exec \"validate-commit-msg\"","precommit":"opt --in pre-commit --exec \"npm start validate\""},"_npmUser":{"name":"sirmyztiq","email":"fuzzoli87@gmail.com"},"repository":{"url":"git+https://github.com/parkhub/circe-validate-topic.git","type":"git"},"_npmVersion":"5.3.0","description":"A middleware that validates Kafka topic's messages for Circe.","directories":{},"_nodeVersion":"8.4.0","publishConfig":{"access":"public"},"devDependencies":{"nps":"^5.7.1","jest":"^20.0.4","husky":"^0.14.3","eslint":"^4.5.0","leasot":"^4.10.1","rimraf":"^2.6.1","codecov":"^2.3.0","opt-cli":"^1.5.2","flow-bin":"^0.54.0","babel-cli":"^6.26.0","nps-utils":"^1.3.0","babel-jest":"^20.0.3","commitizen":"^2.9.6","flow-typed":"^2.1.5","babel-eslint":"^7.2.3","documentation":"^5.2.2","are-we-flow-yet":"^1.0.0","babel-preset-env":"^1.6.0","flow-copy-source":"^1.2.1","semantic-release":"^7.0.2","babel-preset-flow":"^6.23.0","flow-remove-types":"^1.2.1","eslint-plugin-jest":"^20.0.3","condition-codefresh":"^1.0.1","eslint-plugin-babel":"^4.1.2","prettier-eslint-cli":"^4.3.0","validate-commit-msg":"^2.14.0","eslint-plugin-import":"^2.7.0","eslint-plugin-flowtype":"^2.35.1","cz-conventional-changelog":"^2.0.0","eslint-config-airbnb-base":"^11.3.2","babel-plugin-transform-strict-mode":"^6.24.1","@parkhub/eslint-config-parkhub-base":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/circe-validate-topic-1.0.0.tgz_1504638078991_0.687887794803828","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"@parkhub/circe-validate-topic","version":"2.0.0","author":{"name":"Daniel Olivares"},"_id":"@parkhub/circe-validate-topic@2.0.0","maintainers":[{"name":"bfletcherbiggs","email":"bfletcherbiggs@gmail.com"},{"name":"ggellene","email":"greg.gellene@gmail.com"},{"name":"sirmyztiq","email":"fuzzoli87@gmail.com"},{"name":"jonsenterfitt","email":"jon.senterfitt@parkhub.com"},{"name":"thetwosents","email":"jon@belfortagency.com"},{"name":"loganbfisher","email":"logan@themediaside.com"},{"name":"realtschoegl","email":"matt.tschoegl@parkhub.com"}],"homepage":"https://github.com/parkhub/circe-validate-topic#readme","bugs":{"url":"https://github.com/parkhub/circe-validate-topic/issues"},"dist":{"shasum":"4351b75d1d9c513ec3db86b0cd44100c840a3819","tarball":"https://registry.npmjs.org/@parkhub/circe-validate-topic/-/circe-validate-topic-2.0.0.tgz","integrity":"sha512-zMS9Sp+8eEmVGCIA8GL5RnKbKyECOwTgl/LKIXQbQejYhFp32UKqymemWrr7gRneJpgWxnQyFDXqAIify9EkAQ==","signatures":[{"sig":"MEUCIQCX3b8mfXTnvTn+BZRC5ZXkuK7xz0lL02ubKhDLYjuW6gIgPakwootc/XNtWHgi0cY9f1hel0Rf2VpPzKD7wSNWizM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"jest":{"verbose":true,"testMatch":["**/src/**/?(*.)test.js?(x)"],"collectCoverage":true,"coverageThreshold":{"global":{"lines":100,"branches":100,"functions":100,"statements":100}},"modulePathIgnorePatterns":["dist/*"],"coveragePathIgnorePatterns":["/node_modules/","/dist/"]},"main":"dist/index.js","files":["dist"],"config":{"commitizen":{"path":"cz-conventional-changelog"}},"engines":{"npm":">=3","node":">=8.0.0"},"gitHead":"5d5132b51f35543a6312adad896c4109c9c08fcb","release":{"debug":false,"verifyConditions":"condition-codefresh"},"scripts":{"start":"nps","commitmsg":"opt --in commit-msg --exec \"validate-commit-msg\"","precommit":"opt --in pre-commit --exec \"npm start validate\""},"_npmUser":{"name":"sirmyztiq","email":"fuzzoli87@gmail.com"},"repository":{"url":"git+https://github.com/parkhub/circe-validate-topic.git","type":"git"},"_npmVersion":"5.4.1","description":"A middleware that validates Kafka topic's messages for Circe.","directories":{},"_nodeVersion":"8.5.0","publishConfig":{"access":"public"},"devDependencies":{"nps":"^5.7.1","jest":"^20.0.4","husky":"^0.14.3","eslint":"^4.5.0","leasot":"^4.10.1","rimraf":"^2.6.1","codecov":"^2.3.0","opt-cli":"^1.5.2","flow-bin":"^0.54.0","babel-cli":"^6.26.0","nps-utils":"^1.3.0","babel-jest":"^20.0.3","commitizen":"^2.9.6","flow-typed":"^2.1.5","babel-eslint":"^7.2.3","documentation":"^5.2.2","are-we-flow-yet":"^1.0.0","babel-preset-env":"^1.6.0","flow-copy-source":"^1.2.1","semantic-release":"^7.0.2","babel-preset-flow":"^6.23.0","flow-remove-types":"^1.2.1","eslint-plugin-jest":"^20.0.3","condition-codefresh":"^1.0.1","eslint-plugin-babel":"^4.1.2","prettier-eslint-cli":"^4.3.0","validate-commit-msg":"^2.14.0","eslint-plugin-import":"^2.7.0","eslint-plugin-flowtype":"^2.35.1","cz-conventional-changelog":"^2.0.0","eslint-config-airbnb-base":"^11.3.2","babel-plugin-transform-strict-mode":"^6.24.1","@parkhub/eslint-config-parkhub-base":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/circe-validate-topic-2.0.0.tgz_1506019000328_0.7204523014370352","host":"s3://npm-registry-packages"}},"2.1.0":{"name":"@parkhub/circe-validate-topic","version":"2.1.0","author":{"name":"Daniel Olivares"},"_id":"@parkhub/circe-validate-topic@2.1.0","maintainers":[{"name":"bfletcherbiggs","email":"bfletcherbiggs@gmail.com"},{"name":"ggellene","email":"greg.gellene@gmail.com"},{"name":"sirmyztiq","email":"fuzzoli87@gmail.com"},{"name":"jonsenterfitt","email":"jon.senterfitt@parkhub.com"},{"name":"thetwosents","email":"jon@belfortagency.com"},{"name":"loganbfisher","email":"logan@themediaside.com"},{"name":"realtschoegl","email":"matt.tschoegl@parkhub.com"}],"homepage":"https://github.com/parkhub/circe-validate-topic#readme","bugs":{"url":"https://github.com/parkhub/circe-validate-topic/issues"},"dist":{"shasum":"fed70e612a37db7cfb22e5db9d435dea5a8fee00","tarball":"https://registry.npmjs.org/@parkhub/circe-validate-topic/-/circe-validate-topic-2.1.0.tgz","integrity":"sha512-GAO1tMtLgWJXtTZoocJgKO+9ngmGbYMRnjaJxhCGb4SWMGbR5YsetuKRSz45lKauDMCHZQVW5r8oWg/FTyvl+A==","signatures":[{"sig":"MEUCIB9BH9NKXvkptau8TvOax+SWzZwFSpgeV/maOumnf8iRAiEAoWSrWc4tX0/S+NdtJY/0DaownBtmK2DXBrq0Vjt+atY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"jest":{"verbose":true,"testMatch":["**/src/**/?(*.)test.js?(x)"],"collectCoverage":true,"coverageThreshold":{"global":{"lines":100,"branches":100,"functions":100,"statements":100}},"modulePathIgnorePatterns":["dist/*"],"coveragePathIgnorePatterns":["/node_modules/","/dist/"]},"main":"dist/index.js","files":["dist"],"config":{"commitizen":{"path":"cz-conventional-changelog"}},"engines":{"npm":">=3","node":">=8.0.0"},"gitHead":"1fbc9e722bb30cc189824417c43f1115040647c7","release":{"debug":false,"verifyConditions":"condition-codefresh"},"scripts":{"start":"nps","commitmsg":"opt --in commit-msg --exec \"validate-commit-msg\"","precommit":"opt --in pre-commit --exec \"npm start validate\""},"_npmUser":{"name":"sirmyztiq","email":"fuzzoli87@gmail.com"},"repository":{"url":"git+https://github.com/parkhub/circe-validate-topic.git","type":"git"},"_npmVersion":"5.4.1","description":"A middleware factory. The function validates topics against specified validate methods. It also gives you the option to short-circuit a middleware chain.","directories":{},"_nodeVersion":"8.5.0","publishConfig":{"access":"public"},"devDependencies":{"nps":"^5.7.1","jest":"^21.1.0","husky":"^0.14.3","eslint":"^4.7.1","leasot":"^4.10.1","rimraf":"^2.6.2","codecov":"^2.3.0","opt-cli":"^1.5.2","flow-bin":"^0.55.0","babel-cli":"^6.26.0","nps-utils":"^1.3.0","babel-jest":"^21.0.2","commitizen":"^2.9.6","flow-typed":"^2.1.5","babel-eslint":"^8.0.0","documentation":"^5.3.2","are-we-flow-yet":"^1.0.0","babel-preset-env":"^1.6.0","flow-copy-source":"^1.2.1","semantic-release":"^8.0.0","babel-preset-flow":"^6.23.0","flow-remove-types":"^1.2.1","eslint-plugin-jest":"^21.1.0","condition-codefresh":"^1.0.1","eslint-plugin-babel":"^4.1.2","prettier-eslint-cli":"^4.3.2","validate-commit-msg":"^2.14.0","eslint-plugin-import":"^2.7.0","eslint-plugin-flowtype":"^2.35.1","cz-conventional-changelog":"^2.0.0","eslint-config-airbnb-base":"^12.0.0","babel-plugin-transform-strict-mode":"^6.24.1","@parkhub/eslint-config-parkhub-base":"^1.2.0"},"_npmOperationalInternal":{"tmp":"tmp/circe-validate-topic-2.1.0.tgz_1506019305575_0.8742838290054351","host":"s3://npm-registry-packages"}}},"time":{"created":"2017-09-05T19:01:19.922Z","modified":"2026-09-21T18:05:26.976Z","1.0.0":"2017-09-05T19:01:19.922Z","2.0.0":"2017-09-21T18:36:41.294Z","2.1.0":"2017-09-21T18:41:46.585Z"},"bugs":{"url":"https://github.com/parkhub/circe-validate-topic/issues"},"author":{"name":"Daniel Olivares"},"homepage":"https://github.com/parkhub/circe-validate-topic#readme","repository":{"url":"git+https://github.com/parkhub/circe-validate-topic.git","type":"git"},"description":"A middleware factory. The function validates topics against specified validate methods. It also gives you the option to short-circuit a middleware chain.","maintainers":[{"email":"daytonpe14@gmail.com","name":"daytonpe"},{"email":"matt.tschoegl@parkhub.com","name":"realtschoegl"},{"email":"alexander.cauble@gmail.com","name":"accloudcoder"},{"email":"jbrooks02@gmail.com","name":"novym"},{"email":"jebenavidez@outlook.com","name":"justin-ben"},{"email":"thiel.talicuran@parkhub.com","name":"thielt"},{"email":"stephen.emerson@parkhub.com","name":"stephemer"},{"email":"nathaniel.brown@parkhub.com","name":"nathaniel.brown"},{"email":"austin.lewis@justpark.com","name":"austin.lewis.justpark"},{"email":"landon.parris@justpark.com","name":"landon.parris"},{"email":"zoe.chamlee@parkhub.com","name":"zchamlee"},{"email":"joni@bek.io","name":"honi"},{"email":"colinc86@gmail.com","name":"electrocampbell"},{"email":"josh.boyle@justpark.com","name":"joshaboyle"},{"email":"loumonth.jack@justpark.com","name":"loumonth.jack"},{"email":"david.yang@justpark.com","name":"davidyang.justpark"},{"email":"dylan.delarosa@justpark.com","name":"delarosadyljp"},{"email":"rj.ellazar@justpark.com","name":"rjellazar"},{"email":"jack.anthony.wall@gmail.com","name":"j4k"},{"email":"hannah.ismail@parkhub.com","name":"hannahi771"},{"email":"jason@jasonlusk.com","name":"mpalpha"},{"email":"shane.frykholm@justpark.com","name":"mrshanef"}],"readme":"# Circe Validate Topic\n\nA middleware factory. The function validates topics against specified validate methods. It also\ngives you the option to short-circuit a middleware chain.\n\n[![Build Status][build-badge]][build]\n[![Code Coverage][coverage-badge]][coverage]\n[![Dependencies][dependencyci-badge]][dependencyci]\n[![version][version-badge]][package]\n[![Apache License][license-badge]][LICENSE]\n[![PRs Welcome][prs-badge]][prs]\n[![Roadmap][roadmap-badge]][roadmap]\n[![Semantic Release][semantic-release-badge]][sem-release-badge]\n[![Commitizen][commitizen-friendly-badge]][comm-friendly-badge]\n\n\n[![Watch on GitHub][github-watch-badge]][github-watch]\n[![Star on GitHub][github-star-badge]][github-star]\n[![Tweet][twitter-badge]][twitter]\n\n## Install\n```bash\nnpm install @parkhub/circe-validate-topic\n```\n\n## Usage\nA factory that generates a middleware function to be used with [circe-middleware]\n\n```javascript\nimport validateTopic from '@parkhub/circe-validate-topic';\n\nconst validators = [\n  {\n    topic: 'AKAME',\n    validate: message => console.log('VALIDATING MESSAGE', message),\n    onInvalid: ({ topic, originalValue, reason }) =>\n      console.log('DO YOUR THING', { topic, originalValue, reason })\n  }\n];\n\nconst onTopicValidatorNotFound = ({ topic, originalValue, reason }) =>\n  console.log('DO YOUR OTHER THING', { topic, originalValue, reason });\n\nconst validateCfgs = {\n  validators,\n  onTopicValidatorNotFound\n};\n\n// USE THIS IN CIRCE!\nconst validateMiddleware = validateTopic(validateCfgs);\n\ncirce.use(validateMiddleware);\n\n```\n\n## Global Types\n**ErrorHandler** A function that takes an object with the following properties\n\n - **topic(String)** The topic that is associated with this error\n - **originalValue(Object)** The FULL object passed into the validator middleware(**valueToValidate**) This is usually the kafka parameters associated with either a **Producer's publish parameters** or a **Consumer's handler message format**(see [circe])\n - **reason(String)** The reason generated by the validator as to why this failed\n\t\n## API\n\n**validateTopic({ validators, onTopicValidatorNotFound })** The factory function that will create a middleware function. \n\n - **validators(validatorCfg[], REQUIRED)**\n\t - **validatorCfg(Object)**\n\t\t - **topic** The topic to validate\n\t\t - **validate(Function, REQUIRED)** The function to pass the message to validate to. This function SHOULD to return an object with the following properties:\n\t\t\t - **isValid(Boolean, REQUIRED)** Did this message pass validation\n\t\t\t - **reason(String, optional)** Reason why this failed\n\t\t - **onInvalid(Function, optional)** A function that should accept an **ErrorHandler** type . When this function is called, it effectively short-circuits the middleware chain.\n -  **onTopicValidatorNotFound(Function, optional)** A function that accepts an **ErrorHandler** type. This is called when a topic message is received for a topic that is not configured to be validated. When this is called, it effectively short-circuits the middleware chain.\n\t\n\t\t\n**Returns** a function with the signature:\n\n - **function (valueToValidate, next)**\n\t - **valueToValidate(Object, REQUIRED)** This object can be an object with any properties, but it must contain:\n\t\t - **topic(String, REQUIRED)** The topic to validate\n\t\t - **message(Object | String, REQUIRED)** The message to validate\n\t - **next** The function injected by [circe-middleware]\n\n**Next call** When a validation passes, it passes the full **valueToValidate** object to the next middleware.\n\t\t\t\n### Caveats\nBoth the **onTopicValidatorNotFound** and the **onValid** configurations are optional but **BOTH** have a default handler that **THROWS ERRORS** \n\n\n[semantic-release-badge]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n[sem-release-badge]: https://github.com/semantic-release/semantic-release\n[build-badge]:  https://g.codefresh.io/api/badges/build?repoOwner=parkhub&repoName=circe-validate-topic&branch=master&pipelineName=circe-validate-topic&accountName=loganbfisher&type=cf-1\n[build]:  https://g.codefresh.io/repositories/parkhub/circe-validate-topic/builds?filter=trigger:build;branch:master;service:59821c960ae1710001fef83c~circe-validate-topic\n[coverage-badge]: https://img.shields.io/codecov/c/github/parkhub/circe-validate-topic.svg?style=flat-square\n[coverage]: https://codecov.io/gh/parkhub/circe-validate-topic\n[dependencyci-badge]: https://dependencyci.com/github/parkhub/circe-validate-topic/badge?style=flat-square\n[dependencyci]: https://dependencyci.com/github/parkhub/circe-validate-topic\n[version-badge]: https://img.shields.io/npm/v/@parkhub/circe-validate-topic.svg?style=flat-square\n[package]: https://www.npmjs.com/package/@parkhub/circe-validate-topic\n[license-badge]: https://img.shields.io/npm/l/@parkhub/circe-validate-topic.svg?style=flat-square\n[license]: https://github.com/parkhub/circe-validate-topic/blob/master/LICENSE\n[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square\n[prs]: http://makeapullrequest.com\n[roadmap-badge]: https://img.shields.io/badge/%F0%9F%93%94-roadmap-CD9523.svg?style=flat-square\n[roadmap]: https://github.com/parkhub/circe-validate-topic/blob/master/ROADMAP.md\n[github-watch-badge]: https://img.shields.io/github/watchers/parkhub/circe-validate-topic.svg?style=social\n[github-watch]: https://github.com/parkhub/circe-validate-topic/watchers\n[github-star-badge]: https://img.shields.io/github/stars/parkhub/circe-validate-topic.svg?style=social\n[github-star]: https://github.com/parkhub/circe-validate-topic/stargazers\n[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20prettier-eslint-cli!%20https://github.com/parkhub/circe-validate-topic%20%F0%9F%91%8D\n[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/parkhub/circe-validate-topic.svg?style=social\n[semantic-release]: https://github.com/semantic-release/semantic-release\n[commitizen-friendly-badge]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg\n[comm-friendly-badge]: http://commitizen.github.io/cz-cli/\n[circe-middleware]: https://github.com/parkhub/circe-middleware\n[circe]: https://github.com/parkhub/circe\n","readmeFilename":"README.md"}