{"_id":"@atomic-builders/reactor","_rev":"2-c5e5581fe2000b6f9f0befa39ce1b282","name":"@atomic-builders/reactor","dist-tags":{"latest":"2.0.2"},"versions":{"2.0.0":{"name":"@atomic-builders/reactor","version":"2.0.0","description":"A basic implementation of redux like store with RxJs","author":{"name":"Alberto Basalo","email":"albertobasalo@hotmail.com","url":"https://twitter.com/albertobasalo"},"homepage":"https://github.com/AtomicBuilders/reactor#readme","repository":{"type":"git","url":"git+https://github.com/AtomicBuilders/reactor.git"},"license":"MIT","bugs":{"url":"https://github.com/AtomicBuilders/reactor/issues"},"main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","test":"jest","test:watch":"jest --watch --verbose --noStackTrace","test:coverage":"jest --coverage","format":"prettier --write \"./**/*.{ts,json}\"","lint":"eslint src --ext .ts","lint:fix":"npm run lint -- --fix","prerelease":"standard-version ","release":"git push --follow-tags origin master","prepublishOnly":"npm run build","updates":"ncu -u"},"devDependencies":{"@types/jest":"^26.0.22","@types/node":"^14.14.37","@typescript-eslint/eslint-plugin":"^4.21.0","@typescript-eslint/parser":"^4.21.0","eslint":"^7.23.0","eslint-config-prettier":"^8.1.0","eslint-plugin-jest":"^24.3.4","eslint-plugin-prettier":"^3.3.1","jest":"^26.6.3","npm-check-updates":"^11.4.1","prettier":"^2.2.1","standard-version":"^9.2.0","ts-jest":"^26.5.4","ts-node":"^9.1.1"},"dependencies":{"rxjs":"6.6.7","typescript":"^4.2.4"},"gitHead":"a6fd45619a8d9b427091c5d97ce215d84e547172","_id":"@atomic-builders/reactor@2.0.0","_nodeVersion":"14.15.4","_npmVersion":"6.14.11","dist":{"integrity":"sha512-OMc9FmFyNlFNePn+xteowVDvqjmiGr2CLDQLJIDf2GEwl3SQ5WKBchgg/o04Siqdaw+joM5UTfFoCqtX5wMOZA==","shasum":"caf7af8219b682a291bd799560c3bec5c291ed88","tarball":"https://registry.npmjs.org/@atomic-builders/reactor/-/reactor-2.0.0.tgz","fileCount":42,"unpackedSize":37909,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgcGgnCRA9TVsSAnZWagAAKiIP+QGn4nYr5xzgH5zriK82\n86snN2KPvWglNMGfVcS4PiXox59oOiqMO1C+DG17QgvQhiSES9B09BADXZAj\nKlaAlez+kxspF/Y7gutsEipjsAz36A79fS87gZegKuYOFflr2+wHD8ArFzqc\nhDqp+DIgI3jeFaE3s3RuC+d7qCvo1jFUf9gwqM/JxVpszhGwWxJLCFTRBQjT\n63D5HpxiF6D6QpLA/ELw7EU5OOibY+KXg+8sBsxQqMhw1+zLM+zaL+eyT7vI\no7huK0N56DcIcB6ESeurSo7dOkbW0GEzUZR4be3fSM1xIUl3B6nED42d8FP7\nmI+dneYnk3Pg4T4N4CTcJ7n1xlwiyc4yTP7lgtp5IO3QRyhkqwtiUYHmBh6Z\nCOq2HN79Xy9F+LpOBAlZIY5lMHHzBEVKJJwdOxzEaCvG8IgUCnhvQ3PdH91j\nHuSqKswcd+Vg1XduBvRqbjrVGxFMnE3OPFG1h93GvSGszx20EW8x0KLZiPAU\nT+bh0J5o1s4+nG+A7RsMsaE6mDz2pWupJAdTqy11/Ed5ugEg8/jrrLe32TVr\ngvioh/51n8RIqMX0G5MF7b/QAVOoU+a8/vitbN96TXQFVLZZBjRyfvvXXxQL\n4JVqlInlRpOk4ydg5CyEJtdjlMELCi4g/UHk4MQiKb+ygXXxmVzM9ywfiXA9\nVuQS\r\n=Jc/h\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDO6ruyhoSywOqjrcO2WTuhx9s2C8hbE/9iQ2341/ERvAIhAM3dhanLGFPAq9kpsK58ovmfWwz1q6NdIOsaYcCiInTU"}]},"_npmUser":{"name":"albertobasalo","email":"albertobasalo@hotmail.com"},"directories":{},"maintainers":[{"name":"albertobasalo","email":"albertobasalo@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/reactor_2.0.0_1617979430521_0.6995885869514769"},"_hasShrinkwrap":false},"2.0.2":{"name":"@atomic-builders/reactor","version":"2.0.2","description":"A basic implementation of redux like store with RxJs","author":{"name":"Alberto Basalo","email":"albertobasalo@hotmail.com","url":"https://twitter.com/albertobasalo"},"homepage":"https://github.com/AtomicBuilders/reactor#readme","repository":{"type":"git","url":"git+https://github.com/AtomicBuilders/reactor.git"},"license":"MIT","bugs":{"url":"https://github.com/AtomicBuilders/reactor/issues"},"main":"dist/index.js","types":"dist/index.d.ts","publishConfig":{"access":"public"},"scripts":{"build":"tsc -p tsconfig.json ","test":"jest","test:watch":"jest --watch --verbose --noStackTrace","test:coverage":"jest --coverage","format":"prettier --write \"./**/*.{ts,json}\"","lint":"eslint src --ext .ts","lint:fix":"npm run lint -- --fix","prerelease":"standard-version ","release":"git push --follow-tags origin master","prepublishOnly":"npm run build","updates":"ncu -u"},"devDependencies":{"@types/jest":"^26.0.22","@types/node":"^14.14.37","@typescript-eslint/eslint-plugin":"^4.21.0","@typescript-eslint/parser":"^4.21.0","eslint":"^7.23.0","eslint-config-prettier":"^8.1.0","eslint-plugin-jest":"^24.3.4","eslint-plugin-prettier":"^3.3.1","jest":"^26.6.3","npm-check-updates":"^11.4.1","prettier":"^2.2.1","standard-version":"^9.2.0","ts-jest":"^26.5.4","ts-node":"^9.1.1"},"dependencies":{"rxjs":"6.6.7","typescript":"^4.2.4"},"gitHead":"62a26c2a6b6c0b9708f26051856072e0258478dc","_id":"@atomic-builders/reactor@2.0.2","_nodeVersion":"14.15.4","_npmVersion":"6.14.11","dist":{"integrity":"sha512-Xgyyn8Sp3BDIKurwDWhDiE0GiB2zi0ROZLn0wI3CuELonDVwL4J1PsjuqIl1T6rV++piy6NwPQKXzSg3vDcYCA==","shasum":"804cbba25e8d8da60951f4f8d58ee4f0a72a5532","tarball":"https://registry.npmjs.org/@atomic-builders/reactor/-/reactor-2.0.2.tgz","fileCount":12,"unpackedSize":15818,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgcJA7CRA9TVsSAnZWagAAfxsP/RJhQTyq7rylW8Eet5j0\nWUB1CAG6XqmigXuYUf21GnPLFxrVK9PYf+Ch73DUXr1AFakOnikWMdzzccrQ\nbZRuS+xMg5JNIgypGmfDbix2Tx+usmBYgXcKtU+RJ+ZvPlhA9Ctuhuzvj0bY\nlSTgKuwPC86cxnS0MPi5NBQQK9XZ2qbTuL+mr4HkUIIz3A/e5jIQv+670yNg\ncfuFF8WrNcdXGJwC23TrAmm+4E6u4FVGC+qlnXpSxz2M98sK1RODN4WTcGIv\nQOIGqB0ibbjbpS7j/1CS+a3EoZNvBLcmtx0JVxHRF8OhcilGc8nknu3DzDNL\nIq2yASQhi7JEGS5DDYDrw57F9xgFrW0C907z6kJM9vOJxMNu+mdaonUEuOot\n6oQAGJaCpVMdtfHPn1nlt8FmHoexVPKg0ov+2Ag8axRpvc4YTaBx5+NaNz2h\nP7tTOwdW/kGh6/n6IqBk9QKsYg9tW4YvEWFw3GfISOtzOmWOZHcuyMGsJZ7U\nmu+2a/8opcc4hmpN6Js5ds7Bv/6LnNb2qjawXDTF5+H7Yr6m+CJeFpQQlQkN\n3xBzdkWl0CktzSwbPsfcHNTWZF+o5+V5VPARtCccRJ964KkYEfgC+kmORXOk\nB1cC5UAbngZ9L/LxxsQZUYuEU7XqC8lggHzdGZmUrXgqKN8BhKrB94MLJkdz\nk+gM\r\n=rlBS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICc87DE2HAif/VVpgVQYahUg7wZfYVw6rEnKcvjM7U07AiEArIhcmh7bJOoANsw+CGhsNq75dCeOS2Vs1hOz3z3oBqs="}]},"_npmUser":{"name":"albertobasalo","email":"albertobasalo@hotmail.com"},"directories":{},"maintainers":[{"name":"albertobasalo","email":"albertobasalo@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/reactor_2.0.2_1617989690801_0.20896613396755348"},"_hasShrinkwrap":false}},"time":{"created":"2021-04-09T14:43:50.244Z","2.0.0":"2021-04-09T14:43:50.807Z","modified":"2022-04-04T16:14:36.083Z","2.0.2":"2021-04-09T17:34:50.977Z"},"maintainers":[{"name":"albertobasalo","email":"albertobasalo@hotmail.com"}],"description":"A basic implementation of redux like store with RxJs","homepage":"https://github.com/AtomicBuilders/reactor#readme","repository":{"type":"git","url":"git+https://github.com/AtomicBuilders/reactor.git"},"author":{"name":"Alberto Basalo","email":"albertobasalo@hotmail.com","url":"https://twitter.com/albertobasalo"},"bugs":{"url":"https://github.com/AtomicBuilders/reactor/issues"},"license":"MIT","readme":"[![npm (scoped)](https://img.shields.io/npm/v/@atomic.builders/reactor)](https://www.npmjs.com/package/@atomic-builders/reactor)\r\n\r\n# ☢ Reactor\r\n\r\n## Reactive-store\r\n\r\nBasic _minimalistic REDUX_ made with RxJs\r\n\r\n> Production ready **observable state management**\r\n\r\n## 🎯 Motivation\r\n\r\n✅ Avoid the use of heavy and complex libraries like _NgRX_\r\n\r\n✅ Less than 100 lines [store.ts](https://github.com/AtomicBuilders/reactor/blob/master/src/store.ts)\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm i @atomic.builders/reactor\r\n```\r\n\r\n## ✨ Sample use\r\n\r\n```typescript\r\nconst initialBasket: Basket = { client: '', items: [], status: '' };\r\nconst basket$ = new Store<Basket>(initialBasket);\r\n\r\n// BASIC USAGE\r\n// get snapshot\r\nconst currentBasket: Basket = basket$.getState();\r\nconsole.log(currentBasket);\r\n// observe changes\r\nbasket$.getState$().subscribe({\r\n  next: basket => console.log({ basket }),\r\n});\r\n// observe selected changes\r\nbasket$\r\n  .select$(basket => basket.status)\r\n  .subscribe({\r\n    next: status => console.log({ status }),\r\n  });\r\n// setting direct state\r\nbasket$.setState({ client: '', items: [], status: 'EMPTY' });\r\n\r\n// WHITH ACTIONS\r\n// observe actions\r\nbasket$.getActions$().subscribe({\r\n  next: action => console.log({ action }),\r\n});\r\n// dispatch simple action\r\nconst setClientAction: Action<Basket> = new Action<Basket>('SET_CLIENT', {\r\n  client: 'John Doe',\r\n  status: 'EMPTY',\r\n});\r\nbasket$.dispatch(setClientAction);\r\n\r\n// WITH A REDUCER\r\n// dispatch action with payload and reducer\r\nconst itemPayload: Item = {\r\n  name: 'An ACME thing',\r\n  units: 19,\r\n  unitPrice: 71,\r\n};\r\nconst addItemReducer = (basket: Basket, payload: unknown) => {\r\n  basket.items = [...basket.items, payload as Item];\r\n  basket.status = 'FILLED';\r\n  return basket;\r\n};\r\nconst addItemAction: Action<Basket> = new Action<Basket>('ADD_ITEM', itemPayload, addItemReducer);\r\nbasket$.dispatch(addItemAction);\r\n```\r\n\r\n## ⚙ Workflows\r\n\r\n### 👨‍💻 Dev Workflow\r\n\r\nWhile developing, make sure to install the recommended extensions for a better dev experience.\r\n\r\nRun `npm run test:watch` it will run test after each change. Ideal for TDD or testing just in time.\r\n\r\nRun `npm run test` it will run all test once and stops. Default for CI/CD most common environments.\r\n\r\nIf you want also the coverage report then use `npm run test:coverage` .\r\n\r\n## 🛠 Tools\r\n\r\n### 📦 Commits and release\r\n\r\n- Use [standard-version](https://www.npmjs.com/package/standard-version) to produce a changelog file from [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)\r\n\r\n### 💅 Code style with Prettier\r\n\r\n- Installed and configured prettier\r\n\r\n> Recommended [prettier extension](https://github.com/prettier/prettier-vscode)\r\n\r\n### 📐 Code linting with esLint\r\n\r\n- Installed and configured eslint to work with prettier\r\n\r\n> Recommended [esLint extension](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)\r\n\r\n### 🧪 Code tested with Jest\r\n\r\n- Installed and configured **jest** to run specs\r\n- Configured to conform with **eslint**\r\n- Uses `ts-jest` to work natively with **TypeScript**\r\n\r\n## 👨 Created by Alberto Basalo\r\n\r\n> [@albertobasalo](https://twitter.com/albertobasalo)\r\n","readmeFilename":"README.md"}