{"_id":"@conveyorhq/robodux","_rev":"2-a5a04b47a97acb36f2dfe8814f4b5ac6","name":"@conveyorhq/robodux","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@conveyorhq/robodux","version":"1.0.0","main":"./dist/index.js","types":"./dist/index.d.ts","license":"MIT","description":"reduce redux boilerplate","author":{"name":"Eric Bower"},"repository":{"type":"git","url":"git+https://github.com/conveyor/robodux.git"},"scripts":{"build":"tsc","tc":"typings-checker --allow-expect-error --project tsconfig.json type-tests/*.ts","test":"tsc && yarn tc && jest","prepublish":"yarn build","precommit":"lint-staged","prettier-js":"prettier --write src/**/*.ts","prettier-md":"prettier --config prettier.md.js --write *.md docs/*.md","format":"yarn prettier-js && yarn prettier-md"},"dependencies":{"immer":"^9.0.7","redux-batched-actions":"npm:@conveyorhq/redux-batched-actions@0.5.0"},"peerDependencies":{"react":"^17.0.2","react-dom":"^17.0.2","react-redux":">=7.0.0","redux":">=4.0.4","reselect":">=4.0.0"},"peerDependenciesMeta":{"react":{"optional":true},"react-redux":{"optional":true},"react-dom":{"optional":true}},"devDependencies":{"@babel/core":"^7.0.0-0","@babel/runtime":"^7.6.3","@types/deep-freeze-strict":"^1.1.0","@types/jest":"^27.0.3","@types/node":"^12.7.5","babel-core":"^6.0.0 || ^7.0.0-0","babel-jest":"^27.4.5","deep-freeze-strict":"^1.1.1","husky":"^0.14.3","jest":"^27.4.5","lint-staged":"^7.2.0","prettier":"^2.5.1","react":"^17.0.2","react-dom":"^17.0.2","react-redux":"^7.2.6","redux":"^4.0.4","redux-thunk":"^2.3.0","reselect":"^4.0.0","ts-jest":"^27.1.2","typescript":"^4.1.5","typings-checker":"^2.0.0"},"lint-staged":{"*.{js}":["prettier --write","git add"],"*.{md}":["prettier --config prettier.md.js --write","git add"]},"licenseText":"# The MIT License (MIT)\n\nCopyright © `2018` `Eric Bower`\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the “Software”), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@conveyorhq/robodux@1.0.0","dist":{"shasum":"a4adc591faf88852ccf3fe56a5827bcfb9015ec5","integrity":"sha512-9XA9zz7mYb7dgIQwggy2HUa6NEH5YyMLxAvsB0T6f+cCtm0oI/QgSAXHSUsnqPtGdNerGbvsPhONhuYFu3pCVA==","tarball":"https://registry.npmjs.org/@conveyorhq/robodux/-/robodux-1.0.0.tgz","fileCount":140,"unpackedSize":305861,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGtAqfaeSIVaGH1VGHJrriZf7DiYvvdtDVQxT0QA3xdDAiEApUfLWFhfr20QhgBgSxaYjocbVyJJ8MGgeg/hne04BaM="}]},"_npmUser":{"name":"conveyorhq-eng","email":"engineering@conveyorhq.com"},"directories":{},"maintainers":[{"name":"conveyorhq-eng","email":"engineering@conveyorhq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/robodux_1.0.0_1704466613141_0.7757920965069358"},"_hasShrinkwrap":false},"1.0.1":{"name":"@conveyorhq/robodux","version":"1.0.1","main":"./dist/index.js","types":"./dist/index.d.ts","license":"MIT","description":"reduce redux boilerplate","author":{"name":"Eric Bower"},"repository":{"type":"git","url":"git+https://github.com/conveyor/robodux.git"},"scripts":{"build":"tsc","tc":"typings-checker --allow-expect-error --project tsconfig.json type-tests/*.ts","test":"tsc && yarn tc && jest","prepublish":"yarn build","precommit":"lint-staged","prettier-js":"prettier --write src/**/*.ts","prettier-md":"prettier --config prettier.md.js --write *.md docs/*.md","format":"yarn prettier-js && yarn prettier-md"},"dependencies":{"immer":"^9.0.7","redux-batched-actions":"npm:@conveyorhq/redux-batched-actions@0.5.0"},"peerDependencies":{"react":"^17.0.2","react-dom":"^17.0.2","react-redux":">=7.0.0","redux":">=4.0.4","reselect":">=4.0.0"},"peerDependenciesMeta":{"react":{"optional":true},"react-redux":{"optional":true},"react-dom":{"optional":true}},"devDependencies":{"@babel/core":"^7.0.0-0","@babel/runtime":"^7.6.3","@types/deep-freeze-strict":"^1.1.0","@types/jest":"^27.0.3","@types/node":"^12.7.5","babel-core":"^6.0.0 || ^7.0.0-0","babel-jest":"^27.4.5","deep-freeze-strict":"^1.1.1","husky":"^0.14.3","jest":"^27.4.5","lint-staged":"^7.2.0","prettier":"^2.5.1","react":"^17.0.2","react-dom":"^17.0.2","react-redux":"^7.2.6","redux":"^4.0.4","redux-thunk":"^2.3.0","reselect":"^4.0.0","ts-jest":"^27.1.2","typescript":"^4.1.5","typings-checker":"^2.0.0"},"lint-staged":{"*.{js}":["prettier --write","git add"],"*.{md}":["prettier --config prettier.md.js --write","git add"]},"licenseText":"# The MIT License (MIT)\n\nCopyright © `2018` `Eric Bower`\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the “Software”), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@conveyorhq/robodux@1.0.1","dist":{"shasum":"9a825bea3719b20a2e8a511c3c713f7dbe6ac8fe","integrity":"sha512-o7TjVcaJP+DDYIdS2vayodLomEqpTzMKmkIj4vcjnyQ6O8DNvkbTrm0jVEDGK5QhwzJEFQ8RtuJ7O6Sr7EEZfg==","tarball":"https://registry.npmjs.org/@conveyorhq/robodux/-/robodux-1.0.1.tgz","fileCount":140,"unpackedSize":305848,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCs63SaWUylRn04SoVdWEzc69K/qwcSvDJOPqDzP7JRagIgaaG9oXuyjPmjwpVtABU+xwaaeX8zkpI4dcOiJbJrnAc="}]},"_npmUser":{"name":"conveyorhq-eng","email":"engineering@conveyorhq.com"},"directories":{},"maintainers":[{"name":"conveyorhq-eng","email":"engineering@conveyorhq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/robodux_1.0.1_1704466821443_0.4153829249663368"},"_hasShrinkwrap":false},"1.0.2":{"name":"@conveyorhq/robodux","version":"1.0.2","main":"./dist/index.js","types":"./dist/index.d.ts","license":"MIT","description":"reduce redux boilerplate","author":{"name":"Eric Bower"},"repository":{"type":"git","url":"git+https://github.com/conveyor/robodux.git"},"scripts":{"build":"tsc","tc":"typings-checker --allow-expect-error --project tsconfig.json type-tests/*.ts","test":"tsc && yarn tc && jest","prepublish":"yarn build","precommit":"lint-staged","prettier-js":"prettier --write src/*.ts","prettier-md":"prettier --config prettier.md.js --write *.md docs/*.md","format":"yarn prettier-js && yarn prettier-md"},"dependencies":{},"peerDependencies":{"immer":">=4.0.0","redux":">=4.0.4","reselect":">=4.0.0"},"devDependencies":{"@babel/core":"^7.0.0-0","@babel/runtime":"^7.6.3","@types/deep-freeze-strict":"^1.1.0","@types/jest":"^26.0.20","@types/node":"^12.7.5","babel-core":"^6.0.0 || ^7.0.0-0","babel-jest":"^26.6.3","deep-freeze-strict":"^1.1.1","husky":"^0.14.3","immer":"^8.0.1","jest":"^26.6.3","lint-staged":"^7.2.0","prettier":"^1.18.2","redux":"^4.0.4","redux-thunk":"^2.3.0","reselect":"^4.0.0","ts-jest":"^26.5.1","typescript":"^4.1.5","typings-checker":"^2.0.0"},"lint-staged":{"*.{js}":["prettier --write","git add"],"*.{md}":["prettier --config prettier.md.js --write","git add"]},"licenseText":"# The MIT License (MIT)\n\nCopyright © `2018` `Eric Bower`\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the “Software”), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","_id":"@conveyorhq/robodux@1.0.2","dist":{"shasum":"0ce76ff5d281522670297b2454d14c127a91fc64","integrity":"sha512-GMGGYlbN8oUB/FJwMY8oTM72hmNrFq5jJUf9PfRtZ1DixBgfrpNjHlG7w00i4ThYy15SrWyShjdHeV167M7/tQ==","tarball":"https://registry.npmjs.org/@conveyorhq/robodux/-/robodux-1.0.2.tgz","fileCount":124,"unpackedSize":245275,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD/6gobu6G1cMV0vTauYW102eJmBqQmePQHZsdaUGtL4QIhAJD5bmmK23L5EUY5OSH4Q49w0nagXYHgwQlykTGChkia"}]},"_npmUser":{"name":"conveyorhq-eng","email":"engineering@conveyorhq.com"},"directories":{},"maintainers":[{"name":"conveyorhq-eng","email":"engineering@conveyorhq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/robodux_1.0.2_1704467034748_0.34604492371514595"},"_hasShrinkwrap":false}},"time":{"created":"2024-01-05T14:56:53.028Z","1.0.0":"2024-01-05T14:56:53.346Z","modified":"2024-01-05T15:03:55.122Z","1.0.1":"2024-01-05T15:00:21.677Z","1.0.2":"2024-01-05T15:03:54.941Z"},"maintainers":[{"name":"conveyorhq-eng","email":"engineering@conveyorhq.com"}],"description":"reduce redux boilerplate","repository":{"type":"git","url":"git+https://github.com/conveyor/robodux.git"},"author":{"name":"Eric Bower"},"license":"MIT","readme":"# robodux \n\n[![Build Status](https://travis-ci.org/neurosnap/robodux.svg?branch=master)](https://travis-ci.org/neurosnap/robodux)\n\n- [Documentation](./docs/index.md)\n- [Example repo](https://github.com/neurosnap/listifi)\n- [Style guide](https://erock.io/2020/01/01/redux-saga-style-guide.html)\n\nOne of the biggest complaints developers have with redux is the amount of\nboilerplate and new concepts they have to learn to use it. By using the\n`robodux` pattern the amount of redux boilerplate is dramatically reduced. In\nmost cases, wiring up action types, action creators, and reducers can be done in\none line of code.\n\n## Features\n\n- Create actions, reducer, and selectors for common data structures\n- Automates the boring parts of redux\n- Dramatically reduces redux boilerplate\n- Works well with [saga-query](https://github.com/neurosnap/saga-query)\n\n## What's included\n\n- [createTable](./docs/basic-concepts.md#createtable): Thinking of reducers as database tables, this function builds\n  actions, reducer, and selectors that builds simple and repeatable operations for\n  that table.\n- [createAssign](./docs/basic-concepts.md#createassign): A catch-all data structure that makes it easy to set or reset\n  the reducer.\n- [createList](./docs/basic-concepts.md#createlist): Store an array of items in a slice\n- [createLoaderTable](./docs/basic-concepts#createloadertable): Store as many independent loaders in this reducer which\n  are all accessible by an `id`.\n- [createSlice](./docs/api.md#createslice): Core function that the above slice helpers leverage. Build\n  action types, action creators, and reducer pairs with one simple function.\n- [and more!](./docs/api.md)\n\n## Core principles\n\nThe overriding principle is that effects (like sagas) should be the central\nprocessing unit for all business logic in a react/redux application. We should\nremove as much business logic as possible from reducers and instead centralize\nthem inside of our side-effect handlers.\n\nThe other primary principle is to think of redux as a database and reducers as\ntables. This simplifies the action/reducer logic and makes it possible to build\nreuseable components which dramatically reducers boilerplate.\n\nPlease see [style-guide](https://erock.io/redux-saga-style-guide) for more\ndetails.\n\n## Getting started\n\n```bash\nyarn add robodux\n```\n\nIf you don't already have `redux`, `immer`, and `reselect` installed, you'll need to install\nthose as well as they're peer dependencies.\n\n```bash\nyarn add redux immer reselect\n```\n\n### Usage\n\nThe primary philosophical change between this library and other libraries is to\nthink of your redux store as a database.\n\nReducers are database tables and operating on those tables should\nhave a consistent API for managing them.\n\n`robodux` has a few slice helpers that cover ~90% of the logic and data\nstructures needed to build and scale your state.\n\nThese are one-line functions that create action types, action creators, and\nreducers using a simple set of lower-level functions. There's no magic here,\nit's more of how we think about our state that has made it dramatically simple\nto automate repetitive tasks in redux.\n\nOne of the more useful APIs from this library is `createTable`.  This slice\nhelper creates a reducer and a set of actions that make it easy to treat a\nslice as a database table.\n\n```ts\nimport { combineReducers, createStore } from 'redux';\nimport { createTable, createReducerMap, MapEntity } from 'robodux';\n\n// setup reducer state\ninterface Comment {\n  message: string;\n  timestamp: number;\n}\n\ninterface State {\n  comments: MapEntity<Comment>;\n}\n\n// create reducer and actions\nconst comments = createTable<Comment>({ name: 'comments' });\n\n// converts multiple slices into an object of reducers to be used with combineReducers\n// { comments: (state, action) => state }\nconst reducers = createReducerMap(comments);\nconst rootReducer = combineReducers(reducers);\nconst store = createStore(rootReducer);\n\n// dispatch action to add a record to our table\nstore.dispatch(\n  actions.add({\n    1: { message: 'you awake?', timestamp: 1577117359 },\n  }),\n);\n// { comments: { 1: { message: 'you awake?', timestamp: 1577117359 } } }\n\nstore.dispatch(\n  actions.patch({\n    1: { message: 'Are you awake?' },\n  })\n)\n// { comments: { 1: { message: 'Are you awake?', timestamp: 1577117359 } } }\n\nconst state = store.getState();\nconst selectors = comments.getSelectors((state) => state[comments.name]);\n\nconst commentMap = selectors.selectTable(state);\nconst commentList = selectors.selectTableAsList(state);\nconst commentOne = selectors.selectById(state, { id: '1' });\nconst foundComments = selectors.selectByIds(state, { ids: ['1', '3'] });\n```\n\n## References\n\n- [saga-query](https://github.com/neurosnap/saga-query)\n- [redux-toolkit](https://redux-toolkit.js.org/)\n","readmeFilename":"README.md"}