{"_id":"@gjv/redux-slice-factory","_rev":"74-9e5f8a2dee9787e160dd01d61faab2e7","name":"@gjv/redux-slice-factory","dist-tags":{"canary":"0.10.1-alpha.11","latest":"0.10.3"},"versions":{"0.2.1-alpha.13":{"name":"@gjv/redux-slice-factory","version":"0.2.1-alpha.13","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"src/index.ts","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0","redux":"^4.0.5"},"devDependencies":{"@gjv/eslint-config":"^0.2.0","@gjv/eslint-config-typescript":"^0.2.0","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"d1e73ac57b128bff483197b28baa485926a1d1ab","_id":"@gjv/redux-slice-factory@0.2.1-alpha.13","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.22.1/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-WE+UKzVJKi0YS4816QJwMWdbzRKvh6jMEA+uufx41YbI0eyLINVjPk5gLpZhq7GFjBKxkQ93/WzzDDn579k1iw==","shasum":"69d9bcf0f72bb2e0734c13196f683db75bc1aea6","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.2.1-alpha.13.tgz","fileCount":67,"unpackedSize":111384,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfB81YCRA9TVsSAnZWagAAxAQP/AsbZ+eyMt+ZZiliuyMm\nW3235m39z6apdX5y1TOxYuFHTuDlGX9tiXWPMMwCjSov4WKkrdcwKKrZkY2Y\n2Ng/gV7zDdXA74VlTdPPZ3AS6+hjaQwUxeYiO84RR1r7bFQVOzNNFzaG6YPT\n7RAFh0f0+z/n51KT3P+o6RpGUDDaxbtrefagjIkZBXYjGuECzpdOlIe6P4Gg\nFro4yHW8Yr66HXXTwLlQzPxdmwavQwBBD5tKaYDuuwEGpv1JEfP+fzHJDJSp\ndSDR1eqYq9I6+JXiLJFFvpRHSAx3igPVj3Mzov7RCRTFJMa5HgbkHIQlYatM\nvpWDVGuF/Gzp7+XwRYBk0b08IkcqvEaY21BY/WjqTjQDwGbDctAeOKB6LykI\nbt3H6R7GAUgw/A+c5cXePf6p4r2E+CyKTmRbbnBn4O1OTG5dAMKVZsnXiDs6\nbyhUEFmFoLgtr8uhTGTbGGr6mJTn3vO6anBsJEW/BvnyM22ODSxwW6DMHfI5\nlAl0M6uvFCZYRXpZeTVOnB9++HtkaXuLZcS3Bz/bJGICsRHheF4kidrFWJBk\n8nRVbq8/A3xcpq5w7Rknk4TK+WqEVjm0o7PG7xa5RLFznI23OTWVRRZo+eTb\nOObUuvT3T7UKujxRO6ZfJNEB+Ye8YGD6ayzqsZpk37XKO+gl4FsetidMAwoV\noYyT\r\n=+icN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEHLkO8+D9Z1S8us5VnEWi6UUT5F6AwZZf5LYoXjNJ5XAiAswNJ9el2q+SBLLE56IYCmOBctA+Tkw9kM8yQIhVZUqw=="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.2.1-alpha.13_1594346839767_0.24938141985150453"},"_hasShrinkwrap":false},"0.2.1-alpha.15":{"name":"@gjv/redux-slice-factory","version":"0.2.1-alpha.15","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"src/index.ts","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.2.0","@gjv/eslint-config-typescript":"^0.2.0","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"4c19e23207ba2b0910679d5dc1e08b5cf900668c","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFair enough. Here's a quick example. <br>\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n}\n\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n})\n\nconst store = createStore(reducers)\n\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }))\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting))\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'))\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}))\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')))\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset())\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.2.1-alpha.15","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.22.1/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-FJSlVqCzJe8hKUdTrTuCHfD3b2GzzSdr/tWBE7ixXxqkjKgVqzcsNhFBFCLhfhasSSoQ54zfo1jvb0Cs6PVYAA==","shasum":"e278d07dcc3a6fbd806efd77769d9814b6a2331d","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.2.1-alpha.15.tgz","fileCount":67,"unpackedSize":110783,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCJalCRA9TVsSAnZWagAA+/kP/3zaVDWKKeJYg2qZv9Jr\njs8OgezTPL261QW4KlSy9HFXl9DIfJFPEBPvUBdooGWyQ26M6/gQdvRP51Vr\nOKXh9/xGerbVhNQeZtoUsuJmxXvV6XMrOlCE/FDGEC+swzelKzFx5tJPvR/f\nMIA9FMUqNglxua9U3MdIhnXjMRBPMCrgKP4i4W7RNM1dzbfwCq3Es0+hphAP\nz1pScaQUklG3HN6LPbskDnRZtkJgBYTCRKrtMU/qRi2rPpZB+4u6WTnB3QuJ\n+OZZwy5K13z7dW7ZXlKmY0eWOB0Guj6QdcMXR+EFbfaFPeQ1fICOIRlUmr4L\nk/D/ATftZLThlaJTj6YPExGsA0IciIRJsf3f1HLzNg4r1MHPjevVa8zWkMtT\nWbjeb7tKUbKBggSBAT8Jg30DMb+MlGtpVqMSYlrp6X7HuhoOJxGiBqX2uCJw\n4PjGySbw2kcQS7afEfbTOSPUMIw+FcvuFyNzdfIw7jhHbPq5KNbbjyoB0oPs\nAI8xTto3Ur98sgjsavZtuy9JRyqHcWkwFgTacIAhhs4JCxNnFgpwzpXgxEWP\nFUvrNJ2EUI1dcwKOHgP3hGkFx1uX78tam1K8MoxYGL9FF0uP5R6igwsxghZ0\niMuPPgc2eb41fvaSyiESuVWLmFLyH7HYc/DkRS1xHboqCE8L2PRGFhXyOXju\nFk6Y\r\n=GW8Z\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDY9CENmJ/th7Iuo5dBZ8KOHw8gt/xl2CkthLplHUTsIwIhAN4R4SOTu5w5hbe4GvFP/5yl66B96aI3gb7BzOToyuht"}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.2.1-alpha.15_1594398373396_0.5175254248826655"},"_hasShrinkwrap":false},"0.2.1":{"name":"@gjv/redux-slice-factory","version":"0.2.1","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"src/index.ts","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.2.1","@gjv/eslint-config-typescript":"^0.2.1","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"5b29f483505e99c7fd252b46f7e3f8e31c87c51f","_id":"@gjv/redux-slice-factory@0.2.1","_nodeVersion":"14.4.0","_npmVersion":"lerna/3.22.1/node@v14.4.0+x64 (win32)","dist":{"integrity":"sha512-2jLVdp09RUTVASO8GBH+MSUWAqdNl07wQIgoGUMUFYDyK/ExxJKGMk31zCzrkDUPhGRlLsOK4z3W6Tziwk8dCw==","shasum":"ebc57956e3f32cb896c2df04da86c94f0c76a848","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.2.1.tgz","fileCount":67,"unpackedSize":112788,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCJeECRA9TVsSAnZWagAA9PIQAKT/6P9KyZ5GwWTd5K5e\nBA6STm4RiICjxj+59VTiu8t4MNQd8pOm+Sxe0Dt2d6tPrnkn7SHtCh5uA8Yj\nyVvALfgYUSU/kHBK7SP229s5zTLdfyy/5H2MMmBmMBMjpIpKNGm+Balwqqeo\n9KafDK/IK1QAftlYJeOQLkQMc9oomo6QfAUTXewnkfHUc9+5RlEpBxDocMNJ\n3raH1vucr38HAmKHcXypuKuC/GpUL5XmNcRY42qz1N8Eieiu3culZy+QGl6Q\nD8Xx2I5h1NMmQgm/MjQty40c3Zj+ohS7K5g9x/IQ+JVmfxh1R8S2nv+kt4HH\nK74BEHe8QWGsaww4w1nrVjt7joeTKgIScJB8m82C9F9vyMnxndl0cPlsNX3Y\nCZQIo9QjCnDRLM/RNC0b9xZBBIsE2/7KD04a89roCyYOj2+H6lftxyy/GgON\nO2ZRj/b3u5u4K+bAwv8xUJ0AaEx9a8o1H2oYg2eXEdHRZmgzb1mVyGcJHTD7\n4c+5nbq5cB07T+v9Uq4F6khcXiLVEhO9UutmrncxRLnCTecRHg+wrR5Pk5XI\nQaMJ6tMULmQQ2OGnyxazvMlWs8Tn8pNNHuhPA0QS5HNK1LT/768EEroAfzwb\nwliDqbES4gDYGbm+BnVZMQu9yjg4lW9iurDj12oJAApED1MtMJmIXyE/l0TM\nhNgC\r\n=ZeRc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGp9iBsja7XNxivJlu/nmsWqKU0qq+tw5pHgzZO0p5YLAiEAw3EHiT7PElRNz/vCisy80k4JL3wzLARCRcGdJDWMoxA="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.2.1_1594398596079_0.8105820016662306"},"_hasShrinkwrap":false},"0.3.0":{"name":"@gjv/redux-slice-factory","version":"0.3.0","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"src/index.ts","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.3.0","@gjv/eslint-config-typescript":"^0.3.0","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"112c1bd54b602ebf8f437ced45cff1437dc9c1c6","_id":"@gjv/redux-slice-factory@0.3.0","_nodeVersion":"14.4.0","_npmVersion":"lerna/3.22.1/node@v14.4.0+x64 (win32)","dist":{"integrity":"sha512-uG8bHhbMFeBoUpUIsHuX3anMod4QvQpaGvO7itppKHh5cnKipqr/iud5viuCLORjz34cD6rL4yXMK1whGVUA3Q==","shasum":"0cbde458dc03429ee63b5676803d9647a84435b3","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.3.0.tgz","fileCount":67,"unpackedSize":112788,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCKOdCRA9TVsSAnZWagAAxJwP/1EVM6tv89UlmRAOgDNy\nFAPRYSib5FwvXcuFctXEp1V1IplkGc4gNsjs9sCrxNnNJYyEv4MDYKYxJCrU\nPGsNjRTaRBAA5h0xH67Vp4OM709hJeQsehx0tlay46w0qradb3SkwRIiQ37+\nJIJhG+ua7y6HuIumTd3lv9CSeZr7Axj7IABEuBDDPZlmgGXwx1XN3jQnud1s\nAGoW/EFflUVl6QQXiJWp0kgFOZvLbjJOo9vqK/KP40iyplvM2QLBDxT+/Vrz\nDAw2rQUv4K68rJuClCNfYitPkTaNLMnuvGtWRo4sUksEC6V9vGcXQzBxNX8S\nTxUVdQBkbvCSGa/bgQmohyg+5AU591VrKN/EZX41oLuqaNtSZbbg5ZKHj7B5\nUEPwpiQ7+FlE8SVxmitl1DakNOCOBpHFI4lwkAHOCkG84qDTmZcNyckcekI1\nFTXhkxwuSX+XwqXoJPLNiSaSjArCuA3j2psoqNbQok1hLGMKPFW6FDFKETWJ\nZ4UMi7hgH8auLSGnl3Jmz1Kg8cNu7GhDhkHNozynghFztLXBXCHztE+b5uAF\n+GHcQ8Yt/rgGIcE+F/yeOpJ17lLhRn3dykT+gw50F0UGJ5Mom5lC6xrS+1KK\n2xgVbSWQ58fEgBSUdJXymogUHkzeyR7Iq8iQ6ijSfT8X95cvaepjjbtoAAh2\nPhvj\r\n=MPUL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGBbJNKgn8Ua7eVUFSBPTaxwkkONbLuHBS7lRpJxQ7YJAiEA+SVcosh5q4rdrt5TcMyfdLrbfvonNigRxaEX9MZKMXk="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.3.0_1594401692667_0.8256830744812587"},"_hasShrinkwrap":false},"0.2.1-alpha.17":{"name":"@gjv/redux-slice-factory","version":"0.2.1-alpha.17","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"src/index.ts","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.3.0","@gjv/eslint-config-typescript":"^0.2.1-alpha.17+dc1dcc3","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"dc1dcc3eb07fe2fe334df3bf26c96d5fbbd932b5","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFair enough. Here's a quick example. <br>\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n}\n\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n})\n\nconst store = createStore(reducers)\n\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }))\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting))\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'))\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}))\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')))\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset())\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.2.1-alpha.17","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.22.1/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-DlidopNT73dZkwAv2WkDQM90oDxopzWo40tt3MhWUfRX5jF+5pr4uYjpbPimyy13Z+caUDuLqCivY9L3jFPn7w==","shasum":"58abe4a91c740c3d447da11b81e01357b1088774","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.2.1-alpha.17.tgz","fileCount":67,"unpackedSize":110800,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCKRUCRA9TVsSAnZWagAAs4gP/RaWW+xOHvZhccE8ytnZ\nzpjknqz+9Xu42ZBkiFzYWrdnJAqWq+AN/2zsPl8VnhRgsPAiVj04CWM1X5nW\nqRyz9f5OSa5cxn7pI0CEDp0C3NGbVnf/fSnbxoXLrObB/IqA2EI+PnA7ug3q\nTEuVpQ3bszf+tvJaQYs33bEJUIXQbd2UcfAijFuntRHiOmgvhMiaULI3I866\n9tBQfA1smy4wMOXquhCwwKyAF4VY3IA3m884fzOU0SLAsvze/qq9WRE17eX7\nINKs2gr/N0eYqG52RI6No6wxps6c88QH22JzJy3QCuvddudc8XSND+G/y0MB\nCyDQaKQEzu0e/yg3rRQmsSvpPWqQsWzBpQbi3o+yGnY9DN3IgpBW2BDqNthF\nBnmrfXW2vgwetnDRdm8IhN3vc/yGhAuOj3qsxYDM/sbxhVZ0I4lQATeLvAXr\nzphvRNF6prwieNoC1VEZNIs8IS33d6dg2e96VZ50yyvhUJ5HXLYLEkGN/sdR\no0OR2wrH8C3w+rPfedPnA2M3979x0tGwTgb+HofxuNIhXiTl0Tu1PJDeccZk\n+aRVFUo/H+GxHcH4Jy7yl6A9Gl5xLzLOkLYJSqCsX9tMb0Y6Z2YebICK1F1I\nLM1rz77u55kIIxj2Sbg3nzJ4Kp/aNNy+ZSHGoci4lC2IuLVjV4U/U2VkFw7F\nFY6s\r\n=G5mS\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDL4YYLv3hTlpxbHQlU/WoDOs+vWoSOEa6ja90qCr10EAIgKPMRXOYrd+KszCbbNtzrMLwGdc9QfgAygLOdWpa+2jo="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.2.1-alpha.17_1594401876105_0.42112906005407047"},"_hasShrinkwrap":false},"0.3.2":{"name":"@gjv/redux-slice-factory","version":"0.3.2","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.3.2","@gjv/eslint-config-typescript":"^0.3.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"c235a5ea34fd3c41bacd72cbf0e8bd29d6461373","_id":"@gjv/redux-slice-factory@0.3.2","_nodeVersion":"14.4.0","_npmVersion":"lerna/3.22.1/node@v14.4.0+x64 (win32)","dist":{"integrity":"sha512-gDwX2N26f74/WA/QRPpd/lbqiwbo6OnDxRQ+hX3bzy5nKmMkZETIiRe1mWNRcb6QowRQ0W/7AmV6gHgZP2WvTA==","shasum":"83ee4355781d5607449a7f1dc2f1548d94005f69","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.3.2.tgz","fileCount":67,"unpackedSize":112760,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCLA0CRA9TVsSAnZWagAAZnoP/jIhmL7/BmxEI/LimF+Y\n1o6Tv6ciq0YYpYz49EpY402HDK+oeqm5vvMSHNOFHIfKvwDXMdX9jRp7hYAw\nczix+RLGQLnAzs4Z//uFsBrBgUkkmCHF+TyWUfmVqGieJZzcdlCcQ/9dX8nk\nhCyNrCtCgKmiBxxIOpS1hWWjnOasCd4IrG3A8Zg0A6h8kjzveibDxD5XbVzM\nJYidg4kwsP8fjC3CySjtI7C4mkjK7hByRoihrWfK1iyaGogaX144pzQYus4c\nUnoaOT5/8phJiSubmICEemhwHOqjBcAgywpEaWtemOb4UnDHSRlX3BrnHiZt\nmWg+sC6mM2970VGn6kChsW6EU53Ncw8CLEwsAlP6oS5N6zzwDlH7YyIj/BF4\n4NIkOLCjwdUZXREYkSDPn8+xrRsiEkJgnQOsWlqrSfmuBxmk8fCfuKTuqtt9\nLqnZDv8Td/qkG1+w3EEnwxWdI/5xYGGbAMDSXU2nnoa5y389Trj5aV7sAAxC\nud7EPF3VCDSnulSd9svhbwjZtJzygXexRmsSUCRxxtKCkmtOdM0xzXCqEnAn\nU3rK8cbXfGSRNN4vrjhWtNKQiu19Ng/63K4fG9dYhp8l7dtvpq5xwf1tMTeu\nHlC0ZnG/FooF+fPytn1Wk5BRLmqCSbruJrb0vahQJiaUDLgZSSYgwbUEP3Dd\nCh3+\r\n=fc8y\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD8JrJKvw0JAUNmtVWrsUigqiFGlIZ+A2Onm8y29LscrAIgBjF82b4jAzugFrFjbXbsu/y8MPnnOihnErncizCR7Bk="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.3.2_1594404916044_0.00018101351511745634"},"_hasShrinkwrap":false},"0.2.1-alpha.19":{"name":"@gjv/redux-slice-factory","version":"0.2.1-alpha.19","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.2.1-alpha.19+aa79af2","@gjv/eslint-config-typescript":"^0.2.1-alpha.19+aa79af2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"aa79af236ddb910aab0414adb9153505aebb56e6","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFair enough. Here's a quick example. <br>\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n}\n\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n})\n\nconst store = createStore(reducers)\n\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }))\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting))\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'))\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}))\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')))\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset())\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.2.1-alpha.19","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.22.1/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-nKkGTxY7YqlWc2Yp0IdKVIhKGllxzs+hoWkZX+eO9TqsJZZ6R09NwGT2cyisV7K/G4yWwzWVMWA/dwRd8xuwWQ==","shasum":"78e28a549a457e8c2729a54c6f01c9bf5cce4bda","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.2.1-alpha.19.tgz","fileCount":67,"unpackedSize":110789,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCLGKCRA9TVsSAnZWagAAp2UP/Rs2EeVhm6tMgW5SdnjD\ntUS3+z9ILuKHB0RbazUEGxxUGC1ulbV+TiB+/HZKpvG06RymSKTxM6eKBNiO\nCrqBK//tTDa605SOAtQc9kl35niWvSl5njmh1zDGXtrfYXqfzVYktnQYLb0H\ntVyJlsm6tT8NIra3m/l+APr09n8mnlcJJpk8uY96QxzzBBiBz0/pC8kP0Dx/\n/yG+twGcOKW0V/WNmCJF3AMCF2KUt4AMiIDvmp5AO+dSZokGXQ27uvatc8YK\nOQO+fBo7N9hv/I+O5dRynMGWb8ho+j7jQkesMT63u6k7wChUTmZlQtjfvIVq\n3suVanbv6i6lsH4fmj7jdSdQCrZ9iQgY1Z1oF9SIwzXzdxXImUrs+B4/kPno\n70BBqViC3npvIqC/dSqBSlDIt71Nh80hqtNlmF6wCeb+MEIZSIC35QyCmmdZ\nmmnPvpyTMQxdjVLHRus7T9RT9JlbnepKpfu1/48+adzjrAk+OPlRGP8PPm1/\n8+ffvhb+WVIMdcKlUHmHVlkUyDAhbtjbyybRsP4Wip3Ft0BkEtM37s8jLaBH\nbiMIZoBPMHbbEXGDeVkgZjhGryKDUFtSDa5LYiMTkhOvoMEILXD851vzxLIi\nU0OLSlQmu1vUaT+HdgjfcT9M3+1/Zco54dlLywoA5VVwfeBb+6/OlfbJ6tRm\n7fkQ\r\n=xQKQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCWp4zPVpazxQiP+bCAQBMxmTPOLU4gK7rvFF3kUh8jVQIgFcaEb3g2vEMr/IxfFxm39Si6OTy+AYmvo8exikkZd9c="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.2.1-alpha.19_1594405258395_0.6687734559149916"},"_hasShrinkwrap":false},"0.2.1-alpha.20":{"name":"@gjv/redux-slice-factory","version":"0.2.1-alpha.20","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"dist/index.js","main":"dist/index.js","types":"dist/index.d.js","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.3.2","@gjv/eslint-config-typescript":"^0.3.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"81b0ff577bae87b91c838f157a2fc0e7138e10e7","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFair enough. Here's a quick example. <br>\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n}\n\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n})\n\nconst store = createStore(reducers)\n\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }))\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting))\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'))\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}))\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')))\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset())\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.2.1-alpha.20","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.22.1/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-MFDzklc0NF23+XjA98//LlcfKM0G0R3JFSIUGcSd0ejHPLKHuRLf2ScAyo6yOvK5/gUJDgGqbeUdxs1qnIud7w==","shasum":"581ec601567f262df433600893516974e18f69eb","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.2.1-alpha.20.tgz","fileCount":67,"unpackedSize":110688,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCR+8CRA9TVsSAnZWagAAZkMQAIkT5hYXEpncWtP+hDUb\nRkhl/71aoI9yWDX+PItIAKwEwbs727nIyPuZFnvtt3li+CsyYprujNOfOiGx\ntmjAFLFxpJdmyP9nWGkAebNI/EXvGUn+C4Orupbl1dzLp6ABL4R7n/HKF4P6\nA2BwPi9p6wuM/VdaPoBg/hsUeYw1k5THyYgHviox2SrcM9RNSCZjiSYWSTi8\n41z1XF/TYau0X6tXVuFsy1NNcvzGy5rlTRHr6+MwSk1LwJCYCHdvy3Gk+fZG\nwMpMETXlWU0xi4ngxHYodw5XTBh9YqYMUXtE/QHFglDaJofsGZIlR3njvHlF\ngyMlWsGm8wLbaV8S5W1sUdiPdzZRW9dLPcTlbSJlWjxW/w+3bE0CRDQikXl/\nNLfcfAp1RdlohmjXm/3M0C6QdnYtnHWXmo6krUeNaqLyJSusqWxQujj5zx63\nh7ATa5nos+7kXgw63vMLnI8NYqzUm1KONIM/HJZ3aRRPve3GgIwmAT6gNGQt\nbxBCZ3yZ7Tnwr6cdTMkbBoXtM8fGvuTmVsQ4+ReoIXCvpybxj4PMhQiEkr4G\nO2qPcsJPIzchy5TLGInyIfDuMV1xilcjajc0OfAoZWnfuChir6H7jRt3lcE8\n5w1SURzC8LzWEOtGAUsqxGD8zotqS+GNWsWb19jfkfKLWz4jiMhPlImBm/Zj\nboGp\r\n=y+uK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDpJOa82Mxuwr8R9g1FmPd7vvDNt1vGNlcptUuwrJ3NbQIhAPDTZIjkUi1HOraWQzOniAh4RoA9EHRUG15wjNdaulgc"}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.2.1-alpha.20_1594433468332_0.729093837035153"},"_hasShrinkwrap":false},"0.3.3":{"name":"@gjv/redux-slice-factory","version":"0.3.3","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"dist/index.js","main":"dist/index.js","types":"dist/index.d.js","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.3.3","@gjv/eslint-config-typescript":"^0.3.3","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"46ac8ff3e6579b0e7162fca8d05217329985c81d","_id":"@gjv/redux-slice-factory@0.3.3","_nodeVersion":"13.9.0","_npmVersion":"lerna/3.22.1/node@v13.9.0+x64 (win32)","dist":{"integrity":"sha512-jhcy+H8tE4QW7eJtzE/LHMn7/Eg96A9RqzcJ4Vr9gFZDCEfpko1FjQ8h82EOj31VpnxiFkEErvpm8f0iYBwOsw==","shasum":"1272d664a7a703ae4baa765c9b6be6c27187ef20","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.3.3.tgz","fileCount":67,"unpackedSize":112693,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCR/CCRA9TVsSAnZWagAAQiQP/icz3u/NKhtEzQOwJsCF\nnucdkkBfRllf2JWADsOmg3HvLe0Eff5jEfkqzyROycAm7CfOHAJpyGckA8qW\nwVsYKg9sqV5M2wJGRQ0HJiC16MzK1+DuVm11+Olvv4pkYx3D75OXlzcEbBSZ\nEcJ89WuCON2DsWAtZQNtsaeLOFMZn7Bg6AKs7Wg0rEtFX7KN9OIbJ3IaJHn4\ncpRc/eJTdXx5iozvLjjVmi4jfz4RJk5Rr2hOVrsOQC5zkOd6AiWoKNpG7BLs\ndaaHbc2l/LnoV5PMIHVYKmIgtyYluBySkfZzzv8Yjy3Jbx9E4h5r9015oost\nKEmMgmzeUjjbOPFet0aIQ+VUGeuM9iz1Jp8jXWyAFqBXQz0s2ibnoY+5xm/6\nu9GiuDtJ8cMj/Uu2T9hBInh8j11ZZ7WXKJ2Y93uYZ8LIyd/cVOWLE0sjxK17\nklZXz9zDC8pPandMNSYLNmFqlCuO/Cc67zBMD+z7BkHvfrZ+umim/jjh93cx\n7cyzOoDtuGZWMyEesgYAXNedkky/1wN3CPZRJZQya+PiKLDcY4RAJ0fNXgPq\nQAOBBpC/kE2IHIpfEvqb8ZNASgnCisLzFe2hV4YdD1XkktCb7LBgx3R6byTd\nZTJ1y/vnJ9lqabVt1RnRi2Ws+6icuJQ/krNFT91PWxdnkaejrVUTCcIx1JTQ\n39N7\r\n=BY1o\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCHcLolFUfNYhrkCJctIHo8A8x0Q50Vom+/NIuiChXcygIhALJ7Ij+bifXaNgLTcSzZZfffnVSj/xjHcGNKiuA24QBy"}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.3.3_1594433474141_0.9017667916517464"},"_hasShrinkwrap":false},"0.2.1-alpha.22":{"name":"@gjv/redux-slice-factory","version":"0.2.1-alpha.22","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"dist/index.js","main":"dist/index.js","types":"dist/index.d.js","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.3.3","@gjv/eslint-config-typescript":"^0.2.1-alpha.22+3755bca","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"3755bca1225955ef4719e54be7d3e7cece36eec4","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFair enough. Here's a quick example. <br>\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n}\n\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n})\n\nconst store = createStore(reducers)\n\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }))\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting))\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'))\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}))\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')))\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset())\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.2.1-alpha.22","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.22.1/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-O8A8c4w8Bho5CIC+iUemTIeMBBzUN0KRT6kPQPP8KAI6gI9a83qR0o4i/oEluca9D+UtMJnpHkoW1ei0UllXew==","shasum":"3b46e8630252b5ee7c73efb1052475d01c09dbd4","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.2.1-alpha.22.tgz","fileCount":67,"unpackedSize":110705,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCSB+CRA9TVsSAnZWagAA7y4QAIabku2aW/Zw+hAyZHYz\n3gvhdqetJt3O9XZpfhbzgvCjUW3wh79PslyCiJKXw8BsCZwKMsJaCh+iJuAf\n5c+o1DflDOMav3kSjITNqH1GgnT99u0ekIspHWqbyDQBVUIv3kHSoccrqU9P\nE8Icv2jhrW9KGku/u5RAPgoAugoolrh3/SVN94CchPwYfiSse+Ur3JF1JNH+\niFMG/USuToRZAQ0TCirRfWO7tXNP7HhBzm3A7tWp162ZfRGZx/KNMVLbQ6v1\nf5gJLlLo/+8TwnBQXC3+6bFRzYzfOjxYOV9attzws6mU7ILs411GBldK2eeF\n6rDjdJYd728XZfl23Z974GcZr+sg3o7wpHlxKNs1aVTN6uD8Eh9x8JucdmN6\njd9J8V4BiutkedPopWA3IyIPP10CiCkstRtCsZyOEgpSlIktvrA1Oboa1YVo\nNe8VALuI15FQ9Ix8R5uEYpMKtLeY0trFyNdPUYymw+EwTdtLfd9tZm4gx9w8\nqJNE3Fk1LVTyMhYddmKDSF2kStUvdDNL++XZeMnzKh0t5llu6NVyxq3rnauF\nNJn2H3IWzmmix5ioqrzoHAJKAQhYvkijC21QKvtxNyM7icG4YU+I/GI10M1G\nJt4mh7Yhz0MM9ZLqw6vTHh4usEOg21h4pVjOa6mKgXY7M0AMXES/g/ckbROC\nBZrX\r\n=gmy4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCJ6Qg3YIFTU2RraiUq+8h/OqOZoQdXx3dHiCC8CA2tQgIgKBGVDJna/j5ALFQaW6/neGoBv11MflEghwW/p4KlHFQ="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.2.1-alpha.22_1594433662277_0.36610291213866875"},"_hasShrinkwrap":false},"0.4.0":{"name":"@gjv/redux-slice-factory","version":"0.4.0","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"dist/index.js","main":"dist/index.js","types":"dist/index.d.js","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.4.0","@gjv/eslint-config-typescript":"^0.4.0","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"17be72c88347cf045471ab52849363f0a60978fe","_id":"@gjv/redux-slice-factory@0.4.0","_nodeVersion":"13.9.0","_npmVersion":"lerna/3.22.1/node@v13.9.0+x64 (win32)","dist":{"integrity":"sha512-S7G7NRontJgdmamupHE2uvzDQLDTUJTZD9WMtwQlQMWxQ/RBrQOPbPNA8wjZBBN+oS3QgPPI4uiY6XVb6IK+lg==","shasum":"372555157f7dcc5f1ef5a50915766bb71a1267cd","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.4.0.tgz","fileCount":67,"unpackedSize":112645,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCoY+CRA9TVsSAnZWagAAZj4QAIqV0vQ015H2NXdGc8dX\n+LesvesMOhAYYKmL4C9/ubjD9Yn0LuOHzYReiIaRDuzPEQQ01P/G5qhCGasS\nbth1hZ+CkX3LUiCISkmeIiNKoHVpxvykPtbUA/rxle7eszXjLgQCRpj9JJKQ\nZoj/JXXhru8dLKJCLUv5Ptsc+OaYYRnUeVFR2EH8otW3F+JiLtQZqj4EI9aQ\nwrRoQ4Fb/TXd/He57m+tmjR9dIMAsA8kGWbVoTYxP2su5OjWaXYqeS8/U/SZ\n0pYTlEClmMWIKLXSeEfG0PepAf6jrLTiK7A8R4m78K3ftmrb6J2b1yJ7yw3F\no15Pbhit+CfzbQVefHDSF4y17NhpLnDX9MebUXt6LXv2a/sPhPaBoD/u1Obz\nS/lQKTAoLKQj/GmxsycrotPixgSeSUFXKJ18J9YeQUvaKqM9A4qAR1mENOFp\nSdeAx9HcxARC+D6ZJdY2MC6TRPzhl0KNFbd4ZhVlwQ6yQIB8jJYZA8ohitIZ\nniQf7oqdvXsooOrSGJy2TUn+unBO8w/HpjbjFyf4oMHfHGPMBPm6byCd0zPU\nJ8VkOKqcSKCvBLCKprFDCG/FNPeMg+LXUsGGtowflYySzJpBEA+flLTQWiZW\nwkICFm2eIgRqxq75zHLJA9yn7LR/ZDposczOqOF83apNSZTOGvVDYpmRit01\nY0+n\r\n=Zvx2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC65Pp/uO9EZTO3rFHycOs8oPfXshGmqoN1213xgYxp1AiEAj5jbMhOwn8eK+zJ4QzoMx/LCehDF4vcgbgiA/nPAtds="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.4.0_1594525246371_0.4232473529928462"},"_hasShrinkwrap":false},"0.2.1-alpha.26":{"name":"@gjv/redux-slice-factory","version":"0.2.1-alpha.26","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"dist/index.js","main":"dist/index.js","types":"dist/index.d.js","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.4.0","@gjv/eslint-config-typescript":"^0.2.1-alpha.26+f35b050","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"f35b0506d819db57e4e04ef719ff2fa565e9f331","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFair enough. Here's a quick example. <br>\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n}\n\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n})\n\nconst store = createStore(reducers)\n\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }))\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting))\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'))\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}))\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')))\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset())\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.2.1-alpha.26","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.22.1/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-ooWKOfpa7bQxZdpL/h91SpnC5NRSiqDqKUy7MQWhM45UDdpKQRNfoAwr8Vpypq9OG4aqJe7NiUaFO5wUbLJ02w==","shasum":"7b125c039211242f0cb5911d1ce0662c346adbf5","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.2.1-alpha.26.tgz","fileCount":67,"unpackedSize":110657,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCoe/CRA9TVsSAnZWagAAMw0P/39qg4lY4NcFzrjhEypX\nU1W5YNL8wE3Hl0rvt3v+o9KRYE9HwHEQeyF6rlW/ydmk7DpApQqSQj8g088R\nEwVFqm4JbbV9tEWUjj72MAAiSHlvyra6Dhkb9hFN+czDcsMbW109xrBezTaI\n+cuCxKw+tnICw5z4/p1uE+koKaPI9Y0uZBlYvku1+nY5WZK3Ag60SKwXU2tr\nhEAPUV3WUYC69KXQ+pgPmqlAgfFNsyluNT0cY09r1cFMuJh+bEj5VzZeq8zF\nCC/UVdWWmVZDYZ5LgkLCexAA2dNbt8m4GtbmWTq5V/HYUVpxdz+olkL2bMeR\nhzNbSYHFB1R+svpGMTvnrc6mMCVqm3aADIqeOtUN2MODTCnySV9Eg/LCY2Qy\nOWu/Ldm/n5Jp1yPuv77UWGVueqqlwY1AyrHbk38guWIZ+4+0Q6StMbHcDFVg\nXjXKD1o5B1QmMFSz5Lo9IMv+SIlJBPuRD61qrSh+t48IW2nZtVm0l25vDEsh\nIzhZsPWZZEJJB5qCEV5TtbkTF5lTN/qDpy8Ppt+Spf1+Rtx3zlmjUL+mQpKY\ncxFHlJztRifaX4wSZP8cOabAjCAfw7oBecWIiiKYh1EwF/GwUaLWpPyHuz5N\n9MmFopNsq6G3vBO45i/ooQlhDCrPv/8xhzQenJijN29AV6E6nJwcnN3oD0It\nW7Re\r\n=VZlA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDMuKKpyQb1XDymEYPC+itpbnOKvcsYh+2kCSu2kEcRDQIhAOwYkbGUL3ajjoBLwfxkrGzPhRcJKcWCX9cArsAcoEbi"}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.2.1-alpha.26_1594525630739_0.7379085864560244"},"_hasShrinkwrap":false},"0.2.1-alpha.27":{"name":"@gjv/redux-slice-factory","version":"0.2.1-alpha.27","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"dist/index.js","main":"dist/index.js","types":"dist/index.d.js","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.2.1-alpha.27+5d54f22","@gjv/eslint-config-typescript":"^0.2.1-alpha.27+5d54f22","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"5d54f222b58c4bff88f216b218f2c138025fb0d3","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.2.1-alpha.27","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.22.1/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-GO+ALUQKKUadqZ/SbSxV5ETXnSRX8RP2lXrQu1l/Y9smqdV2KPQjVxC5ZuzMQB+AhNLXH4506cTjvCvwQ47srQ==","shasum":"cf1b3cab8dc19236e701f1aaba50d5e04f45e17f","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.2.1-alpha.27.tgz","fileCount":67,"unpackedSize":110591,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCpy8CRA9TVsSAnZWagAAPt0P/RhCiMXpur0I2eCvzuRt\nf1GpATzS23inEdU4WynYRCT1CjMixAjsa49DOenbYglEw60C/IYjqMRRC1LO\n0tb+7UQ22992kVMXh7Gqq2B5YZMTk3c2Ja9kNWnEznXw2JJhIozQfGkZdF08\nmXFBIK31OifY0Zlp+e/48mQ59/CxaZmvjSqdy1/yqEKapiktahVO/08hu8tt\nRd3dKF6H679dNeIuzPfTegauAvw7Ydi3jmKQbhV8HWu2F3buW/5NoArY078K\nh35Sen1W943dRv6RlKhclxNSzTRHEujv4oVJt4KTlktBye3RQbFIiAg4h72s\n5+mAvtT5XQ7Psg8kbB3o0dCz6uVY40sDGa61yomVDi+2Wr46dN8eFn2D/xTf\nq8nG2KF1AVvazRKlHVvfL0N55B3wOagmh0KRDtgC2p8E78JzcqcOsSVUQPya\nc91EVMDv7cYap0MiP5Go1wJksOpTg3LjVa69ALtmPwuNswt9r4rIBne6OGzL\nhMgCAV2ZSDWhNmIAtMr8mawCJ4RWu7b3GeGWACCZU9j0doHqCl3h0+Sj017s\nwugobiYOTSLptw/5U4pqxDIiS29AB1B2H8PdTSArYQ7nrKgXrwZWhePZdxWi\n4+oWxW6PBOImkMHWwg3HPmOPv7oB3bEpdgSqr1IrWrUjdwPK54HTF6T/w4Yp\nHFVF\r\n=ddlo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGisvT8TUj8/3X+K55Pi1Hr/Tl1JfS9FuzrteXhWU2oQAiAa0ruWWb08WRJVLRU4gI4HawZeF+eX2P5n4cwXMepikQ=="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.2.1-alpha.27_1594531003278_0.1446212234214801"},"_hasShrinkwrap":false},"0.4.1":{"name":"@gjv/redux-slice-factory","version":"0.4.1","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"dist/index.js","main":"dist/index.js","types":"dist/index.d.js","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.4.1","@gjv/eslint-config-typescript":"^0.4.1","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"8b411b5e9be394b5cfbcee1a263eff3162e798d2","_id":"@gjv/redux-slice-factory@0.4.1","_nodeVersion":"13.9.0","_npmVersion":"lerna/3.22.1/node@v13.9.0+x64 (win32)","dist":{"integrity":"sha512-hYasLpIJfDW59a0uoO2tX5a98oCUJiMvFSX6JoRdkUKw1bn8urPSdpEggyOGykpfeE8FMH5QZQXGv5VhUwLScg==","shasum":"111b23922462128cde508cf3e9a6a60edf124359","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.4.1.tgz","fileCount":67,"unpackedSize":112559,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfC0RDCRA9TVsSAnZWagAANZEP/Rzz3BN8mL9BF/VhYg9B\nUSINVoBGg92s0QgIbQfHB73ogxtXzI0W4TfpfSpRnP+BV/KIEKHcqhIHU6mi\n9VOVIHkwcsYXn40x6/QTxVBsfN7U0GqFjmSsHMm7pZr+NWnBtVOlS45mYiaK\nSBnqcgec7UmmoL5My8BBUhlkgOcP5nagyEVTByY7EwH1JCE/d95rPERXwRBz\nuc0fLXBCfX+1jOQGZxlJoQ37VMpANVAGRYo1q1PXnAzFx43vSthaIilnL1EB\neht6sNGhy69dkQ7Wf2yK9YiNMcqC2A3vYcTS/qiZiwKpa+wOLHJqUE7T1U3b\nhhZRbpM0O7+qTBOMl94fU0xerk+BczYocmGa9grekySriInpijIKv+3Um//P\nKA1xv/vonyAhyxua9oQIzPLrObfltvZ664fSuwZ5tRPM0IpRpAU4V+mpAJ3i\nw/KcFM0u/b/iLkWz+BR1kG1IW7rVetapRmbgPtpmXp0xnqWIf1S5dPH74zti\nRgt83M9CH3Y9H9Ok/4SjNfIV+UmqUa99ZSGErckCZ9jySJcsjItHV3326gLq\ns1OJuHz65VEmIYl1cnFE13tl/vuxF7P+nARPRBb0Z1W0lzQ4KBM0pl4363ef\nKi50sRvwRl9Tp7Aw6rvZ22JCw6N8k4CUaLwtmYLckI1g8NR8W23YB8wdU8Qx\nXmEg\r\n=E8eO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFD1bKjVkdgWhYX3zEiYfNHxpM14Ni6XkPKHPKg9yhEqAiBg1xycHnJWuVS21pXmCsA/SIDddEG0ZzcdcaZ/M5E6Wg=="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.4.1_1594573891387_0.7899385292033432"},"_hasShrinkwrap":false},"0.4.2-alpha.0":{"name":"@gjv/redux-slice-factory","version":"0.4.2-alpha.0","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"dist/index.js","main":"dist/index.js","types":"dist/index.d.js","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.4.1","@gjv/eslint-config-typescript":"^0.4.2-alpha.0+a3cf639","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"a3cf6392bb054538731f25796b5ebcdb10f326c0","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.4.2-alpha.0","_nodeVersion":"12.18.1","_npmVersion":"lerna/3.22.1/node@v12.18.1+x64 (linux)","dist":{"integrity":"sha512-F7g2bAv/AYHMRckSmjLSEPobGETlfuwHGYNpqD2z2BXlhtrBKW6FOLodKL1oBpDD02CyoCDlxL0rsZMw+gGgEA==","shasum":"3fd8ccfddbacaa81e7c85a942c833e76058f20b3","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.4.2-alpha.0.tgz","fileCount":67,"unpackedSize":110572,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfC0TvCRA9TVsSAnZWagAAjDUQAJcsnJ0haNTOoQ0qbnDn\n65lH2Tw5zASLrliHyNRM/1saubF2TfPDYl2Prv/gBFkolU6xGEoNY4CedBGu\n8tWUSnLG5MC/lu8Cwm3LC5rvpgE33PoBozzRuW8cd381y+WGmY9syJE+TgFv\nd3j5IeXZcWwf8yJ32sHyFb5zKfO2S5Ynwmos/LfTYFQoHYpZQ8wsCoYV9Xxz\niUjnTandJmwGJvBl59Je3w6yUvzGG8AiobuN6mQ9w5gueVyjxPo+inpxoH4w\nisGbhmNvUgXEMEqY/GWkMdMSyhXBrM4gyL1PeKk8evNqQynv1GqHMKwxxmv4\nYVYZA8R+OkJcXewUDmreGokp22wkA+GBP8LwDGSH93wxg3TFlKVDzGIAyq2a\nU5u1wSKLv3nrwsx9IV9GAUjmJuTSxsWq8h3Sp2fzsmzywxX7VEeMtYYX+jXv\ndQRmHSpwjSsRBY0f2i0VdVvruPnAZLNw06M3c4u8SKL5tSMIIihwjrXydwHa\nM5+yCAnWYSIQOh3cmWf6zrHPTxg90q6hhweRVFfggONfngbALRBimPHYx7Ot\nJefCP8bIfLvOnMeqEGuNnIg5et4VrNiBjAnbTvAnl6AipA4/35pJ+q7ZPWav\nPdI37+lXIWV1qEak02pIRQq9M9ZyNyUMwAdWgjw1AK6sAIa9U1PLFiK8gDgg\nWAIU\r\n=2Fn1\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDu8IHkq+ZX2psdCtYNBjfLBAD81IhXK71pcCV6jAxaVgIhAIMk3qQRlCYI2Tp1bSDFqXDvVuHKroD59pKddkxP7A2M"}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.4.2-alpha.0_1594574063528_0.05917925472940988"},"_hasShrinkwrap":false},"0.4.2":{"name":"@gjv/redux-slice-factory","version":"0.4.2","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"dist/index.js","main":"dist/index.js","types":"dist/index.d.js","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.4.1","@gjv/eslint-config-typescript":"^0.4.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"0339e114c08b6614481b43fe5cd94d9256edb59c","_id":"@gjv/redux-slice-factory@0.4.2","_nodeVersion":"14.4.0","_npmVersion":"lerna/3.22.1/node@v14.4.0+x64 (win32)","dist":{"integrity":"sha512-dLkik+lz3B0a3yiKZNEk9WSTySfZUZ8k5c7qBVdtpHR+AqwhgrlQFiRMvKerJEjw/aHRZ7LmDaNIC692BaSdNA==","shasum":"2d7f04adeacbff9b7477b6c027d3026cdcb6e691","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.4.2.tgz","fileCount":67,"unpackedSize":118337,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfDzYzCRA9TVsSAnZWagAArT0P/i2DDroISBTw/f6ETX4s\nD3nLFNOppH4rHWJ2PLIMLWUHECZq8I7OIa/nN9/tGMIiY4mVAT+f5N1zDBEg\nusnpOaEOuSUDxbuhbVYNlh5C5yTZ0hxikUKnq+dAE6I9BpdXAsPO86tQVsiQ\nwQNLG/n7jvEyVYs0pkW+KQbpmyZ+6hQVILmvd5hvh17lgZpz5jg2N0FXfwRJ\njxyPmuCjzzOYhBye8nEP7cMVcvS2chyopw3u/0uLmnFMh5KjrIlgwbBHncl7\n8GICF++A5zO1E00XXnwN5X7eOoLApYcQuhRT41gm8nOP5WOVYlA6VBI5rMFE\n9FtVzr8Cj1CusOFFlZZSSC2JRgF0Jpq1FmI30sHQzCQ2eA4yO8Ry7rs8W0dG\nRr7spmQojjTVTw1QP9FPyXKDIFyx7Vo1DTCLPNUXWJGvfGvQjGmJrxZ1HSu5\n2oBQCdXwak8PlAeTmDVoLA8ENseCZXJBkMBGE9ma4uBd53hq74euG/sdB+eT\nFMBdmJ01WJd7a85YOOkIYzAjIg03VyU529hXHPvJBzaV12gQYDeW9Qbl8UcB\nzVGmRvM560cG2EYwRd1hrgI13UjNACrCXemdCVdFErG4cxoQrVkr4L3NudjW\n0ijARUMCplHk1u3FwrG8AIBoxMt7GYPIPEXkuoSSoy3udie6Nmc1K8TolBSw\nOkw6\r\n=R1/j\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGbZJW8054gvWRp34ptf2eiCx7Mo6EUjhU4EGCE4XmsHAiAjcRDj0t5WFAspYct+sZV3iuOEWPusTWs9YM5ePVndzw=="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.4.2_1594832435039_0.2551471401469836"},"_hasShrinkwrap":false},"0.4.2-alpha.1":{"name":"@gjv/redux-slice-factory","version":"0.4.2-alpha.1","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"dist/index.js","main":"dist/index.js","types":"dist/index.d.js","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.4.1","@gjv/eslint-config-typescript":"^0.4.1","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"565f8b3e765d67244fd339e0ea565c141b3d7432","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.4.2-alpha.1","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.22.1/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-UlQcI2FzVM7owS6sO9Wwam3BXY4Y5syLMqsSE0Ee0OI0JvUFrL8wPSSd408kOctxm7KAbIXKPDwTNpwetbhHVw==","shasum":"40b97c5a38b5561b9cb03bfb88614cc9f02e5e4f","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.4.2-alpha.1.tgz","fileCount":67,"unpackedSize":116248,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfDzbJCRA9TVsSAnZWagAA35UQAJRN1RwqhcTGypLtR8Kn\nea2YBhgFGKcmcwNzsW+1B0865AvTyH3TbtWQaZude5efXCCtCYg5x5OtMmzW\nAvCEL56eRCzzfM2Hasy8pB3GxSk2R8qvso2udWvYTfYmYCKSyI0f5UlUchrL\n0jtJKR1+CB5cXeWe1SdY4LwGYt33mQ6llkfre47H7T1yWDwIxV+B1zPOU/pv\nhRfBhllegpAY3yoj0wGr8ohikAU6YzFmDfxnoJjD3t23NpAxpxRAKuDUyAt8\nPFX5kk87LTlaFbWZefJ78InusJCWVbQhzQnW9VzFZXorArEYYZ4KrpQyopVz\ngg6Zm+y6DEqpZObOawC6GNN60vALyNldbtpN+WRFALu+J//JPbyyPA934eR+\n3RHC3syvX4nqEdr2m8+yx1p1lRU/NgJ7ml5DjeQah+HDO9BnDCQ26jmohqGS\nTbINnfgpg0pa8sa/mdMg/of5q+ChY6z2S/pd+d6EqnTSgaSsOnLpzNOSCRPG\nzcG9L+kPEyr/AJdsDOKxP2Viqfm3GmkG5YG0sXqwqlCS24cAb1ak+yMNt0BS\nPB8SmgAqx1jgIKIITka7sijDPi5hy8AgOWkcaNrmMjrfKJAA2/JN1qswX6Hm\n3SDWQjStxVyw6Wfen+RALzFbzVM7AZIw/bB8a9RIYUM1dieJs+b/nG1Qb+Et\nNwwX\r\n=19IF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCIAhlf139lT0AOGpFNe1xtZ84fvHUlJsbIQYcETIVvpQIhAKarzO2+Wr0dTOPEA5Md5Jp3I2rzZfDttEIDuK46rSuc"}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.4.2-alpha.1_1594832584683_0.8982235456891952"},"_hasShrinkwrap":false},"0.4.2-alpha.3":{"name":"@gjv/redux-slice-factory","version":"0.4.2-alpha.3","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"dist/index.js","main":"dist/index.js","types":"dist/index.d.js","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.4.1","@gjv/eslint-config-typescript":"^0.4.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"1ef32f58a21a7dbfbeafb605af75650f66c99d83","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.4.2-alpha.3","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.22.1/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-BFB58YvlwDlboRSmLTvGrSHlXdT5SPLN1NNpkPug+0ZFLbE6N0WJ5VbUVFykhoE9pXN7O+Gz1rAyldNAFj2S1w==","shasum":"cf118c51e58aac95a538d90a07661e65aa735319","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.4.2-alpha.3.tgz","fileCount":67,"unpackedSize":116248,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfDzjWCRA9TVsSAnZWagAA7ywP/2BLa6prSZCYhqMGqreW\nw0eBCPr6VNAfvzZItT7PhODGh/46dVUAUWkep50WO4TV2rKtJFWX0GMMnJgs\nlFHrx7z5RSdut3cJkRrLrWp2FeQ7c5iPPlzu1uOTWxuzeN5FNgdkK9seFR5t\n+Hgvrc636vgU9ueXU6HaimPz/vLIsqD3YFBTq1zg4kHUmzWpLdk0qnGpb7d1\nNfbKlMB4eloFYVyVznS/h+dSqTxm2D4RHG7TT2BDmjDW7Ef2w8QTKqxToFaz\nWyAvP4Jw+7zkdbHpACTRYDmbh6drBFMQwRAkjfTzHxREsIdkqCHwUzV6x0p9\nqq+hws/8/nkp12vYjNsB684JS/V3kkpk0WX6qvFanUn0byF6rrSQ9+I7YH/0\nSy8esp7oYOhinz4/KGOVYTUVTx7eX38FBEnNeWeZ/soypOrEgM5/bs6vH5yL\nZpD1uNj+aiCDK7GvHe4SiCWq0Y6dGssdbrEv9AJXbwXZKb2yoi2ojVmDjGtf\nyEf1QXyyfuZAYyg/CCjd69bsHDK5ta1Gz1JH2eR2TtDIPJTBYD8B4wDjEhHQ\nD4prTuRWl7k3FR6w/PZZOmjBsWCEU0nbbuSEJ4QYExN9gCd64bwN48v0iu5m\npx91DCF9ayYNoBD74JDLcNc9ZuiRyAAao9aPzhNhNcQFmnaxaptsvdBxOuK3\n0Yvd\r\n=CEuf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID7LOAGTgrXvwdlUVYZxg8bxAHVj3zSRwlJDLjdkUa0sAiAAoPlFtje5MlbBHWcEiYf/gqgAtNW1RHG+2xqOIZAMuQ=="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.4.2-alpha.3_1594833110065_0.7721750311863369"},"_hasShrinkwrap":false},"0.4.2-alpha.4":{"name":"@gjv/redux-slice-factory","version":"0.4.2-alpha.4","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","module":"dist/index.js","main":"dist/index.js","types":"dist/index.d.js","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.4.1","@gjv/eslint-config-typescript":"^0.4.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"1e1e0acb25730b37c84b4b6062ed9449a4c67a45","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.4.2-alpha.4","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.22.1/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-FWpRHVbrR3HX2Vs01FEXiLmhS+9q9Dhjqa00ccOVE4XpVSc67Bch5Cr+GipYQLOHx1jb9uVFVX2VDXZgYTqtkQ==","shasum":"f3095f84dd0dd8878e754b5266c754036ebe36aa","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.4.2-alpha.4.tgz","fileCount":67,"unpackedSize":116545,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfEIetCRA9TVsSAnZWagAAaIkP+wazREohnckr8iMCkprW\nsS5vxO/8HmXBWxjw13vZQnXTLkvspfHMNJCdpKB9vIV/toEJDgh01GWBm/hP\nnMH1yCgrFxlhkj7Q1jiZtbrZCu9bZKSh/sOmW8Auy8J7SA2uYjHhhqG2qz1e\nUx7XNLo9ZEfwG6o4kv1GYK4sBgC9a2BGTwSQswNjBEbpnX5jtwJ7ZaTf8w5C\nYaDCqLKSRk1O5c5BrCkSDU2sVxfOn6qHmPZiiYaGpOHYCLzfTS7xmOoUtLpy\nLJM9I0dg+Mca0xi7H2G+x4eiRORdXyAePKPslSN0vIeTxjNzc8dA+urFRWbt\nSgEqBbiii0a1MYGz8qNrYBrusbcdsc0clCExEbiB1GLex1I+QyqD0WDVXhR6\n9vrhFX9zHjNoXdPy0Ms2P24jxbIfq/BzmRf8ea7EHO6Rp49xiuSTxQDeeCvm\nfIJz40S/31bNV70AO+ApgA4Mos6rLQiLGUzW093YFsQq1Uhu+tU/tte3o5to\nKMtNAk0MawP3JuGHqfIMBu8QJjrYEM1GvhcO9lsbyghVmWBxDBJj2lPVDLnX\njOzrZv72ozaBlAHk01+62lbl7kQc5FveD9vnUUl+pLbXr7eumZj5ydSnEunX\nx85YDLMDmGo9A5RkJ43CXt2Dgt3sadG2MV8VF3+lWKfJf4AsEpQS60BurY4h\nGdQN\r\n=a3AD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC28/5cJmX1vUfE7BfjR/tUbBQ8sRwej1ehM6F0m+HjlAiEApll5hIz9spbjoYvR6RzLWLfosJ/Lo1PfldOILt4NRw4="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.4.2-alpha.4_1594918829413_0.4704232026111115"},"_hasShrinkwrap":false},"0.4.2-alpha.5":{"name":"@gjv/redux-slice-factory","version":"0.4.2-alpha.5","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/lib#readme","license":"MIT","main":"dist/index.js","types":"dist/index.d.js","scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsc","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"tsc --noEmit","test":"jest ./src --runInBand --watchAll=false","check":"npm run lint && npm run build && npm run test && npm run build:clean","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/lib.git"},"bugs":{"url":"https://github.com/gregjoeval/lib/issues"},"jest":{"preset":"ts-jest","testEnvironment":"node"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.4.1","@gjv/eslint-config-typescript":"^0.4.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.3","@types/lodash":"^4.14.157","@typescript-eslint/eslint-plugin":"^2.20.0","@typescript-eslint/parser":"^2.20.0","eslint":"^6.8.0","eslint-config-airbnb-base":"^14.2.0","eslint-plugin-import":"^2.22.0","eslint-plugin-import-helpers":"^1.0.2","eslint-plugin-promise":"^4.2.1","jest":"^26.1.0","lodash":"^4.17.15","redux":"^4.0.5","ts-jest":"^26.1.1","typescript":"^3.9.5"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"be7c32e6e1824b83601b0fdb9a9a87a638e6dcdc","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.4.2-alpha.5","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.22.1/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-Y0NwBzFXvHZngZaKdY5J0YjsyNMk21LEi88xCOT9rlV19qsW9FYcWc0nJiGC2ktkkqqNTyrslOckgyOg2u3vjg==","shasum":"cc58910c640aa3a323f6944fe6930ba0689b0827","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.4.2-alpha.5.tgz","fileCount":67,"unpackedSize":116516,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfFQqKCRA9TVsSAnZWagAAqkkP/iJZDnOrzOa0QmSqOziE\nqeLFXHNDi2jP+u1LtmUUCQEj1sy55WbJhkoakxcpFlHrHK430YKiSQ+6fL2f\nskY2VEb3Ximn7n3o9SaaOeXCYU9WbK2sFGpCYPG3rfZCE52d29GBeoKpD0Hr\nJD3TAlBIHTuE05nGACpKX7IUIUk1+wt//tl3C/p3oM1O04XH/Qh0UcKp+0tX\nvZpIZ8XMakA7aX26S3UUTRgjZwzuEpqt0Z1f/VBqtGQewj0WbNiWECIIVa1B\nXTvTdkAo9XTbC71vyVwHrYJM4+7/X2QwPa2JXeKv0P4m855kaOme3CuMD2a7\nobthF4G97fN6vOuRHhFozMtY2UHhKRUgZpFF+eUOt30uLnNRMO9QVes0eQaj\nSZleTZNddhXjCCAPVm2Gafq/mXH4TUUozwpuWqZX5unJKEwGMa669p+NHNIp\nl+jazm6ipoGct3Vz5uWiqWOIhNxVRACDzupFyW/fNkDczlYWV184i9wnVMqc\nx2lMVPDHLnRPHHxdVmI7ZqCis02dEP8sukwBJYc6skL64jYAYtFeavDQcog9\nqCjBCuIEtoS3glO9vXw2YTfh3fW5jfhD3RrZv2Po6gjm88hW8iCk9r5jPwIX\nkqA7JM9O1ZQgEib//wCgzSwCIP6kwXpGjwCLlDXOBvU/DDkO99O+nGV9828+\n1eps\r\n=B/Dd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCXJ5giaXOJ8V3v+XAxsk1VLEOJivuBA29dnUeE2sD3mQIgAXbPilyOJkHlqfgv4UtAb5Fv5jUEP80Tz0NKODjxCxU="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.4.2-alpha.5_1595214473622_0.1897984362267735"},"_hasShrinkwrap":false},"0.4.2-alpha.7":{"name":"@gjv/redux-slice-factory","version":"0.4.2-alpha.7","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.4.2-alpha.7+e593245","@gjv/eslint-config-typescript":"^0.4.2-alpha.7+e593245","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/lodash":"^4.14.157","tsdx":"^0.13.2"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"e593245e8d7268e95fbb4da3ca84b91b8cacddf2","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.4.2-alpha.7","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.22.1/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-N8bHN1yTKJQB27F8dLXKSOUddC5ydwl7NkQulk7cNIPiAMC6xxbPPYxLJMzmJtPnd9VjRcwMdNjlY5Z3zzZdGg==","shasum":"3b67b1673b7dc50d8992b2a81fcc78317dc9927a","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.4.2-alpha.7.tgz","fileCount":28,"unpackedSize":192634,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfIPpGCRA9TVsSAnZWagAAFRUP/RkofwTFeQLK8f7/1T3Y\nuf/8bX6bpuPsMedfPJVcMoUxpX+b/1K+uU6EXK5RWPg1gApS+tWAk6NRvbnk\nLXDpmP8V4fD7w/SxOEItZhK72iKP0M5t8FIifbur8dQPYUYK7PG3JJXmYtIR\n2Tp4mHWnyjTA39kLceHaVATXVzgCJAed1TV1a+MnGv+kL5qBVnUeFl+pzimb\nu8BDqnSrHcunp+wOHTpX6DqEi+tZ/b/jQBGi7jlD9uEwsIvrl0IoEmhIG5Rp\nPqUoRsFaKLFJbH0k5vin3hSOl+/5sXKH9OEIP6yNvwwTWAS80wpW3e699v/m\npgaNP6rEWGQAO79ltaCDAHmyb1xw7Ph7cWEONbgCQCDZbID7nsteJxZ2MVf7\nJMQd1jHp+xa9OEWb36N6dY4MfAI5Y89vcqwk0s2GKhdrFUSnN2XL3h7l0bED\n3AdjieXl5okk8mdzq5C1vkPP+gVwOwbXFzLBvsvukLan+DiQnjJkc2o+fDaL\nqgI01Nay7NdWXaK4MaiulF7e96OgKl37k0pHkHXsQ6tniPvtaWOOCieVPKau\n/vTonljdsnSzlE8cDE6Dxl8AjcdTAuomaV+5WKTPjzNZOn5aE/Tlzcaqw70z\nEev7PvT9GCoiEan3u+sdzqxUyMZkMtlrTSIwJL75xlHd/6lUeSsMzbawbr9p\nZahA\r\n=zh7C\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCOmNRILlNdhhZjcZ/9pRXtZdGj8HLUoG+Qim2JM6I2zwIhAPWtnAHt3fdwBf0kC3JY0oNcOzYUoh0NsQgpvh1e0BgO"}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.4.2-alpha.7_1595996741829_0.031376084350776434"},"_hasShrinkwrap":false},"0.4.2-alpha.8":{"name":"@gjv/redux-slice-factory","version":"0.4.2-alpha.8","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.4.1","@gjv/eslint-config-typescript":"^0.4.2-alpha.8+d42db90","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/lodash":"^4.14.157","tsdx":"^0.13.2"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"d42db9074b61ba961b43f95c49bba0c1fdb53362","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.4.2-alpha.8","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.22.1/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-lR9dk2q5xu9IG0cO/Nhz1BzOO2Yvwp20vTKKMu32pdlW+HgwbxwJIBPC0P/oZI88CG7vlLX0ILS4X2981diQXg==","shasum":"632c553fccdcfc92bc169200102878478579fc6d","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.4.2-alpha.8.tgz","fileCount":28,"unpackedSize":192618,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfIP6SCRA9TVsSAnZWagAAmzcP/2lNOy9Ot+BkVZWlVjw5\nTpitJ8X92ZTeYIT3UTOMBt3QeSW0NHEt+oKiFod2hVxec1e4ClpdauhxTL6v\nHNfYHy8AN1S7H2fkuDp0XUWgnE2nKkeAP1ynOAZ8bYRcM3NdqB93MO8Iqtah\nRJShg8ClFCkFkvq2JJGds3CMpNR7vXTg/z18wZh+MBTMyg00J2jFidp5ATie\n+nUzdxAZxfB095ZhcaC3Hfghtle5oAXeXV0oA5ZQ97Rz3SGl6LmXZsbYutLl\nE1yNi5GL9Zxh1Khl0r9X2IJ+piJNCjKLJro7b3BAvSNxzxLrF0Y2nndaaQ2c\nhE6WrcAhN5/gH/Ga2gp3/lPjA3rIyRfxkq+1aQ5YNVgIiRpQ32KZ/zHrQ7+Y\nWXdJHtAeuLLE8TfGkxkhi82QJfs6qiUF2wv4WCWWXYWYgZb1kvkPq98NDTP+\nC7+xA3mH/Kt9lBoRqMbMzIXvtjdiEDhIPSyikC4Tu3KImd/m1bWxgoxxfiS5\nAvxdM9OGXAbCDbGb6bXLJNHdxV1ObEUiLh/YpstB6aIzPEBTw81Gag8u1c75\nugE41qHhKWLKyNu4zoAuhyleC/1dGGrSsrZH66kxsZ8p7LTE0IFu3FhjA+go\nqXL8jz6UcEb6C7y1cU0y5Tv+J7HFClRMGkVCt17Q36T1QkuMEz7eAa7MD/Qu\ntyl5\r\n=q17W\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC3mF6Hw3/mmsAgFkSA4+h9WSFEh0kxrcR/MdkI4ROFowIgbkFNxxrCC5CeSeI4SHX/cr7pmBiEjnmMlItKsR36wII="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.4.2-alpha.8_1595997842042_0.6445116590122839"},"_hasShrinkwrap":false},"0.4.2-alpha.11":{"name":"@gjv/redux-slice-factory","version":"0.4.2-alpha.11","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.4.2-alpha.11+bf77c21","@gjv/eslint-config-typescript":"^0.4.2-alpha.11+bf77c21","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/lodash":"^4.14.157","tsdx":"^0.13.2"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"bf77c21163e94e167a1251e1558ca6f48555685b","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.4.2-alpha.11","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.22.1/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-wl9lKtWzsIdAePNQKCF7bFyMl7gUQ/yiknKdBtnYRF9bqK/B9sEz+ds+RmB2UPllhyvQ3uwnSb6sBMUVnoozLQ==","shasum":"38878310545f3c7074faa08711b24123c940150f","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.4.2-alpha.11.tgz","fileCount":28,"unpackedSize":192637,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfIQA7CRA9TVsSAnZWagAAxFEP/3ML3VcPlzLPAEqKsB6t\na0kEEqfBaxAKTPv3/E88zNM+J9/GRyxUtlSs4n0EJ03LvlrlKI+BFdBpkRwS\nzPBrtkVABhdx9WAgxYlkLX7q2qGsWPmtHQ3sNiUlaTpuDG7JPf2aZHf0fKVj\nXzSyFFVrgBPGgjkhDI9q/0bGt+BPmylrVqzGpm3t3Sjxi80GY9GLG+6mIKHt\nZo3BqklNyAOkcGpV8jgesr68UuzQgOLjPQC5v1HgaH3dtejR7NQQwwxdKtVJ\n6h137vr3SGnI1YhxdXrC3VznjSQFC2kAtFY9WE81Jifg23hmNTvAV3LuX2Bc\nOz22QKlhjSuXiA/cZ6YWOGO/MuORTvSVXW2KF6m60wxktsM/C74TmMfT6hfP\nwRQjiSw+BTmWXBMPdGjAksK4nCQSwHNtkta0XpBtxvo8r3+0Qln34iVGJXWT\naGlo0VWie/ez/jB5d+JmEBII0DjSOKADZClsWNLWb1vlx9y2UgkFo2WwcD3e\nL4lml2mepHiVkAy3v2TKWwA9d85zV5RIZXSOMdK+jcx/uU1U7otSvO1g/tR0\nkVA+OENBB5a+c5lOpOQIpHzhDymQdoKyz36xzaMHQd6L4/vDGwNaEZWnR5EN\nqzy+B6kHUYEZiZv70MNWbDARDcoxkfgQT9x5ud4sB48rHLjk/PH3Fvbtd3si\nRfMO\r\n=9KrJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID0pYuHI6Tb6MaKTUMTXAOLBHGT2iwV0qgcoWXgoQmxNAiEAt3QJv8GTMbipqdUJLZHPw0yhL+PRHq/uzQoyW4KPuSk="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.4.2-alpha.11_1595998267366_0.7368350614715504"},"_hasShrinkwrap":false},"0.5.0":{"name":"@gjv/redux-slice-factory","version":"0.5.0","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.0","@gjv/eslint-config-typescript":"^0.5.0","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/lodash":"^4.14.157","tsdx":"^0.13.2"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"d9a1cd38835a2663c7d8dd0474006fbfbf0cd054","_id":"@gjv/redux-slice-factory@0.5.0","_nodeVersion":"13.9.0","_npmVersion":"lerna/3.22.1/node@v13.9.0+x64 (win32)","dist":{"integrity":"sha512-QdiYyVsfQtXD7cjq8P6EdVPAQlnUApCUuV3SzIz+HX5wySsWE32qG+vpnwvCRjl0iH1RZJKiYo+gx929YfS1XA==","shasum":"1ede2173320e534f1a7d76a4c3fa9c32198edea1","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.0.tgz","fileCount":28,"unpackedSize":197458,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfIQEsCRA9TVsSAnZWagAAQIMP/RT/MhJBy5mjBItMDf6X\nLvIiUFIq3zAd/g+XbLC3SqZkE8OYr+bvIovPdwagtvqkuHujKvPzXPDJU2NU\nWFO++HxJsGT0xWt/N47joXqyGB3xNzQiWozLy7l4Rr33P7C14ol4Kcjq/gU0\neUgkDp1LlBNa/2u1fZilN+2u+H8D2rJX1EcR+VtBue7WAr3SrMXnNYt2trmR\ndEiJl5Y5fNL+MUjh0o5ZpC/gqch/mG+vgUZ7XF5MkGE/9XMOWuG16QxoDM8Y\nXykteJBCzERtEybvscgnHu+GEDJZ9SbzDcigwS9ovvg6xGIAHRcun7zS03fj\nEDsOjKw/uJpnXsZfq3QemEzWM5c1YT6xZiAGNEWqRQUjGLibL/pf+90JnOrH\nflW0ya9nls7rZffGrrwZCrQpUJzH+Vr3RShNbaG8qbDAvoCRoFf3PpCsUjR2\nhEhRINZU5TQpO6P//0PUtrMRzd+ygvELPSTnCIoHOKV0EBVqDiGHQLzESVxa\niqItKpy0vHFbDbDd/dZUNVQ91CLEk9QCVdEQwU0l4hkyFOmH17x4kHdhrhdN\nw1mxv/sWzfmKqhBXPu8yJ4gQG+tzHDjpD4IFOjcKpf5R6+X9YOHW8+pVzQec\nNBFuezsC5CkKAkd73Ji8DNMeJ1cnCORgC5Dz3obQTNzdJGspenmphYKpO2q+\nv6hG\r\n=NaqX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBCYpMXuSr3nsAraXQKgwP4u476SU9L3/p53byoDxqArAiEAjnt4xUlvmmfCw2JIYJ0dy5JP9rTKwXyz+02IyiJSDMs="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.0_1595998508014_0.34908562205236016"},"_hasShrinkwrap":false},"0.4.2-alpha.15":{"name":"@gjv/redux-slice-factory","version":"0.4.2-alpha.15","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.0","@gjv/eslint-config-typescript":"^0.4.2-alpha.15+bc7de67","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/lodash":"^4.14.157","tsdx":"^0.13.2"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"bc7de67bff636ea6d487b21918bd21087b6befdb","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.4.2-alpha.15","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.22.1/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-NRT6pyVH2qgHf+5l3f/WBiGLAHEcG7DPhsuCBSRiPSmXHgp/iJ60v7OcOz16SLd9d8pZOSlond1ELOGZMy0rXQ==","shasum":"05bfc53b034cd33423518b0ed1f8488c8870c345","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.4.2-alpha.15.tgz","fileCount":28,"unpackedSize":192620,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfIQJWCRA9TVsSAnZWagAAww8P/2PgfyPamLteW2IB8aCn\nBCXZ2ij8yvuebRS4EMhVC4/PeJtlvvaH3HCkULcpO8mCb2nWV9poSQnkYhN7\noYkJMy1rcVLUpgUDNL2TxMbq0Ipe3Sa3ExL+Aq0m2ySkeFyNPFCioLLXAwli\nP51u97G63wWxLN84yXzVRTxCZmpNQ48xqVl1G3ictvl/U0RkdpPpiS0JbV+x\ndWs0lPkXb7EA+B2fX5V2xC7nhnFcDnkEw6yIUAra75ZRwqDZce5DanSv7kLd\nhZhy2mC5HCqRYYyJjwzSVL3valFRYqaDb6GyxcD3TWXnn2+P8gjGfDyoCAk2\nAfNSbg0RehkQT8Sjr0zDg4MvEUI4cGN3kYEmR3BApU7Jyd8fliMlijVa+ugB\nEuomwy/MpNyoMoAq7R8rJHCcnkNfc2rbWIyH4Bp27Nq3b73dW/5FVf0VOhzr\nzKJKKY8Tt7A/9hDVmOlET/Kpe7ZCQL0+bxmhhduRqWCIEmSbqYYH28flFEGS\nK1W1fyroLXARSny7UNWQFxbqK/JSrlrb3XBZO6ddYxEfQwwWl4BsDP4axDbA\nS5sK+eD8qHLuOxok5WZ8yoJT+5WjPhz7NmjpyHDPs6S96337hgsg1LdOwidn\nG4HretLeEwd07iDEq8xu4T41Ve8xufTv04bBQO4c1YxewJG/SNZuw1ua6pOe\nsUVr\r\n=nEQV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCMcnkybfg/rIf+vYKwPaF+XR1lQf92jFhJ8AjCxLSWrQIhAMZxY7/5UOqPzr+WIGM+wVoZOWakrwHZ9efksmUODmSm"}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.4.2-alpha.15_1595998805776_0.6271400483013323"},"_hasShrinkwrap":false},"0.4.2-alpha.17":{"name":"@gjv/redux-slice-factory","version":"0.4.2-alpha.17","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.0","@gjv/eslint-config-typescript":"^0.4.2-alpha.17+f5d0c70","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/lodash":"^4.14.157","tsdx":"^0.13.2"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"f5d0c70ed320b87b591eeaec22490817b9c67a13","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.4.2-alpha.17","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.22.1/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-AZR5ZN4Rq1/oW09qashvHq9zQKvbm7bdMK4KE+YvLbzlS6OcEbMA0fmNvOzgsiRbKwLqc3ETJLagNKEu5o6XSw==","shasum":"9cae0310b792102e0497a5cd592cb01c4659f856","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.4.2-alpha.17.tgz","fileCount":28,"unpackedSize":192620,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfIjvXCRA9TVsSAnZWagAAEboP/3+XUz4VXfSagDArpcfk\nMZvz9kMWV39I6rZ85hX5zZt0n+dcOuapZxMFkzkkHx1IU0pBMsB3YDlFK5NF\nD2DzbM5vbAJYYY5locRAk396kYdY3Vka6DkjmBTltgC0SgCc/fqysaEZ6kWH\nu2LR467ntKUMljREnJtE2LBRQhupzoADVspPkexv51N61Q0QWAImU6yG2a7U\noqdiRaZ8nEvW9KFWwiWsmhPm82fosgV5A4kSRofAaX1kAL/URVkNtDb9nuec\nVMArwuZaKWwlb/dBzBDHZuBFP12grS60tNbFW2o56mmeKEjSqTKHE2SOY6ps\nPXvZkY10h5v1Gubmr7p1ehOj26zKNg1E1+kEvwYNNBZoV4KRlIOIIvZbKZeQ\neSKProF3vmB/ae08j2DrgMXpeZVQaOUuSi4sIlSkrTGCnQ8X5sMFjyTHwsCP\nK78j+thHNMVv5GIrIF3hRFvbJjYWOU4qlvHEggLQBBuOH5DfItMOTEVydy7S\nI49LtL1tsMWw/U9GfDtGvw4kzscONYJpGS3evvTDNx1M5daupKs7wepx7PDi\nB7WhX5o6D0dTPcp774iONiRNqlyz5+qLkSm9fEIBc0meJUBHCOqi2vYr2FhS\npRH5jeZGtPH3TilBf4JZMy/NpiK9GEooEHU13bKLxbn10n9+rwzIYtqC920s\naG36\r\n=5veN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEvLbtgWkp35nvUPavw/VO+Ao/lq61r6VWBYrYDAExkXAiEAnbYc28nFOh4g6gYiD4Uio5KNUdf0WhOl5P/LDG/LwKU="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.4.2-alpha.17_1596079062479_0.42089180265804393"},"_hasShrinkwrap":false},"0.4.2-alpha.18":{"name":"@gjv/redux-slice-factory","version":"0.4.2-alpha.18","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.0","@gjv/eslint-config-typescript":"^0.4.2-alpha.18+e1a80e3","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"e1a80e3d66b2a9b7665e33da55c45850efb1a8d4","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.4.2-alpha.18","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.22.1/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-4ZFpOS0vwF8732+y/Mo1cl84t9Kk2Z2wgctByYtSZjCMY0rkfgkbInQNYWQ/IpLILZhXf2OQonh1rHW5ClelXQ==","shasum":"f3a7989a780936b794bd22c4137f5cf11315f2a5","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.4.2-alpha.18.tgz","fileCount":28,"unpackedSize":189723,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfIlRzCRA9TVsSAnZWagAAY/EP/2KYXGNr1Q7g9gu68dje\nqYwyH0fYNWy5zX0cZlOiEuGYBQzYHuiZ/4gnehcpW1RJyGT3FkY0IjNMxT7y\n2R+0jGhSn3tCajr9zJF9t8DyF+/pgR8NmMx0Y4n6gzvhnqwQe0QSKcVl3IYt\na5EXo3uM4y7LwT0EpFriN0w1BBOMVwtLx55vQ9zXuGxBPfBqMjN20A1UtuYy\nVQOucWk16TxAyEuJ9u3z2LBIr0WnqO8U16VnHr/cBVAdqGHosHtyd8zMUJUM\nV1leXWKtuHeujMXROweqGGk39UKYnnEhl6wbI67RgRzT9/SrMboWsajq+mgV\nkO39z0qxUqCd5BDlfyfT/Jdac5LmkPdewOe3NQ9K11ZBUzEuM/gh9ePQB1N/\nSkccPmrMgsOsHjahAaYQmnER+dwZQ0Hg8loN7G6I+jktX4nErtw23uK1LGC/\nZcnKaRMeB4ArD6E7OR9lDiq+k6m5Mashz8gV4aLzfYEMDjwZZWVweYJYgeN2\n6vi4xfi8+zObBXbklThxq/zJcaSA3doyi0NLu1snOlMdV5fH52xvcZT4ckjd\nedtpmdC5sc2R5/wiibDqbSvpY5BmkRe/j0fjbPmjH+fZ8XvLwfvN41WRj8Di\nH0V4IEW1e5ukzmqupYlXfo6Oq9ba9k9BFFOV1CgXJkEgU9Sh29f5VITjAAuS\n5R3D\r\n=/7V6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAGNBm2Bo9Yfm36SMjhw1NSrhm2N+uOCLubumDw060N5AiEA3skOMut5NK2qxscRCY/1IWyt1Shq+Q0F08/sH3bSOUc="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.4.2-alpha.18_1596085363239_0.35363203579566327"},"_hasShrinkwrap":false},"0.5.1":{"name":"@gjv/redux-slice-factory","version":"0.5.1","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.1","@gjv/eslint-config-typescript":"^0.5.1","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"74fa187c349e2f1cd388f4cfc762d37eadfe0214","_id":"@gjv/redux-slice-factory@0.5.1","_nodeVersion":"13.9.0","_npmVersion":"lerna/3.22.1/node@v13.9.0+x64 (win32)","dist":{"integrity":"sha512-jPstmM6PVtcl0L1Oqw8lUoVGDklmodE6mEWKexsR0u7/9fVkrYNefIyljilzg1+UOZSKRiGltAqfYuMvSqaqKQ==","shasum":"eab753466c8e8e25e8e8b050cedfe07c348b4abb","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.1.tgz","fileCount":28,"unpackedSize":194561,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfIlUACRA9TVsSAnZWagAAXToP/0BGOH+ho3T0o9CgAxBX\n6w6XajZukfViSWasO7UK3LF/aGR1/gUOLBzn4Y5U6F6qn+Khs6OfslV5DRLQ\nPk0eAzSPBoT1vL3R25Avp787NuFY9z69WfzwdGpsDrseTwj5AkrkFhogBoLc\n33Et2RGbE0r9yqO0OQvoH4LQ/z9jRchYd4oEVIaAL/pwwa2miMuxeaY9qRVK\n0iHUf0gN6f9kMRTPcfr1iDL+vIFP68tBh5d5yFR1TP1jlW3c1AiBUO177eDo\n2xoXjf9tXkxzULJ8fFQJdo33S3rcQ+iEffzQZVUY81KR32RebthUVOpJlMzj\n8RHzPla20/wVkKFdMj3MuU+Mvcjg+fXCx8q3qpJ6ORzFp7kAEbzkYgJCD2OY\nc8E/0nuF54lV/FiahluItWFl05lE1mQn314B0cfIsX11M+yvJldxps8+CjLv\nymAxrOxqg/DrfiNIetl2km3Xto7MfahS62PnI3D9E1UHwBjCmQRWJEW57yAO\nc/HNG5PD3X9Kw6H/CgiUmNsDJtZPy8mmqFQifCpg1aNJm7wQxYzdLZr9Eorj\nTUR7yYcTCuWk2k4T0EFh0qILGW9YgumqNLnz+Tak4bsVtsxTlu6FfN86ijRz\n1rJR6d87ozHVEzGbd7IkuEa7VUl4cnx19GhRhtKVe6321OKq2D+7smHKAhZa\nK8dw\r\n=JDIc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDZvUpGa6Uhi8ry+7uC27CO447pBsvc+rEL7ZDUaSZlCQIhANweXbg5iyZa15Omzg9ARBTk1hCKlZeo2fFyp+i81DzH"}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.1_1596085504539_0.998296756696831"},"_hasShrinkwrap":false},"0.4.2-alpha.19":{"name":"@gjv/redux-slice-factory","version":"0.4.2-alpha.19","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.4.2-alpha.19+768506d","@gjv/eslint-config-typescript":"^0.4.2-alpha.19+768506d","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"768506d5ef834763835479a8675d1416fa26c16f","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.4.2-alpha.19","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.22.1/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-QNP+oB4rTeGpglFwZVEMbgOPYxM01RtlwHD7zJyAip1Sb35GXQtA9tGJ+5T4VXy350mXL3XuMmM3eitKIZYUOQ==","shasum":"c66fdc8540ddf808ed1097f08f62e72760d7c097","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.4.2-alpha.19.tgz","fileCount":28,"unpackedSize":189740,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfIlUXCRA9TVsSAnZWagAAj7IP/RZHqR+Q3wh/kQSR3Tl9\nzV4vvBIymy0Ikz6ZGH2Ugol1QqSPaCik3P+oITHXPBlzJq+nydXyQtcHlPGc\n5wo2NtbOp5qo9Q96aQ/+Ecnys4+yGPpNjiyNxt3Pt4qmv+sbQJ9TJPKwmIrb\nNum1kD4bFsROUwk05q/lpo07qEJ5XjqNX5CPtojlgfrLzJs8xkyGx0bPXwBp\nTHQyFwDdU5S4wDSqFTs0Cekn6IahTg+7kNDJPCsTRCmEdf3Q8jf4FexgZaIm\nRQ8JAN3O5fYXe1rj9Wmc5JCqsE3/8rGiEKvHyIIFKGeIOIiND8phnH6B52Ui\nNkWs92Tv1bTPxATCXAQ3O/6CjIBkyuigPOcUDvv7WruFpWlolxPYqAOHIYzR\nGtbBLaUXr1eLCgQFWfiTyNsS0nbGQ40zYCTs6qF1aTC6uU6uxE0xnHSfExcK\ndq7weXd3ElW+pfFu/jVOXpVVLVnIsestU3Git2Knaa++y5yht+rjS8eo4Dwu\npE7HObNn5dxyT0LXX+VB9UfMoqT93g79aoaMxuT6iUpYjkYRgZYZlU0XWTAJ\nJsgcQKfcdzugnc8dN766g+GJdx5gsg43kerIh2BWKWmsdy4B3uts6S+xifYi\naA3PErWpV3RCPGyzaQH91tBPABvP46la2fRz75optOTjb0TywbvIVLDxpfI0\nAQ1j\r\n=69/M\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAa14zBawkof2HECvKckrRqpL3+f4mprZluR7I0BzJADAiEA2/3pUoB0VeQeCzbFJiGo7rt2Q9ME88MsBx5vwM46GO0="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.4.2-alpha.19_1596085526803_0.636261483184412"},"_hasShrinkwrap":false},"0.5.2-alpha.0":{"name":"@gjv/redux-slice-factory","version":"0.5.2-alpha.0","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.1","@gjv/eslint-config-typescript":"^0.5.2-alpha.0+9df557b","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"9df557bd4e3224cd2fe06797ae8d4515c3a99583","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.5.2-alpha.0","_nodeVersion":"12.18.2","_npmVersion":"lerna/3.22.1/node@v12.18.2+x64 (linux)","dist":{"integrity":"sha512-+5e1H1Ss98//7d5n+QoQP3jqwbvc+TpwVkUyYSXbkbUPH2ssjuqSVBqgBtiZ63os1PM+3PmO5OmnVrw95LjoRw==","shasum":"595411b02b428e3f04ef463d43674d27f1bd4e73","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.2-alpha.0.tgz","fileCount":28,"unpackedSize":189721,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfIlY/CRA9TVsSAnZWagAAFx0P/jo5/dVTWErIzNoPwJGU\nt0K6AzHmRg3H1IHMHmZQvLxKiCHJDEHLMi4TEk3zcmwxktiZ5O05uQFCK7pF\n3ezZ6+WOxMnoQxoZnMgQNr+8ELbOVHLJ33ITvcFgxW0tj8gWCC0rysk9WnNj\no4TWPprcT2EIFlJEVhupdTAWZz8COljFU3Y8+FO4Q4NAIPBLRriKGxRs+eMz\nXUlNzNM4vFRBXEi5krQXlMqWJKl8eK5Zq9KdXI7wQ59Q1dT1HlBnMRKmrpEh\n7UjCIKD8VoN4DBUUJDvsrNNJjeHVEcQu0WfWLMshIvLPGMk4nnzynVj+JByO\nd+K5Furb7ENOPa4ljVqJ0W7oPH3kTk5yGY0odZrE3WEahXFmfqgFL5imtB+1\nIo3Tr5emskMWKXuSWBGL/88xgoe0jfeGpHCUFA2nBsG2Ycp7Gw+FQ9Plcfq2\nepNB0O6JPqi8wDN7Q9tK02ISqjrKNOMYTDduVMh9fWQ/mUgubY739PypD3L5\nnYnzFessURVbQmGb4M2zt3jbh5UpRkWtJ0xiLG9LzrsfFMxdxpb/7BR2az5p\nkx7Ga4ux2CZlumsR9Vb2gd37Nxp9K4hHchxZGG+6txaq86KXZQqQlulLtHt3\nUUT+56gV3+ruc8oo62v5Ou8pfllIbEnyRrPx9Q1DJWuT+cLzI1P75sw9Laer\nQ4TM\r\n=Ez8B\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDrlJDys75Yt8jovvXWYc/4yZzO01dEaQ5Ypue9lMA4DgIgMFIvyMeqdaD0kQC6GM+utiieMuoiDmNoTHah3p14VjM="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.2-alpha.0_1596085823021_0.6739221943483937"},"_hasShrinkwrap":false},"0.5.2-alpha.1":{"name":"@gjv/redux-slice-factory","version":"0.5.2-alpha.1","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.1","@gjv/eslint-config-typescript":"^0.5.1","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"27afe7c6969b14faba0584d58557018fb0305152","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.5.2-alpha.1","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-bBpyf7gt5bhZ+at7gpDLMrLampvS6w7+z+YPClMRSbCtApNPy01NQbIjh/xbDRu8IxTi/QUH0NutyN+27gz4Hw==","shasum":"f39bd330d935e4ba1fb0c9537ffcf6da0df3e10d","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.2-alpha.1.tgz","fileCount":28,"unpackedSize":190545,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfJyDjCRA9TVsSAnZWagAAlngQAKEfmQhnaq1L3lDK7st8\n7h/Zx4cRQylV5+SOLk7pHmBkisD3enY3PQeDMaWJRheeWiCuqtDESFBoYCED\nhjHrQQIqXgOZO2uVv5yTx9YiXl8AFPiITRqPTcntdCxx2/OleTZ0e305kZFV\nOWH4Er7NxXtUMU4xapQw9BApy3fxs8Bi8k8EAVcjyjzeuPF0roIrMT/2FJAM\niE4e/CA6mz+ZaCrxW7/lykQ2N1pgOThWz0B2wCh6i+xTzHNfZE6U/PLk14Q/\nj0Dar4PzPxm81zUuKb/h9rD2XqSZM32CoHaIvhYi1hTKHPgBECAJfooRBAD0\nZnF0smN035cPlL6fGFHbQNaRQ6hwoHpqQC1ND4CFRhcJwHD0TIGDVPnQTvyA\nO5TT3gL47j/7EDVR2ce184BZIvFxsoFP/3y3PM6eV9CyYxam8iXC84URZYJr\nASE+T1zqbRQDhjE9r3tqhjAv3dovlRdCiC/KlzKrX7Pg1bQk/uGpDCawjB/W\nyrnosUwNKLbcW5CcTbo8fiIm5NdQjNwnQLyqhN5jdabuFoaJ0GOY8zeP56Uy\njdttln6S1AWKLkxojPYA8/MBoovNYq+f+aZETbk9v8un+BnwE02hWiuy/Yxi\nl4fkwS5CrzztTlMyMNvVFEDeBN4i9xcacebx6Col959UKo3210uOHQqS8bg3\nhxAg\r\n=CDeb\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCITKmI50mL02scOwFAFshj56Xpp8DNs0AcianWfdNpCgIgeh8j9aoSiBGt8S1UW9sXtaTUv+7KM1d4FQz3vK/TjOU="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.2-alpha.1_1596399843476_0.885743750029309"},"_hasShrinkwrap":false},"0.5.2":{"name":"@gjv/redux-slice-factory","version":"0.5.2","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.1","@gjv/eslint-config-typescript":"^0.5.2","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"a0285ef1e9dbc735f36f20b875f8c4d0e03e272f","_id":"@gjv/redux-slice-factory@0.5.2","_nodeVersion":"13.9.0","_npmVersion":"lerna/3.22.1/node@v13.9.0+x64 (win32)","dist":{"integrity":"sha512-yrIHwtfeHoXiEq4424ZZqgHFyxntrnPsuBMtPp+fhLUWK56EVXQ2a27nuoxDXuukWAGDzgXuQw1d9rbXmnr76Q==","shasum":"b8d3220580a8d95cf8a6e5fdbc4d71c94e30a038","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.2.tgz","fileCount":28,"unpackedSize":195408,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfJyEsCRA9TVsSAnZWagAA+wcP/06NaFmNeYx3LN7vn+c7\ntR5absFYTQfyJsKzoCe8uPGeAVYp1Z4v/vOH7V9fSg9zBiilT6zZY6yonoNE\nymU3bVLALcdWzau4EFMkFVpqdSdU3IW41+K9X2XvrGoo3Z/DOQ/o9Wal8ew/\npqYbYjUORHoa9Lif2ekvcfBwHmCNEQ3mOqbr+QYx3z03/uyI1+i4GC5lfEs/\n+6N7ViEpJoWE9ZlOWVpXJxjJcsfjK6XUeTdw0dwp29IZKMwDI1yiiGozjUat\nObTINRXAoYON71z9VwbmRUZ3W1d4Kwz9XEIeJnxtCO+3Fh/ZZO+f6fomezba\n7LhgKBZZZRMggBZhAYunIDSKqfuohJUCIGctz3nutx26GU6EID+5s7tgsHSF\nbNb/aSlex8TFj4B+FvnVqP/cRACJl8qe0Ggm8AgIPbT2Tkx/xrvXXyEHubNo\nMCcyDjVv2xIu4peSd3Nrrjll1UN9Zah6s/1V6nvSJ5UQylWg3q2m0LNtmcii\n6NdkMqaLndauH8zxkxXCrtYpUhStMSRy8cZZgMKxNCP/Z2I05OgFKPMR0Ffz\nluCH0ZREwo1nP2v+sr2G9wazeYcNeu3b4Rhtswwd6ZfZQQ4yZFQt/OqxSrCM\nTS9QYOAV4tmJcb+FtrSkHyKM1fKI7rzyZEfDur3F2Ga9wGYYMGKiuWRfcet4\nib08\r\n=MU+U\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBHHMJHhFkst4uszI0zeGxRw2vjjev3oXq6GeSgiQazNAiEA7BbCIFyY17VTa59+wE3ZWCqVWJ9524dsmQfbPMEUg18="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.2_1596399915795_0.9263134494455381"},"_hasShrinkwrap":false},"0.5.3-alpha.0":{"name":"@gjv/redux-slice-factory","version":"0.5.3-alpha.0","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.1","@gjv/eslint-config-typescript":"^0.5.2","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"80d5466f13e08391cfb8dd6ea93d5c0db6b13275","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.5.3-alpha.0","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-wlxGAPR9KSXeg5eqwnk9zqSpWnr5bcMbB47IYooahz7hFFpXSnsuBKJSeHPJ5sHlWrshJi9iAL4nqyjmlf6qdQ==","shasum":"e917f000996e7cc528074dbeba556153fdb2ba5b","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.3-alpha.0.tgz","fileCount":28,"unpackedSize":190545,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfJyI7CRA9TVsSAnZWagAA49kQAIv3cnDHNaVhUkkaEP7v\nTqIE0hUaPKcdcMqSWtvtbGgHM/wmWOAauvY9YxU7wkFsCJkofFuNDobqd3gi\n6xYEn3pghYlN30KjZfCbmkfHm6Czs0p+AiLNlnVHt9zZxoA0DKGEzDN/Obtf\n/hbfjP0WG2cGkz6cEUi349Dk2JtygI4ae6FPsQ2K8QoZbI8XlVPY9z7TZONW\nSVd+SS0oyVoXKwZ7Xm44jNNCdzvwFq97COY5B1SkvKW/XuNWOBVSY0767PBJ\nKzgKVK6A/2UU4YfLHyQ1zcSQX0QKoys+aq8qcV8C7fKdvpPBWfaMrMqMVBLi\n4qgPx0IzN2oK5nmXX7wlszJWd/xDXLYeBm4GYG7pcnLK68yjofOveKlwsRuO\nWoJWCo1z0y2CnbA4+gALEjwoSShRawpVyTbR0Yxm7K63rAnakCmigVVpEi5X\nhxFf7Q1ANs5TQhjgLVetHmmfeVoqW9uTRRoRvszN8Gv09hmRYgEm4j4Cu0bZ\nF5G3N8VL4rC5wJ29gWKg+MWXtpP9oChomGSmFen1AW32gn93PJMXhnTRojz0\n6051HNaaJnmnHlwYeS/gQwsvbRFfXr4Qz0GTBwtfaCwxmMBpMUSjyIkQrg4r\nPwYzD4nKYlAfkR8pmq2thLdxpnZN6/l4UHMYQeD/GbFT3lihx/lVGeKiJP4D\n6OIN\r\n=X8hT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBatUHwiJ4H11GDQKXbjYL1Z3RMWnFuYEOR7/YzQ4f7+AiEArxjr6uOUJNhbTzpQekuiIdjgglIqAtBnLTfVZzxK8nU="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.3-alpha.0_1596400187335_0.36791812836159976"},"_hasShrinkwrap":false},"0.5.3":{"name":"@gjv/redux-slice-factory","version":"0.5.3","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.1","@gjv/eslint-config-typescript":"^0.5.2","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"980b8fbf34e30a5cc2741a2d0bd28ff9c3f9d423","_id":"@gjv/redux-slice-factory@0.5.3","_nodeVersion":"13.9.0","_npmVersion":"lerna/3.22.1/node@v13.9.0+x64 (win32)","dist":{"integrity":"sha512-zerCND8VpuzSQhkwRTPa162akbbRGzlHCCng+tieHQAFSUHiQ/oeELmym5tzPpouF8CeuZEVvC6eKKgbVIq1Yw==","shasum":"39b31af9f9188bd55185993522e5161549d3c792","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.3.tgz","fileCount":28,"unpackedSize":195408,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfJ1i5CRA9TVsSAnZWagAA3sgP/37NH236Y7pdoC942R4F\ny9DNh8vMt++M/8rHJcCATgdLI5ERE1OOMM7mIkZTlpvqibWw1f5qFi2XM0fK\ndlrHqR/NfzQQzS1/p9Wh05brlCk92DqFEx075A/lR2QvCAHIZoZqhBTSpBZb\nuJxz56M8xRLWpijl7d9v0oyubcymvmbqnobWKqyFy03/jA+3YBhJGW7iejqC\n21lZfR/XOhAJYrP+XKhvYx/e2uvescFFWJOmLaVLCdC1nqZ9rO74jPIUp72K\n1sltBQtcLsGPvaBkYg4vHS6Utqz1xQVEorts75QvEFYf8OuxbulbTAqMujeR\nhi4KsnSw2xZcN8oryZYZYvhvXWV1BAwaIt61jyTc/oRTTN1k7X6az2tBbPyw\nequcpE8LCrnT9+7A1NU86IDOe7ExDMHMZFKAtEx7uWTLV/4Kx3LJxo3JlOv8\nE2XBTPLWg0MTJ5Kd1NdgXt6knISAl5mYzxOQWezWQZq4OTfAjhy7MQNkh1Kx\nwnSVTGtGhmfiOpnbYyO6Sdsdime8qhd1q0I/IfCPlm6Kzr2er+1UdBghcEA3\nORE6TFqaufFou4Y+w/hi2UPjOr9FHKIOQVI1uakTLVl2ijva+bjI6fd1KuJl\nsiOMxoF/ifs0V6XBD1WFCjTvTQo+lrPj/jn+sxI/al9SzCHXT3A+NTEyhpjc\nnYqo\r\n=Vm74\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFT6FR+qFCuSCQLOH82U0oKCraBT3jhIK2Y9IrN3ygIcAiBfhs3iN9mfLQjiTIcNM01jpaKtYZx5jamrI7qQ9eQcow=="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.3_1596414136721_0.16640175961901904"},"_hasShrinkwrap":false},"0.5.6-alpha.0":{"name":"@gjv/redux-slice-factory","version":"0.5.6-alpha.0","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.1","@gjv/eslint-config-typescript":"^0.5.2","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"gitHead":"9fcbf4bd7d64cc70b6571502f78e1c282e986f85","readme":"# `redux-slice-factory`\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal?\nThe goal of this package is to provide:\n- familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- common set of actions and selectors shared by slices of the same data structure\n\n## What's included?\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice?\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.5.6-alpha.0","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-Qz+qUZkdsuV33lXQ0N/dnQcAn07cGad/txUHOaPym2US4/9XeUG2E1+tazdzpdA2/ngyLc/C67w69BCpvHWnOQ==","shasum":"3356c7da2e68a0bbed405e1f462d9d5dd5537e02","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.6-alpha.0.tgz","fileCount":28,"unpackedSize":190545,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfKMfYCRA9TVsSAnZWagAAk9QP/0lVIIBSF4ryXZ3ySxXf\nCUwLAYv/bAyExXqYoWsqSMUGVZAwTNvCmsIQnERuqos+uTytgviHG+Mg+fkt\n18ZfqurlIMoVP8+I0sDSitiu42NCTylUatKaUNNFdKhg29wahNDOoAwHhE/q\nJy7SINFJ3ye0/fzh2KHVUZAUvRJF8FdIbucF0C8c4lG7Q6wJnTpwMz5R78bp\n8d5ZI3AoMpg9WQ9FaEZsQrTYzPaIBpPK76IgCpLzoAarbqNwjW6ft04lGwZd\nKjW9sFpYr+aTPE+T8+NDd31QpHl10fuWb6o4pl7d0Knou1XKd5p3BMgwE+rq\nzL8IRrIX/nDt3nmc9BcS2AxryLLGLtspdVhV0nX9qCvw5jQ4rznhPjuqfHSy\ndUNh75C5qHNuGlv6Uug2QotrgLed/U7zWRg4vqb/0jDTxITjPah/ogd4PkEN\nnOk9khmQlTYLSviIYd7vPn57eyx5VmFBH+mXvNS2okgtwgEdkSapvRRGA8BI\nomS9HMWFyKYCg9s9guSyGH/Q1WX3RcUFjnFd3hYAIO0qaqzCVXmXAqlypC25\nEXG/lTaAltBuh/xYKr8XQSMn7lrr2WXhQwLItdLCEAF9tC2j7ctGs9d2R0Go\nJtAuqzSrAVL9/b8gclW1UW2/GWNAyNc3qbizvdhbRH7PlWyKCMvDPg8yW9Q6\ny74f\r\n=KwdN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCdVy82RsTpySP3HuITQxnUdm52OIMjDIgrBPCFg+X0MwIgXqvfOxdUsyPdaP8si9FNZhQgdH5XCiQKubg/Pij+zyA="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.6-alpha.0_1596508119965_0.5600589078403198"},"_hasShrinkwrap":false},"0.5.6-alpha.1":{"name":"@gjv/redux-slice-factory","version":"0.5.6-alpha.1","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.1","@gjv/eslint-config-typescript":"^0.5.2","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"7e338ac05704c4348093b25a129f47dc5616a040","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## [💾 Install](#install)\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## [🏆 What's the goal?](#goal)\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## [📦 What's included?](#contents)\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## [🍕 What's a slice?](#define-slice)\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## [💻 Show me the code](#examples)\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.5.6-alpha.1","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-ojaDIpF+hUX0ejOb4hHU64aC9YAMeKwD1HXme9gaW60BY7u0VCJBbtnC4Feju6GV6lTzhiM9Ak5C4B4Kga9dew==","shasum":"148d528b3d4f9944255497a5a81db7045f79b524","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.6-alpha.1.tgz","fileCount":28,"unpackedSize":190889,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfOtLsCRA9TVsSAnZWagAArngQAIBU9U4U7wCt5edvKfFs\nVdNLogUntOcrzDproQCewUfS+KTDDKxVxtZPYtwgGwbMEiFqoIuFk43Og8Zj\nx+aJZPB0wR7hoM4VXnqlCAa13yz2TACf3WL3b2w4iHDTkZbL79uWMu8bfOTM\n4JSNsUuSY7A2pNIRlvryw1HKNOgQzBMMjGAV0qT0DPT6qI64FS7YJNr93lA3\ng/RM92BEt972iidr7Z1YIKBZ7yPq/mwx4BD1/+e4OvUrTbGMKilmPUHH0LTQ\n/JRy0gtYXgJGmnZxqvFZh6w4wT7/rpKyHT4p2lXY9OLZC4qAovAUmQ/yZNnA\ny7XYvSUCvrHLsYfGviu+PsRxHoqrZk/sPFHNE3e+vwoO2ztYGNhk/Fvd01Bq\nm4t7bZEReA19u7j+bdfm96xaW7SYWMI8X2Zb2PIrTRoy80aNODeqDHwrCc9d\nXD+MfQehDZRnZE3hWhy8HgkUz8Aw9PP17vksIgNXIePscXZ8igF1q9Du0dh5\naYkvHxFUi8sMLPuGVIYiPPW4xanZRH250xBITypqsVl00J6FPIuOBbd0bDDc\nB0lr7SiQwe0tMbrDnJtMIvV3f6DOZx7zF2Gh3K1s4n/wdgw0HTFeLZ2xlAZL\nhlHPczIrc5VCa8FfUREudJCwb3yyT3+7ZqJhzdC+DWmslVS+GtPnwPRdohSQ\nRySF\r\n=Nmwk\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICkBFskG028PEYC/uMOuSMsCMeHvX6P5YYfhfWUjgzSLAiA/8eYlf/LIzb7Y1Ri2AWyRj25KceEBca+WX9Le6Jxq9w=="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.6-alpha.1_1597690603650_0.9553651175818256"},"_hasShrinkwrap":false},"0.5.6-alpha.3":{"name":"@gjv/redux-slice-factory","version":"0.5.6-alpha.3","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.6-alpha.3+4a34cf7","@gjv/eslint-config-typescript":"^0.5.6-alpha.3+4a34cf7","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"4a34cf73d88f67db7a2606261e667a447eb76fa6","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.5.6-alpha.3","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-MHx2gX7lNdVttdoS/Vs7cR1smPGDZ7KennRjilZBAG37WUhvB77zOORyMvk6BoseNMhO3Jt2mqY41MiQZZHMag==","shasum":"5ee4ab0c66ec038073521b7707ababa607dd7cee","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.6-alpha.3.tgz","fileCount":28,"unpackedSize":190858,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfRIh4CRA9TVsSAnZWagAAkEYP/1MOpBFYoPPODhuUkrKf\nlg8bxnLXw+6PSt/rGyYHZONMpSTuwWjvZIujTDVYvRZ8vLQk5knFIZP0InnE\n5m2OOU1OGSSxfkTF1Jiju9oHeyXf5VdsZY35avP1+Y2+nNnbw+4Jm6iUOBMV\nWKJT8J+YMDOURjG9mCbxFf0p/CO+WtvmmKwLa51vSf2FSB0d4Ck1VK2jMlQ8\nV/s/y07AyMaCfbRAgAQppzH6qpZ9bDwxybL6N2KHm4qyCQsUGyBzy/SXMGOf\nje0/fnXj2eztKSXNeQBf91G2mV9jzLw/rvIM/iVkJ74QoNYW5mQQlsgb9LOj\nH6lxnLp4s2ct4IplvjAQRzYLw+IVUWJB1QMCZxClfpoS+cn4gKC1HwjcE/nO\nKh7VmwkT/gmv8hWzSHfzdRjOdzosDlEHbEZpvTqDwTBImvF+dixMUuqAlk/6\nkdP2AHKSx3SylKtic5JCAbh+lVhv6aLqW0cYGMBz46hGnEMOGVaqJXFUsQIe\n1ilPKWSuzaTlKjA88GAOTb1CMxQ77/Orjtfd1VqnRfqsKSXktuGIM+JBknoA\nNGw3oD0qHuWVyw1sYIAcTngpDDTjk/iZKtYcSFxZnXs/d71lqzMqnJ5f2qss\nXhoDYUSa+tpOsl2gEoyj+6+AqPPWrBlmOQ0DWrvPaeQZDcVno9ca+H2uhJfA\nzT50\r\n=MPRc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEWOX/N4f+WV1aS58hcA24VQ8ArF8hz/2uyCswSZqr55AiAl8SNnFOavVM4NJR4xS78Rup5f+l8YEDvLGlmFYwYniw=="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.6-alpha.3_1598326904089_0.8318145811905457"},"_hasShrinkwrap":false},"0.5.6-alpha.4":{"name":"@gjv/redux-slice-factory","version":"0.5.6-alpha.4","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.1","@gjv/eslint-config-typescript":"^0.5.2","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"d4f2c811d2d04c08ccecc9a1d0f07fa00e31ef37","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.5.6-alpha.4","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-bi25kdpol4xqNL2foH5myGkUKKVUJam+I+nL3sYBJrof2quI2zY4Dk2Tu8nSXre9f+YZlHkAJ/XTn+Rpp06okw==","shasum":"bd502d22e7d17e89ff3a11939463e253def62840","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.6-alpha.4.tgz","fileCount":28,"unpackedSize":190826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfRIpgCRA9TVsSAnZWagAAskIP/Al2rXAkiS6n1BSrKrIT\nqDoX5c5Le5OUTJ6ywunMLNPZ5dZvJtPOnWAOoaS79KWYKENxd3lngWlU+i+y\nVCQwMJBS/rDZASVd1eZ7gHjPv9p65LXGYYJOCS206u4I/T4zbb/NGzT2KdOe\nPhZQ+1c1Zvu+4FYUg09Eni9HFZMOHTY5nfDSKz6jkNIR96QFl/5OhizckbDc\n988FiGlz7akBNepYoBDQHY8bNbwc0EENgeAdAmWlJKzSAUO4VoNc2+ms3Zcn\nhMW13ZyJvdvIsuEgLnMOmewXkOXIYFmvGJdamtZQZO/FMKTNbMQrAYjq7xv7\n9TJCwvYBg13y+7DTICdCC+ZHeqPlzzOoEnOveaNGXAwCQpYYW/e3BQGI8/My\nP7kgjcxvi2McDBoCpY163IIiOjJ6woHrl/u+qNklAuTDtCHXaoF0pbO+1Fit\nHjmca0KY8t4P8ppXRQ5PmDu3F7TH9XKfvWrYX008P7SFd+m64mLDPWmBaB27\nwWLmLwcXDkKR67VWP0/gIwt72XohK58fEJmX0VrsTLV/6s/Qaks45yuH+zle\nv9fCnJdhscVHljm4dJnhbUG6Arf5nkfLnHin/Ad+VAQT8a240z8nnOSehSjy\nXxnaYyDOlBrlfbhZ6T1t9eiaWRCLTNP57FQGrvSsFje828uS6mNQRTKUI8oH\n29jN\r\n=tTyQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCwg6i2aTTcLQb8SKLjsEh0PAB0Qghz6Jlw9bDwMYmsCwIhAJzT/OQTElzRIvpjOvLz8dybmfgNaCd5KnQRFABO/Lyq"}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.6-alpha.4_1598327391799_0.8364932963753011"},"_hasShrinkwrap":false},"0.5.6-alpha.6":{"name":"@gjv/redux-slice-factory","version":"0.5.6-alpha.6","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.1","@gjv/eslint-config-typescript":"^0.5.2","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"5021a0dc80d5bbcf1e758ac56ded1d13d901fca2","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.5.6-alpha.6","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-glZoPKT7n+8924B6D/iYUyctwZt7S8emKZqGwiu9+D8JoQnwIaZS29iLG6oboTs8lnxU1NKWAWCj3LwHs0PIVw==","shasum":"037719cda726e1799f50d327c1dd03c38a7d99c9","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.6-alpha.6.tgz","fileCount":28,"unpackedSize":190826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfRIpoCRA9TVsSAnZWagAAhR4QAIlH32XwOFNwyipcr8IQ\nBoUul8xQy8kAHrdmdg7cxYdr0dg7z0uNR4LQwAs94mAtvE4c1HnHVCnn0DG0\npZyog42H6aMonNZNo+zE7pG5af7E32cu27uGtWODQ+6kXBJr/HHfW7FKA3rG\nTWeStn2wiAdph5sdrWjWXYuU2aNbIxNJMYiRvTSV+79KYJfwIeHvcJSyA8W/\nargAVJvfrkLTOcdcMFBDKWt0+hVIvrClxS3UO1sQpz1xnHZrLLmwvc5YuSSP\nMhAojEz3l3/zexC6wwSmQhHecOPB0t3yAPb2gJjy08F+gfa2z3/FloJJoJDD\nM0W5fwRDkv2oxwt7lMIVNSo2Y15H+Q4ZOf0uCkXixMMks/LZnkbd7UPUzHv+\nJyibFtRIFCVJNfdpRF9U8d54D3KAzEn+OS1+bvIyI8L9pqCRD1xm4ZBjlpvs\n5Q5J3GfrAmpH2dHxxX5NY+/DrA7HlwqBejDY9eOlahMGUuE3jgRL2S+WUvu3\nBd8kaGrTDmeFJ2hK4T9s3W9zpZYEzLJSiKBkvV2WYQvT65VwDdw0WM7ZYke4\n8tDaEfVBR5vXA8vs8QpsLuoniYYnUQJQWnxhnSJtw2bGLxG8L1/0O70U2E1O\nQqXP3R6pYNQjSEMynKO5OQY3U6X+F0dtwMlFYpwXqm28MQJKD6Zoe6icNF5Q\n7k5N\r\n=PQ2j\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCUfTRxhyH0e/rlbyBkAZwlXy65AF/fg5dbq0NLZlnXDwIhAMOgYvVsSuWJwZj3Ph1DGRK7+lbnWEDX5gI031K6LYih"}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.6-alpha.6_1598327399956_0.7167928976897535"},"_hasShrinkwrap":false},"0.5.6-alpha.8":{"name":"@gjv/redux-slice-factory","version":"0.5.6-alpha.8","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.1","@gjv/eslint-config-typescript":"^0.5.6-alpha.8+9746947","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"97469479c11e203b26998231500e055886587276","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.5.6-alpha.8","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-Lg9jIdQzXgJ9fqqxJcdrkr0K6HqjwJ9zCEn5Xa8EtYX3H9LrkuNTJvo9xURKrUMXBJ3PFX7pVsxiejU/Gzcl0A==","shasum":"99ff4500e436eba3bd383761ae9ee95ab5c64067","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.6-alpha.8.tgz","fileCount":28,"unpackedSize":190842,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfRIz5CRA9TVsSAnZWagAAFRMP/2/hiz6rvm4k73PO18vO\nvuA7uDSuHdUYcEdTdZMsYkmvSbeX8j9uOipobQEkdJQlmXTumFcmFaXQcZFd\njDXCbLmwcvI1n2Sta/nAEEGGjlV6kDVMPjmZIn7LV4WT9YVC2YZh/RJ+Jjtx\nhbXFtK9W53R2i+B7W26d7F5tGBKbadSAfHt7O40AD3Z6Rnkmb2da88dkLawA\nb1o1cLBCpRPTnkmv3pjzmjWqOwIlkIcmuNfrPxeRk7FnwdvTVXKb1Mxc1oZx\nOHWLRSAeS2oAYW3+TcEW7UgNBSLbUJyXanI2eUUOrhKvftUHZQxYkGfxnCp/\n3JEVuce0e0HX4DZkMNMAfiqntunvCUNVQjd1oPJp71M3PEYE5CVF7tF1K83I\nnW6zMXuEkDLyA66xqN681HtzBAKCCVaB8YZbv832jEFM1c3Nx6+NbgLr4MSH\ndw1EZLxm3GVS/qTH1lBvdg5iQ41euwvuKaNw0ol6nnJqy628JF48/8bn2EAR\nHZvPBsi6S1ugZosSTf9k41xNF3NBJDSQngJHSr4b+75sruxXUuQIW5eDB8lv\niVicxxy0aodoQKJG0+E3EMkYUmj7crbSrKPhTGQhJhcT4Cg2YNNIfsGL8Eau\nc7ximtRYdzHjtUhAcHjDeWfG62FQePyQHimuDRpJCtlHyB8XHHbI+3AgIKPx\nUv2q\r\n=4PH7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDnXYUiqdTGKFn0DkEFXtXCbkll3HBNBeavR3LcYUOKhAIgWOkrcTRWR09tg5YeEI4wlUh97Gibjz3WJYg/1w4RSJM="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.6-alpha.8_1598328057520_0.07456500260053445"},"_hasShrinkwrap":false},"0.5.6-alpha.9":{"name":"@gjv/redux-slice-factory","version":"0.5.6-alpha.9","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.1","@gjv/eslint-config-typescript":"^0.5.2","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"13426cfd7560349e364f69f98ff14c4528752e6e","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.5.6-alpha.9","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-Aqi/oCehSw+qRwUvH8evuhw53u8xrZ72LFkPhZI4dsLGQ3gr8nxlNv4SAtrinKGDPP2Q8qzWPEILHAXDpMw9dw==","shasum":"a4989474033c2ec80592de2eb06a9110cfe2f9e6","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.6-alpha.9.tgz","fileCount":28,"unpackedSize":190826,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfRI3ECRA9TVsSAnZWagAAqOMP/1EfrHyhX/X/2czI8DNW\nQkSkK7DznLOVr9xTOM6MQpOJBTPGT1aDC/hqSFmQQBhQugH/t6y3wCJKSF+i\nj3Br51kEsl/SFSRbqy3gPCHIlLaU18KvHwX8SGmODgl4pjO7oo3Uc5ANYvQI\niw8NlGczL48KJ+wtBEh8bA1KOEjSYsmrNlSbF/z9I51BnBblnY0VE7sEAdFr\nMzQQG8ocDx+/3mSWF6V6u3r2JoY03o99Y0/BMqT1uM14QULLBfQS9Yc1bcHn\nXH3X/UoX+y838QwZD0AEAnprwoDB4SgujcRcnV9Qz6QTkY/FMcxfJ+kdMzYT\nFHrXrRKPrEOKFkfmlytanzDNSl7zTKg2NWTMK1en+AGK14qSTJBnLvTllo1L\nkr0ZaDC3zp4iL3hKXs+3QZfcyL/i5Kr/bLB0INwkFRKtaQ5+VG0Pzsmj05b3\nSTI1gYyPjy2BsPOeoDogE6t4SGpGIK009FXSESp3eBdFaqlenc0C0sMKIPKj\npb+G4z+/19sTk6Gbd3zehhty4tsb25wuE4a3WWvjsSJP1f8LfkAPz14vCfHF\nFrpG8OIr/Jgcu5Q7Jlmr6EP/mW3NbhMPcPXSOxYLoHca3Ci0W7c4V8kqkxbM\nemP3CTAnA41kDudZBepxmlLVTOQIDhYNOijpb93jctsEz2trwR/tNXzqbqMf\no/eY\r\n=XyyG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDhqIpHf/IBCRfMBSriChcX1MCrq9aL1C7Udl8gyEnf9wIgFi2qB2tUAAW+4S3o/ltWQTBaGmQ0DgF573x/3eioTj0="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.6-alpha.9_1598328259876_0.715051798672238"},"_hasShrinkwrap":false},"0.5.6-alpha.10":{"name":"@gjv/redux-slice-factory","version":"0.5.6-alpha.10","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.1","@gjv/eslint-config-typescript":"^0.5.2","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"4b72e034e66b2e16f8e4ed1f11370cbfaa7684c1","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.5.6-alpha.10","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-4RyGJ7X8iPox428DySLOP7WcfJG8C6OcNiX7xbIsZtl9coEIV8mKCg/5Uy6JvTdVtD2tX0noedHyG497K0H1Jg==","shasum":"337aaec1974cb5c6f24e809c9071dfab5a347fff","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.6-alpha.10.tgz","fileCount":28,"unpackedSize":190827,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfRI5gCRA9TVsSAnZWagAARVEQAJjIJKbtGuSJtmhzFf41\n/gQOf7z82T6L2VhlWKodKYRI8qov4yiy+WRGkV35Oal/KtsZcoQQoklVGNj/\nnJYfw3BlT7zsL69gDSHrbLnJO2n8eVMX9GHDfjp81vnEmL5BhiMxNfQCHsCr\n+bqQ7dU5CpQBHDJG5Pi31M23OK63nj8nNmP7CzCOwjkQlPlSK/OK6u5aEv8t\nv+4skt8AlqKR6VkwA41pW4vVm3pSAPynFc/B0v+S7WtieAaGRbYIAVOygEIq\nKxih5oKBRBoji2c8YNTv68XKhnw3rMFpxL7CuZkUWNUU5PQJ8YiKh19SbjRn\nnKkwPgFT+OzRt6a317HD79sGd1i3moHHS/qVKLkfyNDZXij9l194eWumVDCv\noZul1unYkDiV1QDZ0eRBnUoPeNxjjK+3EzxL3ZC67TeIelj4RJwCoP80CXTl\nTeN+K5QAj5vQgulFzITOZEU88TX7WEgwIAfa2iF+MySYtXg1bGd82DID2atf\ns1kXm2Lm1Gv04CL3yfkhH1aX7dCgyeaGNRBywwv0oZWQ4Ov8IfDHB1lREoOo\nXoakG3DxZIyk9Z+8dtG2xNYF0lLwz4W5Mvxt8X/FYUeyBgAKyQVs+utY77Yl\ne30/AWOxppfZMTEuudTH5y8NTJ9tjaRGeO9eTlFGo7g8n9MEMUw8ABhedlld\nfZV7\r\n=Spgt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCM+CAzvhsEW+PUKcfzk99RFTxQRuOSQpEl/CT4c66zzgIhAM3U8o4JMz8bVYYOyleYJYtlgYc/B20Qq1L+87555mMP"}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.6-alpha.10_1598328415992_0.5535534293978459"},"_hasShrinkwrap":false},"0.5.6":{"name":"@gjv/redux-slice-factory","version":"0.5.6","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.6","@gjv/eslint-config-typescript":"^0.5.6","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"45712ecc923de40fd4f115f8df7386eba4a7dbfa","_id":"@gjv/redux-slice-factory@0.5.6","_nodeVersion":"14.4.0","_npmVersion":"lerna/3.22.1/node@v14.4.0+x64 (win32)","dist":{"integrity":"sha512-Mx+bRaJp4bQnxTtbkKYusKtcQ5RWGWC1rUbOh6l3Kjn+5PXZZqAWVEZtOvHxdhEohH4hYbFzP0ejPuV1E4Ikzw==","shasum":"f495144db0ea3cd9e962909c09d85e9f3adf01bf","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.6.tgz","fileCount":28,"unpackedSize":195693,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfRI+3CRA9TVsSAnZWagAAPWQP/RRYgDHnc2j2t8yWY6Rf\nUTBwH+uIhfeo3G4dKMq1QqW3Yck1m44S0JTax8cnjll+kZXAAw9t6sXVrgj+\nYAXmXE2SOGiGffdioa+1wwvlD6Dal5S4OFROLnfgzYBPz2wTAf+1Is9noAOp\nfw4dhsARlKMjOgtwl/SyKCsgQJT6mQUyRMZWL4i14B4EMV0a716a8Vbrl0IP\nBtXgKCaE8r+C4JkdvupLxAt1t6XpQIHWOM54xyXsPoinmJTTgwlv216zOLNk\nMQM0KC+pxhsTcBC7zR31KacIaAdUwTxq66zYgP72JDEVi7wVl88Z2snzCZGO\nFZ2P1JoGVXnPjLBRMb460b0oWPo+KIN0oFAPOODGDL4XddqfeGsBzq8CML88\nQ0APPuWI2wqDmELbTKpUiL43D0s0Oimw+OE8Wi+x3GeF3Xvx+V0/NGQmItt/\nGlXWLLCSzFe4EozTSM2F0eG1RU3+wjS4MEEn3QeCAnkDrrz5JIXDcN9378tT\nTKFd85PnKwpSTQQV/xSho8mrw1F8ql1YQPDQRWvrGIDB40ZqahRNpKRypusd\n0Kw/lg1khC/3nZ1NOfjYbPwh2XrJJoze4N2nHDIv7+bDOHkbJCcXQI/Z01JJ\nNIv/ynjQd/xxy6A3Z4AFBSEJmBVCYmsNyhhcuO/14yNL2tqPVDSAGtRdWzx5\niA6r\r\n=mB4c\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDUepSTBz5eMtyhev4fNNHieQ8jRL7GOaoEkLdVNWN0mgIgAxrfifJBUs6qTb5+N0e74IGhmfZIthrvrs+62Pui1oE="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.6_1598328758802_0.22166689999663425"},"_hasShrinkwrap":false},"0.5.7-alpha.0":{"name":"@gjv/redux-slice-factory","version":"0.5.7-alpha.0","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.6","@gjv/eslint-config-typescript":"^0.5.7-alpha.0+b7674d4","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"b7674d438f9e26623b5cb610057a6d725ce0a375","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.5.7-alpha.0","_nodeVersion":"12.18.3","_npmVersion":"lerna/3.22.1/node@v12.18.3+x64 (linux)","dist":{"integrity":"sha512-zTVDCw01QE6BIMI+1zfY80ETCUtaLxHsEiA3vkj1Fc97cfStbBpLmakVtxEyawT2rP5vXXw2NoH7pcO2a+lHHg==","shasum":"ad5a86a23092d4e3eb492b031feb765ad49eeb34","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.7-alpha.0.tgz","fileCount":28,"unpackedSize":190842,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfRJF0CRA9TVsSAnZWagAARqYP/17lDJAJKUZJfXEb7LfN\nt9jjGGOJ682jTP5pWNKyJ6Bwu6DXe3Pt1NB+DksIxw4860Rg3Zw2ZSwCR++Z\nkImzVkwhMaf5j8TlVRCnF7EWKlFkOi1yhNPIKt4XOBRnzOy1qkTgMuxO0iVh\n60qZhm8o/IhAU6eW+P4x6kiay5kMvFrwMhjKZLSoeQtJ8VRHabUSRDf1jKJD\nvKOpQmg/VI77vs/GJn2VWpE4TzFWIY/2mKDLMdAwvWeD2PuilF0ODOBT11mY\n87ESfgC7yaisdqfSzBglO0V2+/TNECyumFlH2mtYdJYS2TJ/3Cr29a8D54p0\nAvs1gwvldcIvEwqFSj7yqXHn4qIUhn2CLYNn8+QcDxCbJ7mgNaXfYQrhamU5\nJLnNoiAa+c4KzBuHaIPnE479tZBcYvLtMHe/FaHPyJ2Mdb+heGQDfOUNcH2O\n0UzZKeDBu/Dr0j6xG6JWx+JXA7RPO5RGqMwcx5Ay1HzgRXvNYPHwg3+PFx4l\ny72yiFv7gVERQpBuJUlLqsd68TFsJYeeIgtOg4VaOXbJYUMxZZre8SFio9H/\n/I2kollMBGTva313Oss9kEDRZ5/ofit54c3F2kvve2ldG73Q5BolcpZiMwz0\nWA1cVYRqCe5kTvM4bMFGfRDAUXacOJx19he8H+gi58+OStKWeEqCJD3ArAdC\nBaYC\r\n=1NEK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC9vPybaqP+RLt6z8BU+idMHr3zr/p3xZyrEGLHa3116QIgXT3WqvEbMDPkdd59X2Gr30USVbpb2VAUFvUxnKU8jsc="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.7-alpha.0_1598329203652_0.1790777433107018"},"_hasShrinkwrap":false},"0.5.7-alpha.2":{"name":"@gjv/redux-slice-factory","version":"0.5.7-alpha.2","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.6","@gjv/eslint-config-typescript":"^0.5.6","@microsoft/api-extractor":"^7.9.2","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.7","@types/lodash":"^4.14.157","tsdx":"^0.13.2","tslib":"^2.0.0"},"dependencies":{"lodash":"^4.17.15","lodash-es":"^4.17.15"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"c4dd1aa7e2422a06bf6c843f16db6d747153b4b8","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.5.7-alpha.2","_nodeVersion":"12.18.4","_npmVersion":"lerna/3.22.1/node@v12.18.4+x64 (linux)","dist":{"integrity":"sha512-ixoJSFSOX/t5tMBAoMWm4MR1AbFJa+WJ3V4iZLhGRqXKs6uoCw/xTRYPcB7rk3XXGAWaLjbvB1vH/0T3rDAxhg==","shasum":"5a398f78dbca6f57361a62b88006c9ed3e9f3737","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.7-alpha.2.tgz","fileCount":28,"unpackedSize":190855,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfh3FsCRA9TVsSAnZWagAAzVwP/3J/s3UVmi4Kx1P87Nrx\nCQlOsAoCqrSwebI7cRq9HiTwmVslCEjyG54cUOx4oTI+0DdBhYNjQTHowLqm\nSRWpFhEU+3MVmtsYN9MCo28O4TywNAP0q8hlV7g8iz5eqRaUa0Q9lkNYY/Kv\nlr/EXqyOpVy+DTnSVDbp2G5Fgwksn1o35/3Oo3eDmV2LLLNPBSgxORd10QiX\nI/FMj05zj8Xlk8bHotK/2WhJUkaKzlAL6ccxu2wEplnuLELx/+GFm2dsfwpS\nAioYudIoLz6G+J2kYN2G2t1J8MuhY/EAzklU8GteJaGxPsg83SG5/oYtBaAy\nXtGIW3fGZ1Uhbp9UYfce7NU//+izRhYILVYy9lTSK9SIxtCbBTsxWrDmgeMF\nh1nTinW3WPX3eHbIqdzZ9nYvRvvAMNOKiOF2IrXf+Lz1bmIDglVHvpMydrT6\njCR6fd+jDRQl/r5j7vE5skQ9/Jifu2LSVMP3CGe7xKoWDtxdjZJ+AWW6zXuN\nL6cQr3D4VPlLimFk7QVN7JmtvCaxQTSPsTaibV06fp32t5Z6wYVoO6JEcik+\n7w469AjVsy3AesdtTMO0ao7le/9ARUn252TKwkHYdUfSJvBrDDpE0znPTrvm\nxNrPavxLD53vkWJMO96IdmtlNUV8YuYW3uh6MXjFuJTEGrcogQxrC8Al1XtR\nAhjU\r\n=KGsn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCtvtmKyGKcTaD/M5cuZ2+NaTYBDp986mIwtU6790ycagIhAO65ahHynUcb+OvAK9Vi2le6uupIsixcmV+VUaTPJHMD"}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.7-alpha.2_1602711915707_0.7902126536554166"},"_hasShrinkwrap":false},"0.5.8":{"name":"@gjv/redux-slice-factory","version":"0.5.8","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.6","@gjv/eslint-config-typescript":"^0.5.6","@microsoft/api-extractor":"^7.10.4","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.14","@types/lodash":"^4.14.162","tsdx":"^0.14.1","tslib":"^2.0.3"},"dependencies":{"lodash":"^4.17.20","lodash-es":"^4.17.15"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"79e2b46fbbf1ea81d6160e325a139b3602ebccfd","_id":"@gjv/redux-slice-factory@0.5.8","_nodeVersion":"14.4.0","_npmVersion":"lerna/3.22.1/node@v14.4.0+x64 (win32)","dist":{"integrity":"sha512-wcpn1ViSUkIxbmcvIZ0Lc4VVfbAYeQiA5tYUSrrecpVGDZ7WBR74198kmsCqWbgon8x1MbBH7LRrxWH3LQzn2Q==","shasum":"0a90bdea60a681482047cf78dc28c55afa431115","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.8.tgz","fileCount":28,"unpackedSize":195110,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfh3L8CRA9TVsSAnZWagAAyKkP/iS6MvqHMjcJOSUCgIqQ\nJuGQ6s2p6yXd+QhOZA1n2wkvHv7bLgtVgHhdDhdsjqnCRI6zB14bD2JALkzN\nuTulanwW94E6waY953wZEY3+w+Wub83pbL/D9eftj1Ck60ELFVp4Ey0hKx7U\nmIqrLE8pFHtUFUSK4N+8lCA830SA+9jETL0rgCR5RqQg0ZaXWvCxPemOSnNb\n2XQs6gJ0R+3dL0RBCyoh0KLgg7B6Z6wf3V3sqQEqWvLDcvbaXtUh3xWyJ2Du\na69xu8M9u6yKDnUZ/VdO1JUP9o3ynvbWXCxLTbr/A/d5cn5vnexBnrSXcwg6\ny2Las3+iQwSrmpCqIYoPuhxuSH65UCa1kDeedbNwvkuPNhtzIrpqQvhFcwzw\nq0aU/oponZLsYmLJsWfYjRs22FotF38yEVOM4BGHc83T2dHwySZdQJt8v677\nf8GGnWVj8627IiMfAQqwbnMeSPby7EHBZmSP1sd16PC9ZMfsCuVgbf7srhT9\nh4cTuxUYqYaL8qy7j5sGDDO99QbDwHq1E0cP3Pcdm+1ZIh4ryn3p5ZOMT3Cz\npXod/Oec4uQCFE6jG7Kj0iRlrqKNfnkp1JvBO1d4aFA/bk6ysVe7mOygSzFr\nRcuWkpjzWK0SM8q9mByI4gH6De/8b3zA5zUuFxo0aDkeUZpaobPxnA4ZK6Wm\nahKd\r\n=/PWA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB1aLJLm9BekHba7WuabfcAG1StwvfXBkVNmG0GXscAAAiB2X+882YAl4OMkGeG2ayXubkJSSipaEs3bq73orWeIgg=="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.8_1602712316148_0.7768734130692285"},"_hasShrinkwrap":false},"0.5.9-alpha.7":{"name":"@gjv/redux-slice-factory","version":"0.5.9-alpha.7","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.6","@gjv/eslint-config-typescript":"^0.5.7","@microsoft/api-extractor":"^7.10.4","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.14","@types/lodash":"^4.14.162","tsdx":"^0.14.1","tslib":"^2.0.3"},"dependencies":{"lodash":"^4.17.20","lodash-es":"^4.17.15"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"0bd4db250958d5c6a5d3c9cdf0b0a8a707e4383d","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.5.9-alpha.7","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.22.1/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-93VZJ54gUPOWSu3P5sCYvnWtm16cNSeR8ufTQl8H/vX5M5VXgJADN3SBuYHaCrKZjLEKZM4f2AGWto5KjEzPmw==","shasum":"9300c1da60fc361ba67de23d927d61b6001a4b85","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.9-alpha.7.tgz","fileCount":28,"unpackedSize":190242,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfkQwwCRA9TVsSAnZWagAAc+sP/0d3GD7chY2kvIlSXOEv\nd0wHNwwCD/sDG/zA+kZ2psIYdkzpuzx0nXbTHfDNtMR3s+bWsgC02FQzeG+b\npuXBgzT8T+uHjirBQNuiuphS9aLaUuCXoYFUUMndLm2vSiQ7CeRocRQzarUZ\nbHU+zSTVkwOebdY9czBSb89gdYDoX9fbmEC5Q/H/5c5mUXUFvMF3Nr69zhCe\nikRHrOBj+PokjgxgkZ4ZW6YjAD+3uCfLBAIVvxu0F8sbMOgEmrG+luXDygmL\na9o1Z3YSsrVIZ7A7jbToTNyFGa0ry6VSkQ7Xk9w8d/HkTvepA8bhJ998SITR\n/Q4jBQMiJ63SFnJwgOSMREAOZQqUojLXJtc5nWcp38JXyr8M1h4fuqnHela/\nxgSCwkZ8R6c4bDMBmv6Ie3sJjr/WLOrcf81de7HYfRKSDBjeREMMfQHuia2y\nopg4W5QuW3XJeuo0dBKY0fSlgDmrw0VVTNYIhsUmn9HPFPlvrpG/vH5+y8xO\nmfyBFH+O0ZNUDKFtoOMTKzZPyLtqPykDCCqIGKbgFC/BOUyverKSWt9VfLHU\nDsnsJw3K9ainm/UtWrx7G4hKjiiHdYxEueGihbBIUQwuZh7Y9NV8hl2IoDpZ\nZxFRb6Rh/2nRH6FHszOU1ReQ/wEBl+1hBjBW2gn1slAAn1giOwYBNY2ktFR3\nfwc0\r\n=Jh7P\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFhElq01y2RtRpkZaVJHeuPpEJANy+o7ZEYol+bGVGcgAiAZ0IWROWB4WOn8zrxYRNXokhkUePOr/IdIOpskZrXGNA=="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.9-alpha.7_1603341359867_0.8059759440599596"},"_hasShrinkwrap":false},"0.5.9-alpha.8":{"name":"@gjv/redux-slice-factory","version":"0.5.9-alpha.8","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.9-alpha.8+24e2ea9","@gjv/eslint-config-typescript":"^0.5.9-alpha.8+24e2ea9","@microsoft/api-extractor":"^7.10.4","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.14","@types/lodash":"^4.14.162","tsdx":"^0.14.1","tslib":"^2.0.3"},"dependencies":{"lodash":"^4.17.20","lodash-es":"^4.17.15"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"24e2ea9f18d36bb88c0066272251fe76be814e6b","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.5.9-alpha.8","_nodeVersion":"12.19.0","_npmVersion":"lerna/3.22.1/node@v12.19.0+x64 (linux)","dist":{"integrity":"sha512-5dC2ofyeb4nQbiqo8eXiVcW+iojWlZdLlMgHUEva0zlp3EnAzadZYBx7YHrCyiTQg5X3ZF4GZ+Io+VMcAQHvlg==","shasum":"984f4ecb0d92381c5da9eac9e80484114a57158c","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.9-alpha.8.tgz","fileCount":28,"unpackedSize":190274,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJflIcPCRA9TVsSAnZWagAAYWkP/jQI8BLqUb5Wl9V6hLcq\nph7wnixhT12EiNGv4tFVf/B+V5cKig7zkwP6Jk+DRu41kQnUq505aUqDZCsX\n/4D9qM6t3LF+Xb9mQnx/XJzqIXWmlwSj3hK1u3dcP+8rBoHlpMq60ofLHY6v\nJRDbgpYxXlkwQ5yCwuWnvFVkn4N1da2vbdg9H1o3QajWflfsvdVzeMXMDQwi\n9E9lYO6xoudbnCOG/tbuwGi9muIX2uX0UYSQOVO1zBLuLN40PQOOSkWroVMs\nhvkj3z5vK+L7uTWpbV/wCYskOte/fANtJrAimYfKH2cykCrbDtFLvO6lv0x4\nxuxSJ8SyWvGs4Nuo3tyrR3KtgNRGqx/+01jB8Zrc0sKT77VKINepju4iME1K\nq3nDai/ucXoP/NTBbGwq4Kdbvdw6X7szGo1Hdr6RZ6Qx1FApd/Oubu39AN0j\nR/CvpAZuIuivM1Mo7hUkqrAyqhCInuvKbATbp1X2jXWGM1XK5kE4Lpp4ds5D\nRpr773UIM0wYPqwj3/73Zv0vkX3IVzbNKcQ7s0XCEl3lEHyyrwGh5BOihB1R\n6CQBtJeHsm4pM0p5NZgxZN8E8VTGy3mmHl7g5tZ172E+t33Ma+GXz4b7veDl\nSsxl+fvzK0YhDlg8BU3vUveJUZ0PHZQ8/wZ5g7IoTpOXlxxmUx1rJCoJSOhm\n2mAu\r\n=HQht\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC1sruvP2Z5HFE+dp7ZO1gS+9fHJWwnkj3P54DC36hOOQIhAOkqbmUuMw6qluYsrW9BVxeHeB504DVC1AzEh3lXotEd"}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.9-alpha.8_1603569423263_0.6844519098459796"},"_hasShrinkwrap":false},"0.5.9":{"name":"@gjv/redux-slice-factory","version":"0.5.9","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.9","@gjv/eslint-config-typescript":"^0.5.9","@microsoft/api-extractor":"^7.10.4","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.14","@types/lodash":"^4.14.162","tsdx":"^0.14.1","tslib":"^2.0.3"},"dependencies":{"lodash":"^4.17.20","lodash-es":"^4.17.15"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"63879bbd38e89dbc9cccffce40764baf0f0f41cd","_id":"@gjv/redux-slice-factory@0.5.9","_nodeVersion":"13.9.0","_npmVersion":"lerna/3.22.1/node@v13.9.0+x64 (win32)","dist":{"integrity":"sha512-AyH1z5PerNBUHFAcPllg6oHiYgeHzMNPpXd+snGet/yGy6GfUNHQw9nn7FwmbaBtfyZ+ZLS8z/x3aLEKa46DHA==","shasum":"50161e8d6e5742ee91726a1d0f6555dd22019667","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.9.tgz","fileCount":28,"unpackedSize":195110,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJflIf0CRA9TVsSAnZWagAAmeEP/ilahx/td9+K9mQ6LDx7\npNffmDBPd0/swaG+aaPZtXINKZLqjzYrCXl83B8BaiGBIFkeJZVJsE3iNTqL\nFbY5RNV7lOKBRuaP9j5VfqztEOICYuTx0ZXlPgc2p8bKwGqHEc4EHFCbmiY8\nyTHnp8evr4Ighbt2T1u5DWP2aZfQyX0d25glmq8xY6FbbjG+eHOXWA7I8du8\nRu6mb1j+39lSYXTc7tPyvu95sw9m70/L+9wPvShAPE75imIT5UFVUjQRSLWV\npBuniVyKvzjVn++Zg+QEXVB+fGlzaC8ERQZ3raCPO8KuQ4/YdhtWwEP6CAe+\najdOnq+hZmdXsRfJlKCV4sBAOwCkiy6jUORehKpjTaU43sIVKSTZZU3OrC1k\n5SnxvdxQHCVfylK6suH1ttMu6yk1bfxg2wBnaS3FLocCw2nOtRuJtKwChZ+r\n/odc8UF1ywUMijJ5bOHpJZ071av4ljtUKBvP09St1siJijvVAGSm+uFSKtCh\ny6Xb72g7EaSSudxcoLu51LcWFJeT6VChE8bTRUJM6V8BtSJspW1kheatU76M\nzuhCZf40/1HgYcPtYUb3hFfYZHuzEwEqBgvj/ZyeG0ecvA0Dg2nyupjszL47\nWghahe4iNWffWOZeAURdJt4iulN28o/HPBABl//4tkDzv61c0waNQtWty85k\n7MNb\r\n=es6u\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAC0SUFwkvWTfIQHflDOh8FkS2a/BbPaZ32GCmrBr1g7AiEA0Pr6IB1LJCIHZjOVdSOIlj3Qep4eQ2KXJiIXt+/wSnU="}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.9_1603569651984_0.9434616734010841"},"_hasShrinkwrap":false},"0.5.10":{"name":"@gjv/redux-slice-factory","version":"0.5.10","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.5.10","@gjv/eslint-config-typescript":"^0.5.10","@microsoft/api-extractor":"^7.10.4","@reduxjs/toolkit":"^1.4.0","@types/jest":"^26.0.14","@types/lodash":"^4.14.162","tsdx":"^0.14.1","tslib":"^2.0.3"},"dependencies":{"lodash":"^4.17.20","lodash-es":"^4.17.15"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"5da37ae5185335b6de7b8a125492bb71e7570087","_id":"@gjv/redux-slice-factory@0.5.10","_nodeVersion":"13.9.0","_npmVersion":"lerna/3.22.1/node@v13.9.0+x64 (win32)","dist":{"integrity":"sha512-FsH9ipYErfML3qADVobdML/3f3t1nklQ3vPrPQq+h2ecfFbpzvVgt6TxgRIaIUH0qxoFADzecQ/Mi1i8n2sfEg==","shasum":"71db5013f9d697f3dd230ea3da7fafe81c18da05","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.5.10.tgz","fileCount":28,"unpackedSize":195113,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJflIotCRA9TVsSAnZWagAAnmoQAJVkTDZvghpVd0ijlZPo\ntypqie4dxBcFU9nvvoE0iIy8guYiZf4Ag/SWk/9SaXOFct9BMorx1YNH60N2\neaVxGc1aHhhLbODYJc02wvHlE3ji4jnDigN1OqFGDuGl0uIK/1k4xsKlmB1d\nVnQN1DXTY2rJYpJfT5AW1xSPaNjdwpjpMwTlJZ4sO1XeVm1qZHiQutZC+v8O\nydNC5yiUyszh2B3D0PgRl9a6w5vteC3pL8PY4VQ4OUc9sg6/KCQIwF/3jTzQ\nN+WydmsBLW730n+aW+zNxglPMHKAQXYNkzA3Q2MV0xsA28k4OuCJYE1bIJDg\nuwymc82jyFjhJgSBD6chje8BVNMbENggKKE4EIZM5d/Go9CR+rIF6F4u28Rm\nyyujmJewngfl4gwowp7vvLHRhFlEcHmA5/+hsEzwAzaVFL+JeivMpqJ+/F7I\nGCAlVFgC9PWH4OlHJXJ3yX6MJL9lVbGdKorJuNtfuOMleFMw0V4lCD8ih+Qc\nqByRMFTvJar3mtHgrXwrc21JC03i/yjGHRUVZKYBXB6BL9gWBdME+Bo+oepm\nonUAKA7Sj8j6cbAMbdJR+Ap12UTjt4mjivo/PtOuH5rvZf3Z9hEJhfjPkAQ4\n0td8tChfjvYfho0tD260vc160UPQvDnR/hGFjIOmgdGPNoUM8RfbwaI/YIoz\n/bag\r\n=W5zX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDozlQo/WrgyDT1jQJhBxLjQfXmnyf/RowMKJh4MIawGAIhAIk1YXjLCuRWDEPZNLklH0USoXcw7dfJcNb46tk2alLR"}]},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.5.10_1603570220968_0.2712601235813137"},"_hasShrinkwrap":false},"0.6.0":{"name":"@gjv/redux-slice-factory","version":"0.6.0","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.6.0","@gjv/eslint-config-typescript":"^0.6.0","@microsoft/api-extractor":"^7.13.0","@reduxjs/toolkit":"^1.5.0","@types/jest":"^26.0.20","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.14.2","tsdx":"^0.14.1","tslib":"^2.1.0"},"dependencies":{"lodash.merge":"^4.6.2"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"f823244826387bf387e12685822647ff269143f8","_id":"@gjv/redux-slice-factory@0.6.0","_nodeVersion":"13.9.0","_npmVersion":"lerna/3.22.1/node@v13.9.0+x64 (win32)","dist":{"integrity":"sha512-gIqnGtWaexS7RD0FHVIAWwDPbxA5DHnJ0uyWSG8SY38Ef7cVOaY+hfjnVc6pb3BWJOOa4TRcpDP6nIjYN3vRtw==","shasum":"5131b3415c87f1f5373d39392e8fc02dd97c30d0","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.6.0.tgz","fileCount":28,"unpackedSize":194695,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgGL2QCRA9TVsSAnZWagAAOuUP/1ZdcLM03FnSpVgl6+XC\nAVQZVKzkPJLgcqjJXu5T68ovb1dyVnKDvMF+i3qRk7h3V6lAF890bOGVEhrV\nhBbNBt/lwqNCrWZ51IsjKQ0F/8ydPicKhy1z3Igs666AIMzPcc/dTo6V/IZl\nVeNAxp7fLpJeD2aEBdYwoKYmF/cjbQsBOnFcBr30ZNoCq0exjkMH8AU7gBss\nG8jeMfSq8s++DLJNGcIex7XvzjzlWV5JPsGyk1BojMKmL/WN+7K8b0sC1k1N\n3cnzj3sVCHGAWoVGQAQD7nA/37R7C4yDzioQdjXjg8pTmRyjJy+OAAZrhJ7V\ncwApfDaWn8rpQ/l6a6NBqMi3uwOTGy+fy/NeRHXcqP+bdRh+SeseRJNYB00e\nEYNyeZ/OUiYiagysZxMIHpQ5L4bcg53F/nnQh6gkgH9+x0DJsOjcriuBilqz\ne8L7tY6Kvms+o5cciqEqyBEhAdw+eujkpvX2EC2f3UKDC4Z7jabHui7UcqaH\nWRHgDZ+wHu55h2f0aMEQFYJFH7UfBSH8w0sst5jqoZQhIOqeAgoaNOuIxjiJ\nWufgcdQtnb2Whup4TeDk/lzpWaU+inCaXC8StfFNcJVXB2iErXRKVK5UwNYC\nZTagUMrBead2aa3qfswPBv/mQZ23q81CTTVg2FCL/uIvNtL4thAScPxISgZ8\nDZg8\r\n=PqrP\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDf0Gh1RHboLa/aYm4faKhH/6mC1weNqSmCGD0n3grlQwIhANTnJ89fC0+6EqjXtjpcmETssgMfJel7Yu+kSfMg9y8v"}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.6.0_1612234128157_0.03592710881586614"},"_hasShrinkwrap":false},"0.6.1":{"name":"@gjv/redux-slice-factory","version":"0.6.1","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config":"^0.6.0","@gjv/eslint-config-typescript":"^0.6.1","@microsoft/api-extractor":"^7.13.0","@reduxjs/toolkit":"^1.5.0","@types/jest":"^26.0.20","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.14.2","tsdx":"^0.14.1","tslib":"^2.1.0"},"dependencies":{"lodash.merge":"^4.6.2"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"d1dacb75f5aef05cfe6275e136312cb3477948ad","_id":"@gjv/redux-slice-factory@0.6.1","_nodeVersion":"13.9.0","_npmVersion":"lerna/3.22.1/node@v13.9.0+x64 (win32)","dist":{"integrity":"sha512-3K55W/yfFVuIDqOzoabctnvXufdvqgZQrjvmLEP0tb20yFHUSZIjps0vGp44LfBsBYaK6dEnXeBcB7o4FOJznw==","shasum":"ede11a6641fd8aa26166694ec91b788c14d4a2a0","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.6.1.tgz","fileCount":28,"unpackedSize":193854,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgOoCYCRA9TVsSAnZWagAAH+4P+QAQQLqc0GspEgpjan40\nc5GM+Lk71qynE7lwIgohm9NJo+qqq2bNMTpn+H0vaLGg2T+hfL4UL9FHkM9J\nrIpdledkDyOAzNtSycfHdjEIWF+vw1K21ZEmlp/hppe3g9Q150nuaaXol+aC\nuQfXoRYHfurwKU2QeuFNscsIIIGNcOhYoq1uX1zpkHeo24lHTPli8FVG0CSK\nfkG6J3QOy7xbJyZALrDn7Np09CDcGhoExT3HoffK5qgTlgOEbg3RuDqAlbiW\nfHYk1OHA8Q/9R9zRmPSHIWeEjkKVN8NL5o7RPVUrbP43MVrBOdQu6Mjkfd6H\nH7mj2lgt8eGFB12129Q2acJVSYeRsujmSfGgsfHNPPaRjAyyhu8ZK1Vom6kZ\n8/EmHK2UVjGB7OhSKAqfNlWvF/tZzCdQThG7TUYuyYx7IG90jxRP9TfCruop\nRZ5T/TxLBW5OKlny/eYo6bMABYKJinIPlA29a2pGJOyMg+mg+oeK0egY/c7W\nU6ZwsZr48OmDnbcx3lLebaMYmLZ1SaaPPPbJ1kt/Nir2sxoiSuqtP8sThIYq\nOyvw7IJ9dJtS+3mjPv+D5DjlaNDxKffyPWN/RHjpObkBeCUD1sfZrXz9uS/a\n1r6DTFa/8YXwmAQC22bPTjxJtoQWtLHl8EBJTG1gwZS353hjDYxM8fp+8uav\nNbE3\r\n=2/lc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDhvYwmzmA3nwynwy0Kye+QM6o8ZUoqVp9/SP9b1eFJZgIgWA4RHVZtonVXWAVtqhZHpeCA83vSGoV+ECszPJO6joA="}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.6.1_1614446744549_0.5358107318777463"},"_hasShrinkwrap":false},"0.6.2":{"name":"@gjv/redux-slice-factory","version":"0.6.2","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.6.1","@microsoft/api-extractor":"^7.13.0","@reduxjs/toolkit":"^1.5.0","@types/jest":"^26.0.20","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.14.2","tsdx":"^0.14.1","tslib":"^2.1.0"},"dependencies":{"lodash.merge":"^4.6.2"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"ed69bff3fcc797333f452bef151ef6919ba32033","_id":"@gjv/redux-slice-factory@0.6.2","_nodeVersion":"13.9.0","_npmVersion":"lerna/3.22.1/node@v13.9.0+x64 (win32)","dist":{"integrity":"sha512-8UxemQLJtlJSXP8SdUY1WOkzHLIzaeA9RLiwMAs408M3RMkw+fC17IWvtXmiaYiWwFfMlSkfi5pLi2IFqUyxDg==","shasum":"2a8febca5bffd939d1603a8bcdce4cc8cb29a957","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.6.2.tgz","fileCount":28,"unpackedSize":185554,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgOp01CRA9TVsSAnZWagAAxvoP/R4fL1eBo/4vhV/7o+79\nmgeiP2cyIs5PxT/QskYEfEmyyDBaMJawqTyAPjdpwfLHHI/tGCAuSgu10zLF\nxq3kJ/oogmYYGNve31evxBZUVayehwEty1XVGwULlI+zbM5GOcT4Lszvxjb0\nFEoMwG1lSdUqpzww91WVfQAH/JmfN1IjUA/AcSIK1fiUgvypiDzuB9da97x4\njsN+esmREwj4udTZdHBRIjYRBHi6XWE0gMoyI4URr3+uxEx12y4hzbFY9b5y\n9Q+Y9CJcj4yn+NkkBHeYUT469rA9faWCHXywmL8ESBzT3gzoRV3YFqA24hON\ni0zZrTDanrX/ubzgUYFljAC+sN3+MYBMDbLKCBk3Ie6FHda07LmcuAE5OPX8\nufwwVNnQgzGFyCIghtmebbnCdbPRR/f6tYk8lXL3tVk1bShZKH8lR5K4upNC\naJDxRy7PLo2iN2BKdgiarJ39Y+2iim8lGm/ZBx/JbkKeq4Chcwm7/8Y/vydl\nly6HhgkTt5wWI1vAQQaaCJg8xhtPRTayxzTDoaDNjMt0nJr+f+2xWDAYfVze\nyejZF9685gBhAudsG9tX2swdr47LwARr8Ssx1Ur8ZxJxcenjwR5JXDcJaJiH\nxqIzJBz2nzsFAmfpfOxQBL2BfTxPkgyhoXiqO9RGfL+ZlpZOjqxhgDXtV90r\nIToz\r\n=cmf/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCYVQ1tMbtkPLJyHjDms92SZtUP6/4XkR+TMeIuoeMVlgIhANtAM1K1LgHviMxuc7ogzNs7gTQGMzE1pQ1n5gIkRABv"}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.6.2_1614454068909_0.25920907350066047"},"_hasShrinkwrap":false},"0.6.3-alpha.6":{"name":"@gjv/redux-slice-factory","version":"0.6.3-alpha.6","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.6.3-alpha.6+5b0ce99","@microsoft/api-extractor":"^7.13.0","@reduxjs/toolkit":"^1.5.0","@types/jest":"^26.0.20","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.14.2","tsdx":"^0.14.1","tslib":"^2.1.0"},"dependencies":{"lodash.merge":"^4.6.2"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"5b0ce99c655730fd8d8f9e80e3cb27836b44e711","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.6.3-alpha.6","_nodeVersion":"12.21.0","_npmVersion":"lerna/3.22.1/node@v12.21.0+x64 (linux)","dist":{"integrity":"sha512-RVyTIKyw6oe2oWgzg9eB00QL9E0DTKd1QQ7h80DK5xcF4qsen5Y4tusaD2qBDHrl8hdLJSfaLi7C8vMp9VrUEg==","shasum":"0b291fad7b3df76ab8d4d47f2da080acda2d334c","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.6.3-alpha.6.tgz","fileCount":28,"unpackedSize":196935,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJga9ULCRA9TVsSAnZWagAAKPIP+wRv856AsGB5E3WvAIKM\nOzYCDkWuSgo/2U2oEOhRlnutPD69CKT5//98/3bNPYZ2BYsjb8TaxH+PFMpj\nmgjl11PWm/LgyDV/Z6OLNM7OohLzbv9FJeKfvstiOFxfEUOKWc6bQSd8Gyph\n7GNqXOWtu4JfB69HAeKxOtCVKiL4HFLNXfRax/tC+X4Q+TcDlJh9Igrclh92\ndM4Fuv0i6qZqAVXho951tqQH/hnBySQSX+oU45bmCVc/sgV8AJ4BhGsoj2IR\nrbdIFLNa4yGDepJwVD3U5uEJHB9sqbjrIpzMl4VCSc1VPN/wjb6tGWTCFclK\n9qNZOtd20ZIei3TTDmzCzPW/fXYTVjbfIwQLjpA0OM6EGn6e48z2+rjbNVuk\nsmM4mxqu01uZYKmtbX2UefvjPF/MBohwE/Wo/wLBFWPMF2rmrqjJyx8errZX\nvxexazJdsL6kSMHGkeU0XA1kXI+GB6D3fVoGCOO8ht5z2JwFatFIkEEuI1kK\nRo0qsdNxO12/WGZXybMWcwazaCG/PW6NNtUyy1/TAq7360b8ubP8bASonzw5\nfo+QQl2Gc4gdT7oGz1ucje3xoILDw/rYTSsJT5dS7Foz4L1r72JL3z0ZsuDE\n4bvNtD2r9joQTjr/GQxfiQaNZ+nw5a6CjLlM5z/piAxMajMvVEY5BerEGxgz\nw1Dg\r\n=ll2j\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC+9a3m39E7GFNA3BlhkAT2AqmyOLgHJ+x7K4fYo/jL3wIhAMFdjRK8XVhXZGBTcnzQyMz+eaE87DsPQUTgfv6mOGMd"}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.6.3-alpha.6_1617679626620_0.5986584740164398"},"_hasShrinkwrap":false},"0.6.3-alpha.9":{"name":"@gjv/redux-slice-factory","version":"0.6.3-alpha.9","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.6.1","@microsoft/api-extractor":"^7.13.0","@reduxjs/toolkit":"^1.5.0","@types/jest":"^26.0.20","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.14.2","tsdx":"^0.14.1","tslib":"^2.1.0"},"dependencies":{"lodash.merge":"^4.6.2"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"84f7c9cf9556819b299a5bb0eae0d039f15f5243","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.6.3-alpha.9","_nodeVersion":"12.21.0","_npmVersion":"lerna/3.22.1/node@v12.21.0+x64 (linux)","dist":{"integrity":"sha512-gMPmj1rOmN1gNjpLX/AzV0SbJaypzE30oXwomdYBAyavpBs54ab2KnsonOMHWAF3zbsiiE6CWn8szJoyfN3eLA==","shasum":"210a06e9bf884afa55e3f5ec65cbedfc5e458b14","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.6.3-alpha.9.tgz","fileCount":28,"unpackedSize":196919,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJga9UeCRA9TVsSAnZWagAARAMP/2fPueL4Fuy8IAZnERMs\nlG4IahM/TA9GsB1rKpiT/dDjkxvoBTsW+6ukmmgN7UIrMupLnCe1+/VaQa/u\nqa4Pw00w/ForNPM7tcnqDQF21hLFMh3jpiqNWYOfpNINiysUl24T12pScHFp\nW0nMAqibsCZ6dYeO5Da3W2dBqiTXgwhJk6AVl/zuo0qfkZ5jIa5F0trRH5gk\nuIYK0krBUnJuH5GBSUBsmKkxwPGfBcBvxX4ggMqRrpvF10h6VmPurFkGEx8O\nTBffOqoB80Ilh4RszYx4qRRYGCVpif6zNqeljJR+Sheh1kNaz0vNyKwUMghW\ntrGCekSJKsMpe3tfFHXdItvCL3r9LsG3LzQBWOQEV+dd7/CH4L9btZ3lb40o\nPCQZXmk/YW951h0Oqryx3kaPQVe4Us+KA3X41HSJ7EAjPBrFMMVAZ5XHsJpQ\n3Lj7VTu9CJ2jYorx1bSYgE/T69MZaSXmNr0+ecMooBXu/zhmUc9d4D83suMl\nhR/CYVxoHc+4xFe5rIcwAtdauXLQTfn6jv/4wEDzffNJw5eugAju41kA0JvZ\n9SuZx5O5XZyYvW1/Y+rm+P0MzFVYTQ+fzitDwtzU8+3pwjdMPxozBtOvLkVr\n0phqEXp8c923/HJo1CHmTCperaDEfDdfwBxdp39sBKP3SHVnj0P9XBXFgznu\nnM/a\r\n=2Wsl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICVyxxC3KzCSLHImf4T6GJ/XkD5A2Z0MMfBS97TmFbWjAiEA3uZQZcTjaCUFc5dKutEMe1jNBV+5wK77ttPAajbGJdQ="}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.6.3-alpha.9_1617679646013_0.32183271712536254"},"_hasShrinkwrap":false},"0.6.3-alpha.10":{"name":"@gjv/redux-slice-factory","version":"0.6.3-alpha.10","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.6.1","@microsoft/api-extractor":"^7.13.0","@reduxjs/toolkit":"^1.5.0","@types/jest":"^26.0.20","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.14.2","tsdx":"^0.14.1","tslib":"^2.1.0"},"dependencies":{"lodash.merge":"^4.6.2"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"1a1d6377200e5ff3a4ccf93204130a78da110762","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.6.3-alpha.10","_nodeVersion":"12.21.0","_npmVersion":"lerna/3.22.1/node@v12.21.0+x64 (linux)","dist":{"integrity":"sha512-ll1sJ5PSCUdq9P5f0wsz+3WZrCGnZmXYP/8QaQWRNMmPlwgDEuZiKuaGZFMBJEwyEGm5ku5YsuWCb3Uv1ws5eQ==","shasum":"9851d4dc2773fa1b6d6794bff92d6f5db0271af5","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.6.3-alpha.10.tgz","fileCount":28,"unpackedSize":196920,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJga9YKCRA9TVsSAnZWagAAaXwP/i3kGsNVYUy4Wwxt6dCu\ntffdB5ypA/B6RtDCYba1x3D1ivF3GnUxprnlGIgLq3ovfCmFw452DzJBhDW0\nmjz1WkmF4vo7M7X4chTYjos9sG+A5w8ue0CNQ60SO12X/8IKw4cMvpfV4ZS3\n/Fchc7junQO7M4igXCGtYKsfNE0x4mJ4KBhheFbyU0bWX5/SzT3u6Ws787jE\nj9GWWMiwUD5zyJjlfERcHeT4EHCJ3s+oyk7Z0+NQlYZpTBXLNEa1ntJI23WK\nk1vevK8FwLdY8/+OwbKXdux4RHBcrj7I32HHdRHKH/YfuNDRfblrjtOEnhfw\nok3f1lZbsrs5dcPuNnC5Yya9RjrDdEMR/DtMMZyPgq9G2jmzLzKF6w2Dw9Kv\n5iQwDAO8j2I+ALQKLoqXqxJy5fsaoKmF93g8hfmZX5azTOYoyVS5CY4crUg+\nOjyJ1n+ZheA9VmKLEh5KERL/UPlB6VpyMgcksu2RCzS+Km0bk0JI4aN4Q9vN\n9F/k1MJNsBfRYTyE3nGr5BE6cvuIvOGICv9oK3YYLlK6m5NNfTvdCoNtCBhV\n7DuO8BwnQcxvgKkgOu/xcP9i5gDoxW6hVUVo9kt6wfvdSY7FvQUassiS1v0t\nbpdrz+lhHKV4yMOo0w2ywZRNtXv1wOtV3we1vaR+lsWJ+EhL6jznJqLBD5ty\nE8ao\r\n=t7If\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCKDsPc7mXAW7IdPcteUay9+ikx3nNTKKaaPRsXmIv2lgIhALH9XOe38p+3547GwiPwsKlG8+dYP+Hga8MvxxFeqxpY"}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.6.3-alpha.10_1617679881962_0.4816718784103957"},"_hasShrinkwrap":false},"0.6.3-alpha.14":{"name":"@gjv/redux-slice-factory","version":"0.6.3-alpha.14","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.6.1","@microsoft/api-extractor":"^7.13.0","@reduxjs/toolkit":"^1.5.0","@types/jest":"^26.0.20","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.14.2","tsdx":"^0.14.1","tslib":"^2.1.0"},"dependencies":{"lodash.merge":"^4.6.2"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"89d28c47ec181f42c3a424b5b1335e977bf2c9f4","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.6.3-alpha.14","_nodeVersion":"12.21.0","_npmVersion":"lerna/4.0.0/node@v12.21.0+x64 (linux)","dist":{"integrity":"sha512-eJ+kxVKVDl0nC1PQBjTeAEsjFcw+RU6bWI67d9gBZUJRg7OdGk2brpNT3kV39elMLeUJJZGLNYrraWExbdRmDw==","shasum":"55aed71d38a435b09ede7befaf5e5c5db070bc5b","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.6.3-alpha.14.tgz","fileCount":28,"unpackedSize":196920,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJga9aaCRA9TVsSAnZWagAADpMP/jtb1j9T/GlkVM5wzmZf\nYVuqXP4lW3ZaIi5124xHXIzq4prIhTsLiBgyFadOcfZIvbGuaEfjz6ANVorj\ni1ejvy0IgzFlg8Sv5e/bc1lvmFZ9Ie1nW3WJkgdwp/Y+wtxe1/eE5aevljfi\nNfY1TKGQdbEzEPhUlliScZwRWgvkPCr7ekE6BdEi52zxpOfq+edqAPPcDKdf\nFEKz7JicLvQLTbZLwnNJkZPkzwbMJHkKX9Jte7u4N2vTj0K38e/+PannEvhh\n9vZXi26mLZUV1pTXQ2MhuedB8ZAdFVRQ0UgeV+xTEKZrqTTQdiS0HjPw1UnE\ncRIO/I4NWbq8HehaJzGsPfTM+Rw67yqWDRzpHPgTHcsIZb5DFmBrElySE8A8\n712Oj9MBQ3VPhDn6/ZG85+utkiMubkVlXPN/cMJi5nh3ygYnfl54Kpk46dCm\ncCaw40lqW8UwuGOp2glKWeF+VNPg0sHGWvs8Pg2s2UJdLXN21vNUaKed394F\ncn+29wlMLhol0APXtO6TAZIblIftxEWpNW+LJgA8hrP4aTjFVyFUXfRX9NQ7\nJVneX3lcZDbZGoK74cXYX7EBrUVsj1BsuBKGR8kAqVQpT+E+5spq24poYCE9\n9SWXUet46FP/2nEiILMC1ZTzTkhzpf1gaI7gQ9aiR9Ft52iAgf/gm+9ZxiId\nWCVo\r\n=7stH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICLRGyiwvMcZSumRbsQIzmC0DuSxL7p9N+k/WLLGLf/1AiEAzXlL9ZroQ+QE3eVsfvLD/T7KYeFnkeNOW1ei+uQ61co="}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.6.3-alpha.14_1617680026273_0.0694079530622469"},"_hasShrinkwrap":false},"0.6.3-alpha.15":{"name":"@gjv/redux-slice-factory","version":"0.6.3-alpha.15","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.6.1","@microsoft/api-extractor":"^7.13.0","@reduxjs/toolkit":"^1.5.0","@types/jest":"^26.0.20","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.14.2","tsdx":"^0.14.1","tslib":"^2.1.0"},"dependencies":{"lodash.merge":"^4.6.2"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"ad89faddb3cbba63e744fad6c62678ca1b4b04bc","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.6.3-alpha.15","_nodeVersion":"12.21.0","_npmVersion":"lerna/4.0.0/node@v12.21.0+x64 (linux)","dist":{"integrity":"sha512-Q4SEkurzSz0bjp25vOqVNxONMLXhyT6bpn4HfqW2NiTWBCgb5wCtsehHD/zaLufuamtdDAhKgv16M15+xli3Ew==","shasum":"c264c59f06eff32d44da9c57564fc047e54bcbfd","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.6.3-alpha.15.tgz","fileCount":28,"unpackedSize":196920,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJga9yHCRA9TVsSAnZWagAATUEP/jWWsKLowgpHinUv63S5\ndXEVqG1NUgHE/q3qQ8zwr/N9m/7bKeIiUfiIcGFjrWXvWwDjRnqBAF+Cpv/5\nyb75TMXmGJf4dTZ6DUd4AG6kxbg80wxrRvmyn1oPCKUHTYUaWfkvIIIOP7Cd\nfBxP3VXgN4pFcc7lPLC7CXFv1gNV8ygBe8Ne/XGARjciYP9KIbk9Vacu2t8P\nx+mHtw+k7c4VfV1E6x0XEzHP/QCLIjmoPZFmxVRBgcOL7npGCh9MeOZMXdj4\n/Zx01JFiRgzbYtzsuWlsDok97OZX3T65zkPMjdYj87fhxGEIxzHskemwGsIT\nzDW+ySKkKfbjWepxLDekz6unRKIcBIgNsb2h57shLvSvQRovTx+3CEJc365X\n0HRiYLHRrVhhI/K+lF7XrSwIoKQ16qKWrUKQj/SqVUhMg5ah54FHJwXM6KCA\nv/VG2YvK3fCF4o2F8kokESsLLQAr9H+3XgtzlKSd7FIOeMnnROcNOH2pABu6\nMEu1y64FsVj6i7G4SZrJhphyrLcErg1qFB405wKZIKX+Dle+2Z/cU9tjTrws\nijAIUfGV7DAFYQALQPDJ2J1d3no7sFzCDnmxIx+avwQ7/ziJ8ieX3zxdjJTM\nFtEWWpD9R8P5BOfvz1jR+C/mWrpkWqXqrdDTQyYxx30DzoBkbrbRWhOqD14k\nuNfS\r\n=UOiC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDnT+GGubBPweECHAmDnZlL7Jf6DOjhq+4og+GfUgGw8QIgawS9q03utt2umbVoVUprfYywKm0UUKiFG7Y+geDn8bY="}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.6.3-alpha.15_1617681542544_0.6581682893554661"},"_hasShrinkwrap":false},"0.6.3-alpha.16":{"name":"@gjv/redux-slice-factory","version":"0.6.3-alpha.16","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.6.1","@microsoft/api-extractor":"^7.13.0","@reduxjs/toolkit":"^1.5.0","@types/jest":"^26.0.20","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.14.2","tsdx":"^0.14.1","tslib":"^2.1.0"},"dependencies":{"lodash.merge":"^4.6.2"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"b194cb4874eb0a1221ee3417288be64325f589bc","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.6.3-alpha.16","_nodeVersion":"12.21.0","_npmVersion":"lerna/4.0.0/node@v12.21.0+x64 (linux)","dist":{"integrity":"sha512-x0/6zeSglm+lraaNT9QenBPFGVSL3/FOBV+Xwj2hSTVtxw0iAHc/0/fpvpW5K+BG0BmidDs9JR2vQ1mRjY/BaA==","shasum":"c379b42df2a1fcf7cf01372f138cbb1341004a11","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.6.3-alpha.16.tgz","fileCount":28,"unpackedSize":196920,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJga+fPCRA9TVsSAnZWagAA8usQAJxZJjWZJ1XOcytqQkih\nbSWmPJVKQvPuBEg8/bAXejo7nhGOx8kzGoER4R9kyhUMOvVFX0uhtKgTYxE8\noPr8hsKva0b2fJPHFv8tI0LVYG0wuzdE95dRrrZSfGn4OtxAq6jdhzthZkPq\nHhLdibhWk/o4g83EA4LgboquOhnSZDDKQAMpA6uj3udQpU8a2kd3infuepLV\n7hb78CF15WYm+L6GK23aGHFG80YJqxytpn9vQ0KUrRoeyHJzUxOQP7EUY6Hk\n+Wf5mWuBHJjh+ky/aiqnEJwD04iEHsXp6O2hnGds5XQjwbd+QXjKBujYWZEp\nvqmLnjY4dz7Ghqm0kz/xQzsHFSQ/sDwa7nYtbMHSG7DwX9lSs1VF/pVl8+SI\nRrITwhvHVRlPvcAPzz17esKsZZVaGIUQPY6jdMPxUpPctrSfaBVD0y49KwK3\nNUBKQukF+XgtGMeNMcUzM5t5iGyEYNaw571Swg5GQaHddx7QcFYTIhaAC7b8\nrTmBKNk2f38vGloPl6wZu5NhfHUkE0P13YKz9Aame+MdRxQWIBPCgRPBqADW\nOOA4WmsGdmbB7AsgzXpX+dBD9TagFGLuTNvkAHwKxh96nDudKoHS0EX/DcOg\nB134JGO5YbkrgjyGttcjFi4JOmLODdZVco41YxoDY1h6we50QBqJwNd8Vbkf\n7x7N\r\n=njKp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFasyJ/tPaBG5kgdqSxjnYpjn6az9yCNKM/qr0oHuroLAiBpVaU3jelOg8a0DEReKe9shKhuBBfqP3XTianKaUJIDg=="}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.6.3-alpha.16_1617684431279_0.4258680530786143"},"_hasShrinkwrap":false},"0.7.2":{"name":"@gjv/redux-slice-factory","version":"0.7.2","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config-typescript":"latest","@microsoft/api-extractor":"^7.13.0","@reduxjs/toolkit":"^1.5.0","@types/jest":"^26.0.20","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.14.2","tsdx":"^0.14.1","tslib":"^2.1.0"},"dependencies":{"lodash.merge":"^4.6.2"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"3ea0a796d801b7c17eed2c5abfbd19d3a32a5e88","_id":"@gjv/redux-slice-factory@0.7.2","_nodeVersion":"13.9.0","_npmVersion":"lerna/4.0.0/node@v13.9.0+x64 (win32)","dist":{"integrity":"sha512-pFJtRwBR2S1TUyCRtADZVYemyzaP0OahJLfXMhhcZmT5ZmW7mWNASgQlOAQnj+plbrAuT0E62P+OD/WXG6PBWw==","shasum":"34f8e4bfa60eea893d2fd51df22d4d9ee1e23a74","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.7.2.tgz","fileCount":28,"unpackedSize":201796,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJga/WqCRA9TVsSAnZWagAAw7kP/RvXG8gRLy6UIJMT5WgI\nSrh2kNphQBFV6RGLuUh5FX5i2h0MYJGSloe+x2eOJXYubZKXYYlWSafl8YqX\nN2cJw3YBzVMAo1dN5gFGikJU8aITcx/WXcksLHw1qpdy95I4SdbPaFQd3uHh\nN1IPzuV353nWLp5Z/r8SwSM7zJsjgNM591OzZDp+JhKnL0NZoVqFK7OIQpsF\nQVH3MBbN2Z1Q5XWAGa0ntdrMhzxpB91OywNEW+x7TqES0wSgT2oPQiIX1AjQ\npP2ywiEVMsg1iiGEPddCW3b0gNfBwZT4hwAllRwaQopa5Ae+Evj1rJcJ+4V3\nTMoXIIQoa5Vo0yEEKBisd4bksg7/0x+Z60alSdid74FVh8qxhpltShCEditd\nO7ZxBDnL4frLPXS24Hpwu5YsUgUlhjS7GhmoAAGxAORm87SMpsc9qeEn01F2\noHge1B7+AbUO7z0rdHF5GE2iHUTcXHQtBugICmRLLDumKfZH+zVYdJO1X8lS\nfApcELSNaYmn7J+KhSyCfu+mqmGSxDLPzIB3jMdAOekqp9QNKLGps7BlFxcJ\nyE4SBq+yqHvU+AnVIsEOdb31t6vAR4LrsfKmCw+9zF1pUoF7ro6k5BLAhXlR\np4rEkClDSEF668wy3zDUiBnMk4uP5OXiGvFklwInQrjepKFzjmD/8x/Xjl1H\niljz\r\n=8llz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHKCKvo2o2+0liL+L1EdUa0748R1DBys7pcrw0QgkiZYAiBL/i0GxBCRZ6zFHkCnvUkYuTOq6rvHbXBvIYUTX7aEmw=="}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.7.2_1617687977841_0.1046570343097537"},"_hasShrinkwrap":false},"0.7.2-alpha.0":{"name":"@gjv/redux-slice-factory","version":"0.7.2-alpha.0","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config-typescript":"latest","@microsoft/api-extractor":"^7.13.0","@reduxjs/toolkit":"^1.5.0","@types/jest":"^26.0.20","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.14.2","tsdx":"^0.14.1","tslib":"^2.1.0"},"dependencies":{"lodash.merge":"^4.6.2"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"c8c8e9c6c6be1d9a95fc799e86d1d3d1711dcb91","readme":"# `redux-slice-factory` 🍕🏭\n\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\n\n> A light-weight package with generic factory functions for common slice data structures\n\n## Install 💾\nInstall from the NPM registry using `npm`, `yarn`, or `pnpm`:\n```shell\nnpm install @gjv/redux-slice-factory\n\nyarn add @gjv/redux-slice-factory\n\npnpm add @gjv/redux-slice-factory\n```\n\n## What's the goal? 🏆\nThis package will\n- reduce boilerplate\n- prevent duplicate code\n- save you time & effort\n\nby providing\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\n- a common set of actions and selectors shared by slices of the same data structure\n\n## What's included? 📦\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\nHere's an [example](docs/CreateModelSlice.md) with a slice for a user profile.\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\nHere's an [example](docs/CreateEntitySlice.md) with a slice for multiple user profiles.\n\n## What's a slice? 🍕\nVery similar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\n\nthe `name` describes the domain the slice is responsible for, \n\nthe `reducer` manages data interactions between state and actions,\n\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\n \nthe `selectors` expose memoized functions to read data from global state.\n\n#### Where are the `action types`?\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\n\n```typescript\nconst { actions } = createModelSlice('MyModelSliceName', ...)\nconsole.log(`${actions.update}`)\n// -> \"MyModelSliceName/update\n```\n\n## Show me the code 💻\nFor a more extensive, real-world use case check out the [examples](#What's-included?) listed above.\n\n```typescript\nimport { combineReducers, createStore } from 'redux';\nimport { createModelSlice, StatusEnum } from '@gjv/redux-slice-factory';\n\ninterface IUserModel {\n    id: string;\n    name: string;\n    age: string;\n}\n\nconst bob: IUserModel = {\n    id: '456def',\n    name: 'bobby',\n    age: '30'\n};\n\n//\n// STEP 1: create it\n//\nconst { name, reducer, actions, selectors } = createModelSlice<GlobalStateType, IUserModel>({\n    name: 'User',\n    selectSliceState: (globalState) => globalState.user,\n    initialState: bob\n});\n\nconst userSlice = {\n    name: name,\n    reducer: reducer,\n    actions: actions,\n    selectors: selectors\n};\n\n//\n// STEP 2: attach it\n//\nconst reducers = combineReducers({\n    user: userSlice.reducer\n});\n\nconst store = createStore(reducers);\n\n//\n// STEP 3: use it\n//\n\n// initial state of state.user\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// update the slice state with a partial model\nstore.dispatch(userSlice.actions.update({ age: '26' }));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"26\"\n  }\n}\n**/\n\n// set the slice state with a model\nstore.dispatch(userSlice.actions.set({\n    id: '456def',\n    name: 'bob',\n    age: '30'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bob\",\n    \"age\": \"30\"\n  }\n}\n**/\n\n// set the slice state status enum\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\n// or\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\n// state.user is now...\n/**\n{\n  ...\n  \"status\": \"Requesting\",\n}\n**/\n\n// hydrate the slice state with a model\nstore.dispatch(userSlice.actions.hydrate({\n    id: '789ghi',\n    name: 'carl',\n    age: '35'\n}));\n// state.user is now...\n/**\n{\n  ...\n  \"lastModified\": null,\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\n  \"model\": {\n    \"id\": \"789ghi\",\n    \"name\": \"carl\",\n    \"age\": \"35\"\n  }\n}\n**/\n\n// set the slice state error\n// NOTE: the Error is mapped to a serialize-able object by the action creator\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\n// state.user is now...\n/**\n{\n  ...\n  \"error\": {\n    \"stack\": 'Error: Uh-oh\\n ...',\n    \"message\": 'Uh-oh'\n  },\n}\n**/\n\n// reset the slice state back to its initial state\nstore.dispatch(userSlice.actions.reset());\n// state.user is now...\n/**\n{\n  \"status\": \"Settled\",\n  \"error\": null,\n  \"lastModified\": null,\n  \"lastHydrated\": null,\n  \"model\": {\n    \"id\": \"456def\",\n    \"name\": \"bobby\",\n    \"age\": \"30\"\n  }\n}\n**/\n```\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.7.2-alpha.0","_nodeVersion":"12.21.0","_npmVersion":"lerna/4.0.0/node@v12.21.0+x64 (linux)","dist":{"integrity":"sha512-FJn+d1WKkFV2iR8depScVyNUaDCdz+jQKXma7GfpSQ15hxx38OyemJms6rASuFxNUFPrcco6dV8b3wXhL31K1A==","shasum":"74d828a45d78e2628ddbded8def4110e2275d1f6","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.7.2-alpha.0.tgz","fileCount":28,"unpackedSize":196919,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJga/YMCRA9TVsSAnZWagAAFs4P/2uEllulK4Q8EbTeB+oJ\nfbSVVu2fYVxjY7bT7Am2PSuR+rhe1ZeVQHRNh9KuwWKZpqMQASYhoRk8iY7G\nESiT125KH+aXh2MlhrHzDYXiHpovxihhC5MGsjlOfrWVSRn1o4TW/i3oeRY4\n5vQEkTnS+2h1SpNhDWeyCKrjYGeUkkPw+xl6QdRmEfyjOyLRsjt2yB/uHHbh\nK59EG0ZWITid5gi3gksgGenxWrfZWp5/WzPO6CYr6NsTqpbxzQ6S3uQXu1as\nzAYICopud2djwq//8RemVTdy+7ztvq4dFRNTd/55MzwzZCCBU+1kGtP5G0Hj\n88T502o2VcPv/4gTqOOkO9zFZAb4Pk7vzTg+S3OuUa91Ds1Fy2C/gsQj/+hH\nHqDApRJvEsG/pzr0ptwfjQ440GMj6F61w4Yxv2qMLsfQYwoHKe0v7vE6pt9B\nqxzJLT51ageJGBAHGEo1Z2+vK/7ifRYveyyQ5xgACB4bvoxcY+3wK8dy/Gip\nzmD0kZFoTfY9uLxq7Oku6FCDDOnbvXzAMxt69YBDRiBnmu8HKXy9w99yTIbK\nyvDavlVArJN6CVYFsdKhfOll6TCVrZBWbnNqsJn3xeRhMvU20scmldNBuVfE\nmtsbUFcZawvnA+MivjqgufypTE8PNxC1w2RCYU3Nmpv6r1+Ec9U4MUnNKgTv\nkOpU\r\n=IHjy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGqOz1H3a9NKC/sHhKBiN39JEe4Q+pWz6scDvEwVcxl/AiEA/hQ6qLjL/ZuwxcoBeWXYAOPSUJRiwCqTxWlU9r45cz4="}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.7.2-alpha.0_1617688075954_0.8888369825741702"},"_hasShrinkwrap":false},"0.7.3":{"name":"@gjv/redux-slice-factory","version":"0.7.3","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.7.2","@microsoft/api-extractor":"^7.13.0","@reduxjs/toolkit":"^1.5.0","@types/jest":"^26.0.20","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.14.2","tsdx":"^0.14.1","tslib":"^2.1.0"},"dependencies":{"lodash.merge":"^4.6.2"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"8d7fe6da2c90adb143b6deb1e528928ca281c5e7","_id":"@gjv/redux-slice-factory@0.7.3","_nodeVersion":"13.9.0","_npmVersion":"lerna/4.0.0/node@v13.9.0+x64 (win32)","dist":{"integrity":"sha512-rhpt3bUs8QUIqsvM+H1mtGTXvSMyzcWEH04dvYRNrNYpmWD5bPiRvMVx4E2eMHkJpkXNYw7rVla1XMdbpoRcCA==","shasum":"b7657d13822fc27208be6db95d924ec3f58f45f9","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.7.3.tgz","fileCount":28,"unpackedSize":201796,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJga/bRCRA9TVsSAnZWagAActQQAIRfcAwAZl7A9+sdA75o\nveCOsdadf+n1fIfVK4Rwxmj6+dtr9GmP9aoz5mDWhS7OawCnNZqquR6HBQ5a\n+o5pFAhVuHFhgJXrTL44KWEBe8pCymxUKQCwThXFoIN/nBEsRDrPtOdx7nba\nbp6TlRaLwwimKqlbZj/hauhF1psGyPQktWmjHdIaqAAF4ZaETW4e1XUP4z8z\ne6KeyWHTPj9bktxjDlbwqvJAATVoM5fpkbTrFprmj3p7lI29L1Be1gnFpown\nbVnLX5GZec+6UJdjKXX1umcjupzCeJytkL0V10x/m8gAuS977xpIWlL4Utc2\nhL+23doP6LNW4JkNPoVqsNPwpJjyQIxWgJtV6hrHaxBxGhSOwMntJ8ASX1rK\nBcSPedaPLc0IFFLWsBLIVTP9AQdSG0p84g+H0YPbw3cXZ/I1ySbJTt5LyO4y\nF3y4MaDrZNv5LFeeUlFTzHxLyE1ASGKl1QCUVymvpyQWw+5gSpXnx1nsucSN\nnTf0GPF2QcEOcR7HqHaNEHKgwdO9akIBMsJVs3j8wNEh3gFD//9owIHJenqd\nqRnfzZNJvep1UXeOGjP072/vhDrzow86OcG7bGRRTyUgW56tK7/emzpQ9D/m\nCkHYsLk75hTIsIveSmfVHyLi7qYcxDp60TxOblgmDebzPoI5r9h1GGZyRZEG\nU/kw\r\n=5dzg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+JGZboArNEgi8Wc6WHPY/4+krcQDhgFoBBcwjaor+1gIhAMvD4D4IjVCKZVNo/hKKSHDAwl+O+0EQwwD91P9snHut"}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.7.3_1617688272596_0.4036135024629455"},"_hasShrinkwrap":false},"0.7.4":{"name":"@gjv/redux-slice-factory","version":"0.7.4","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.7.2","@microsoft/api-extractor":"^7.13.0","@reduxjs/toolkit":"^1.5.0","@types/jest":"^26.0.20","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^4.14.2","@typescript-eslint/parser":"^4.14.2","tsdx":"^0.14.1","tslib":"^2.1.0"},"dependencies":{"lodash.merge":"^4.6.2"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"42fc5f8ae191f33b1e34f3318d7806165db441b6","_id":"@gjv/redux-slice-factory@0.7.4","_nodeVersion":"13.9.0","_npmVersion":"lerna/4.0.0/node@v13.9.0+x64 (win32)","dist":{"integrity":"sha512-TNfwMhVORq3yx9ATPJOiiv023WJF16pLcMinQ2pYNg1fnKyKHdX47/wJ1VK0Wj7fMKpxHyUTFaSi37fR1BqpUg==","shasum":"515b808338701c46e6c63d01f9c6758aff1d009a","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.7.4.tgz","fileCount":28,"unpackedSize":201792,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgbgYhCRA9TVsSAnZWagAAKWIP/1mJLN3X/FakYlEsa8qH\nJ8qSIUUkyD9pjkqNxWGXf5Se8R5kOiOHm19TBdScLjTOoClKasU4AMnWN1j5\nVIJUDhy9gc3wOM2HZarB7II2K90lq7GzY5L7jvD6AgeUq66QyPJttVxi50lE\n9uwmrB/iVRbuzeFxA627V0f78qWM0dC2wN1omk8LRrURmQxRj0XExziGMMbD\nyz5h+xjtDJ2lIWnSJ6scC0gDJz+VcvP/Sv+5ug8VCCJHLAbOKMHVwPQVRlAZ\nMUGFNQsa4E3OhY275pY5vWKDzptkPAZDLFJD0b7+4faJbwp6stfjt5zXLH8v\nWyIAnEdC6/JHtOiCQNNxzO0qfYV2t9WDMkh99rJHWenrxOaAZFzVfSwMYBCp\nDvBTa9ypPYI9zeiay2u2hJDMVUOJOU9QP2VDw0USVWxFwYQr6Q/MEH8uFMgf\np57qTu6C7qWrHN5zhqAMKm8YkAkxlB9WN1U9dzdZXOBO7qV0bH0OLWbQZqL4\nxRZY9oXUdnGoppDyvMAi/Uh1kRNrv+p54NUtKnqsPvvTCgGwod/wpjpsxSo1\n36jbT2TtUKJR0Q//vrTfMig2swJPwAyRQIR+MQRe4JGuWc2MyzzAgqA78Wtf\ndzsq8sey39Aju28LFf95pm8NHay36z4MQ8adtiPLmPK3dLGhxaYmBANBNktg\nDr9E\r\n=iwyg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCyz219spm6wbiKoFv1yTAZXMPDfNgIp7hWAtDZTfcuugIgWpJHpeKDgT1gz9NB2cIDB2clMn4nfFct6aSqb9duKVY="}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.7.4_1617823265090_0.465697142441063"},"_hasShrinkwrap":false},"0.8.0":{"name":"@gjv/redux-slice-factory","version":"0.8.0","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:update":"npm-check -u","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.8.0","@microsoft/api-extractor":"^7.16.1","@reduxjs/toolkit":"^1.6.0","@types/jest":"^26.0.23","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^4.28.0","@typescript-eslint/parser":"^4.28.0","npm-check":"^5.9.2","tsdx":"^0.14.1","tslib":"^2.3.0"},"dependencies":{"lodash.merge":"^4.6.2"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"85291b86dd581532dd7dd88f08a7628ca64cf57d","_id":"@gjv/redux-slice-factory@0.8.0","_nodeVersion":"16.2.0","_npmVersion":"lerna/4.0.0/node@v16.2.0+x64 (win32)","dist":{"integrity":"sha512-lcN3WFw460eSH9atBDCnmELc8Nm1Cx12JdRrULUcbZ8fk5axQAxNFPrcSJONE2APN0Wt0h+hqr8vjr8G6VvHdA==","shasum":"cc55ddb621442780931f7135412fcfbd4d87948c","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.8.0.tgz","fileCount":28,"unpackedSize":203201,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg1AhvCRA9TVsSAnZWagAARRcP/0/gboABkQx1wHKfAbfI\nOOqMOt5xtuXy70EunuDj7VuS2IffPG6A855iS9YQCKWljuHE4WAVQpvj3E3+\nAk1nneByN0Qf97tV7qwcIdQzttp3snf3FMF8KxG5lvKWS6W7+IHTYQioS0xD\n0KhPMY9SFm2wdTatMi+6qeUHm1V0oEUb8lLgs4qfLG/Lq/ZFkO5umjJHHhWB\np3kE3s8Sgen889E5l9F5IkMo2e9TEZm83/+NWl6cwEhxD3pao0cu0VH9OXG4\npeSBug6azx17h8cLFH0jvuFGpeTSG6KlaXAjOwJftsnfIywOe9DLyWNnvYJ7\nKrdnThgTGmGc0l9jeQOvPEHosmK5zTZ1pAHPsYTY+fUuVSKJRoFz0pAU13HG\nYipg+Bf2tWK6NgwesesDvwNPQdGjtysj+CUlxO8+DwwIEjzG2AGifBDnTwGU\nxM35an7CXG3TYMrf7otoUaK4ce9nNOUO9X4pI+JQAXHQ9EVA2iybKJTksRJ6\nYNjJJiSjHTRU0vZKCb2uQhD2wKbdoYznwoUlHXsUfXcqYwFplJT8mWueU3R0\n+9bvJAJqWLEzpNyvWD89PasaxLfTuU7k4BoRDXucC4SudclsxxTIaXXowCaI\nZIBX40FJSReK5rrOSykb2zlHEyYsEZwohTeyD/nsr7BhoS9QPqjUjd+llIUM\nz/dE\r\n=UcKJ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC4PuKhhTC+sA+ZmBqjhk2schJVet5ktsuwChALNFmd9wIgMPpvV064ijaTex2WpnoctHAhofXK5DvGkG7WbvqU8x8="}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.8.0_1624508527569_0.9212111718282567"},"_hasShrinkwrap":false},"0.8.1":{"name":"@gjv/redux-slice-factory","version":"0.8.1","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:update":"npm-check -u","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"^1.4.0"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.8.1","@microsoft/api-extractor":"^7.16.1","@reduxjs/toolkit":"^1.6.0","@types/jest":"^26.0.23","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^4.28.0","@typescript-eslint/parser":"^4.28.0","npm-check":"^5.9.2","tsdx":"^0.14.1","tslib":"^2.3.0"},"dependencies":{"lodash.merge":"^4.6.2"},"keywords":["redux","react","starter","toolkit","reducer","slice","immer","immutable","action","selector","factory"],"gitHead":"b2c7a6269659da3cc54aa796e9e747cc2fd2f7e4","_id":"@gjv/redux-slice-factory@0.8.1","_nodeVersion":"16.2.0","_npmVersion":"lerna/4.0.0/node@v16.2.0+x64 (win32)","dist":{"integrity":"sha512-ZEXmdIT5Pcj0m4NUn/vLALqDz/XoVAuuQ5f/rXqR5KixH883ihf2cjj3CnFY2Dj6126L4B8LeDEttmWKQbBwCQ==","shasum":"4a2819002b266a48272161c83b9063985415efa4","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.8.1.tgz","fileCount":28,"unpackedSize":203644,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg1BDtCRA9TVsSAnZWagAAEKkQAIK7QSwdlfEzMt9N+0sG\nBxuDfMDGuCLgtjbQP5MZxP7gQDBu78Cqhb4aak+tKmNgCi1+mQpOQcCMnbYl\nA7cUgLNjXw7fooFHRDWbeMB1De3NW/pZWfwI679VNZG4uTiBxUVXWV84ReJ4\nktfm3ozG6jNxsoElCtkWBL0ij+t9OJ15zikRJaJGRLYEurfMAmB1iXQ8Ufr8\n/1fejXjjWTqf+DzOq3mFOQuhPm1D/uEcQJVql9hrDK5ENAQRvUBLn7iWMVWj\nRV2U8+Fy0hge/I4CLrZHzcX7aM1D9QZxIWFt1hD9CjTwn+qRMWvz2sw2VbNE\nR2V3EoALZKpomteM1Nsw064j2y1fws5+IyXGHofOmrUYvOhXg+KmeWDXubso\nKkf0psaqoRJzsswZMYdosjq9l4KYuBKvvnCOT8ksORIhsxnwUV4hV2cmWWx2\nRKnkn1NhQAzZTbltnhOKdCexjXO8pK94rl67k6TRJI9MB8kY6+HHMwCrDL+H\n11pTO4Vn1z/DNbW+/ShHvkmYrg7JPHAKZb9GSYZMBDrQu0yRLblkSJ4Lg+po\nZLq82/j+mzpkZupnbhu7NVgjYv3Wl4Mtb0jn34bHnie4HgvxS48kQxrvOVSs\nA8CAaXS0bKOsCa6ylsONi/Gk22VwtB6EevqCJZHNL8kZkk/7nLudtbfLRSnL\n1i0c\r\n=KEay\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICesxTUP+IiubWPiKUn8f0D2oX3aCSK9u6x7Mb+5mWN3AiEA3G+UH0lBpAlfH4+eb8JkmvPtgzp8AoppDxcSJH3K/uM="}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.8.1_1624510700916_0.8418654223677502"},"_hasShrinkwrap":false},"0.9.0":{"name":"@gjv/redux-slice-factory","version":"0.9.0","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:update":"npx npm-check -u","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"~1"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.9.0","@microsoft/api-extractor":"^7.18.13","@reduxjs/toolkit":"^1.6.2","@types/jest":"^27.0.2","@typescript-eslint/eslint-plugin":"^4.33.0","@typescript-eslint/parser":"^4.33.0","eslint-plugin-tsdoc":"^0.2.14","tsdx":"^0.14.1"},"dependencies":{"ts-deepmerge":"^1.0.8","tslib":"^2.3.1"},"keywords":["redux","react","starter","toolkit","reducer","slice","state","immer","immutable","predictable","functional","action","selector","factory","shape","model","entity","createSlice","createModelSlice","createEntitySlice","redux-toolkit","redux-slice-factory"],"gitHead":"389ca45b23d55a3915dabd26a93c3a4800bba4f8","_id":"@gjv/redux-slice-factory@0.9.0","_nodeVersion":"16.6.1","_npmVersion":"lerna/4.0.0/node@v16.6.1+x64 (win32)","dist":{"integrity":"sha512-SgnY8CzfW+om3qEtc/vv8AldK5VwmEI/aJhZyKE7JiawEFIoWX0p59ZKMDr68P3W0Y+TeeQfq52/LHRQnxIFbA==","shasum":"b6a23941d1208ffffca6b2c7343a5528429d5329","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.9.0.tgz","fileCount":28,"unpackedSize":207726,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIE30t8TNWlhHCDjGO+V+un3Kz/NxWAL/ZmCDvr69Rdt3AiB71nGopzCNkSJRsgFTBJ91NRmJ1kgF9bCtMgIZ3F9Szg=="}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.9.0_1633576918127_0.2715250561602216"},"_hasShrinkwrap":false},"0.9.1":{"name":"@gjv/redux-slice-factory","version":"0.9.1","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:update":"npx npm-check -u","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"~1"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.9.1","@microsoft/api-extractor":"^7.18.13","@reduxjs/toolkit":"^1.6.2","@types/jest":"^27.0.2","@typescript-eslint/eslint-plugin":"^4.33.0","@typescript-eslint/parser":"^4.33.0","eslint-plugin-tsdoc":"^0.2.14","tsdx":"^0.14.1"},"dependencies":{"ts-deepmerge":"^1.0.8","tslib":"^2.3.1"},"keywords":["redux","react","starter","toolkit","reducer","slice","state","immer","immutable","predictable","functional","action","selector","factory","shape","model","entity","createSlice","createModelSlice","createEntitySlice","redux-toolkit","redux-slice-factory"],"gitHead":"2f356c3377cf6262088dfcb79c13c888560e038e","_id":"@gjv/redux-slice-factory@0.9.1","_nodeVersion":"16.6.1","_npmVersion":"lerna/4.0.0/node@v16.6.1+x64 (win32)","dist":{"integrity":"sha512-Z9CFztkG533oejTSTQD3PYkMekO8Su+hhZM1U+zRO/oXrRLoFmznQw7MoPUJCF3ULt1g6lcvEa80AC1+Jgpayw==","shasum":"2c2078db2ae0d02acc4fc0d96d29768b85aee013","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.9.1.tgz","fileCount":28,"unpackedSize":207726,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCxQTwCqFGRf5s+7DgAqWl15t7imql/riDYxgVajqkLzgIgENrtMfRQal++gQHF/9HXIDhihc/dUTM/NY2Y1UtBiXc="}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.9.1_1633577467286_0.6328888283013012"},"_hasShrinkwrap":false},"0.9.2":{"name":"@gjv/redux-slice-factory","version":"0.9.2","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:update":"npx npm-check -u","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"~1"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.9.2","@microsoft/api-extractor":"^7.18.13","@reduxjs/toolkit":"^1.6.2","@types/jest":"^27.0.2","@typescript-eslint/eslint-plugin":"^4.33.0","@typescript-eslint/parser":"^4.33.0","eslint-plugin-tsdoc":"^0.2.14","tsdx":"^0.14.1"},"dependencies":{"ts-deepmerge":"^1.0.8","tslib":"^2.3.1"},"keywords":["redux","react","starter","toolkit","reducer","slice","state","immer","immutable","predictable","functional","action","selector","factory","shape","model","entity","createSlice","createModelSlice","createEntitySlice","redux-toolkit","redux-slice-factory"],"gitHead":"5e983810e4c1c62b7a30bf9293e9a4ea1d4325e5","_id":"@gjv/redux-slice-factory@0.9.2","_nodeVersion":"16.6.1","_npmVersion":"lerna/4.0.0/node@v16.6.1+x64 (win32)","dist":{"integrity":"sha512-mlFPm4yYnpetZ2eiD5nLT7HpLGsm9Q9BoOvQH9WhjQILKFmIzQ+kgEY/97IbdhTn7X5xL/ZYmjl5kGTbIjhogw==","shasum":"41171514f3ad65b23231438e51c8495dfd59fc50","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.9.2.tgz","fileCount":28,"unpackedSize":207731,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2I70CRA9TVsSAnZWagAA/IoQAJtxL561k9GVDHI1YCjG\nqvcDneORnjdc8G+bmJIogMaEICexm8uJUM0UJLJplCQlpeF268eGHUHynmag\naadZI7dsEGYO4FWrD3gmGHvRZuG3aBSW+Qz9Q5wJVZWMP5o2ndplg3jP/bJt\nx3c9QIkamhQQTBdEo0tyyNgivIEDGULQ4v8n92FjAmvBWI2+9ZXCq+S5Go0/\nYk1ueIQmek3HptLGrg7javxuwrWoh1TSXJiYtnKcewXKV/OZ9Vb2g7AVJTIa\nzqKuOwU1eFuvMBvGksK7sEFYv0CGBSKya+F5hi/ePjkjOd7KfSrTOSKMamxf\npVeqi0wviiTVANv0clhfQ9g7V2b2Nb1y5kZ1tcVZe7ae/IsTe6IymZ5CmGEB\nJ5R8OBwmLEONZMgkKikJ/tLqIa+RT5ajurfBSXPCzR1HIlXU80F9C3o/J98E\n05bwZLgGy3kAnnWd9qvSd8Bu95XTSzdPJLoLz3XxcydlrMTdDAxqngQyCdaD\nJooAJINDuXqF3DkfbYN+ojCCfWxAxPdbWFDg3V+Myo+3DGmmFQAYb/LBQ+tM\nTcEfLdVrwXiQkif8aUr4pvQuGu0Yk+OaBp+AZrcg8GY4qluAeESJTRMmKHC9\n5y+kEmbU0+Ipn+kkJKN6mAW+6Z0KaGl3sQk6wmrFqyW+CexUksDOMXBXi8WW\njAcT\r\n=rnH9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFTrdu8Tb07jDQTn4ftZZhtl9KK37heeCWL9y9Ai9c+BAiBJppbhbpEKGXY4xVZ8JSwNFvGtM3lJYc3O+loOUcolBw=="}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.9.2_1634564622708_0.5736348421609057"},"_hasShrinkwrap":false},"0.10.0-alpha.8":{"name":"@gjv/redux-slice-factory","version":"0.10.0-alpha.8","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:update":"npx npm-check -u","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"~1"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.10.0-alpha.8+4c1a9bc","@jest/globals":"^27.4.6","@microsoft/api-extractor":"^7.19.4","@reduxjs/toolkit":"^1.7.1","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^5.10.2","@typescript-eslint/parser":"^5.10.2","eslint-plugin-tsdoc":"^0.2.14","tsdx":"^0.14.1"},"dependencies":{"lodash.merge":"^4.6.2","tslib":"^2.3.1"},"keywords":["redux","react","starter","toolkit","reducer","slice","state","immer","immutable","predictable","functional","action","selector","factory","shape","model","entity","createSlice","createModelSlice","createEntitySlice","redux-toolkit","redux-slice-factory"],"gitHead":"4c1a9bcc8e7d5de4ad16c947613e634fd79ca534","readme":"# `redux-slice-factory` 🍕🏭\r\n\r\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\r\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\r\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\r\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\r\n\r\n> A light-weight package with generic factory functions for common slice data structures\r\n\r\n## Install 💾\r\n```shell\r\nnpm install @gjv/redux-slice-factory\r\n```\r\n\r\n## What's the goal? 🏆\r\nThis package will\r\n- reduce boilerplate\r\n- prevent duplicate code\r\n- save you time & effort\r\n\r\nby providing\r\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\r\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\r\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\r\n- a common set of actions and selectors shared by slices of the same data structure\r\n\r\n## What's included? 📦\r\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\r\nHere's an [example](https://github.com/gregjoeval/package-library/blob/master/packages/redux-slice-factory/docs/CreateModelSlice.md) with a slice for a user profile.\r\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\r\nHere's an [example](https://github.com/gregjoeval/package-library/blob/master/packages/redux-slice-factory/docs/CreateEntitySlice.md) with a slice for multiple user profiles.\r\n\r\n## What's a slice? 🍕\r\nSimilar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\r\n\r\nthe `name` describes the domain the slice is responsible for, \r\n\r\nthe `reducer` manages data interactions between state and actions,\r\n\r\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\r\n \r\nthe `selectors` expose memoized functions to read data from global state.\r\n\r\n#### Where are the `action types`?\r\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\r\n\r\n```typescript\r\nconst { actions } = createModelSlice('MyModelSliceName', ...)\r\nconsole.log(`${actions.update}`)\r\n// -> \"MyModelSliceName/update\r\n```\r\n\r\n## Show me the code 💻\r\nFor a more extensive, real-world use cases check out the [examples](#What's-included?) listed above.\r\n\r\n```typescript\r\n//\r\n// STEP 1: create the slice\r\n// UserSlice.ts\r\n//\r\nimport { createModelSlice, IModelState, StatusEnum } from '@gjv/redux-slice-factory';\r\nimport { IGlobalState } from './configureStore';\r\n\r\ninterface IUserModel {\r\n    id: string;\r\n    name: string;\r\n    age: string;\r\n}\r\n\r\nconst bob: IUserModel = {\r\n    id: '456def',\r\n    name: 'bobby',\r\n    age: '30'\r\n};\r\n\r\ntype IUserSliceState = IModelState<IUserModel>\r\n\r\nconst slice = createModelSlice<IGlobalState, IUserModel>({\r\n    name: 'user',\r\n    selectSliceState: (globalState) => globalState.User,\r\n    initialState: bob\r\n});\r\n\r\nconst UserSlice = {\r\n    name: slice.name,\r\n    reducer: slice.reducer,\r\n    actions: slice.actions,\r\n    selectors: slice.selectors\r\n};\r\n\r\nexport default UserSlice;\r\nexport type { IUserSliceState }\r\n\r\n//\r\n// STEP 2: attach the slice to the global store\r\n// configureStore.ts\r\n//\r\nimport { configureStore } from '@reduxjs/toolkit'\r\nimport UserSlice, { IUserSliceState } from './UserSlice'\r\n\r\ninterface IGlobalState {\r\n  user: IUserSliceState;\r\n}\r\n\r\nconst reducers = {\r\n    user: UserSlice.reducer\r\n};\r\n\r\nconst store = rtkConfigureStore({\r\n  reducer: reducers,\r\n  middleware: (getDefaultMiddleware) => getDefaultMiddleware(),\r\n});\r\n\r\nexport default store;\r\nexport type { IGlobalState };\r\n\r\n//\r\n// STEP 3: use the slice\r\n//\r\n\r\n// initial state of state.user\r\n/**\r\n{\r\n  \"status\": \"Settled\",\r\n  \"error\": null,\r\n  \"lastModified\": null,\r\n  \"lastHydrated\": null,\r\n  \"model\": {\r\n    \"id\": \"456def\",\r\n    \"name\": \"bobby\",\r\n    \"age\": \"30\"\r\n  }\r\n}\r\n**/\r\n\r\n// update the slice state with a partial model\r\nstore.dispatch(userSlice.actions.update({ age: '26' }));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\r\n  \"model\": {\r\n    \"id\": \"456def\",\r\n    \"name\": \"bobby\",\r\n    \"age\": \"26\"\r\n  }\r\n}\r\n**/\r\n\r\n// set the slice state with a model\r\nstore.dispatch(userSlice.actions.set({\r\n    id: '456def',\r\n    name: 'bob',\r\n    age: '30'\r\n}));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\r\n  \"model\": {\r\n    \"id\": \"456def\",\r\n    \"name\": \"bob\",\r\n    \"age\": \"30\"\r\n  }\r\n}\r\n**/\r\n\r\n// set the slice state status enum\r\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\r\n// or\r\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"status\": \"Requesting\",\r\n}\r\n**/\r\n\r\n// hydrate the slice state with a model\r\nstore.dispatch(userSlice.actions.hydrate({\r\n    id: '789ghi',\r\n    name: 'carl',\r\n    age: '35'\r\n}));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"lastModified\": null,\r\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\r\n  \"model\": {\r\n    \"id\": \"789ghi\",\r\n    \"name\": \"carl\",\r\n    \"age\": \"35\"\r\n  }\r\n}\r\n**/\r\n\r\n// set the slice state error\r\n// NOTE: the Error is mapped to a serialize-able object by the action creator\r\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"error\": {\r\n    \"stack\": 'Error: Uh-oh\\n ...',\r\n    \"message\": 'Uh-oh'\r\n  },\r\n}\r\n**/\r\n\r\n// reset the slice state back to its initial state\r\nstore.dispatch(userSlice.actions.reset());\r\n// state.user is now...\r\n/**\r\n{\r\n  \"status\": \"Settled\",\r\n  \"error\": null,\r\n  \"lastModified\": null,\r\n  \"lastHydrated\": null,\r\n  \"model\": {\r\n    \"id\": \"456def\",\r\n    \"name\": \"bobby\",\r\n    \"age\": \"30\"\r\n  }\r\n}\r\n**/\r\n```\r\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.10.0-alpha.8","_nodeVersion":"17.3.1","_npmVersion":"lerna/4.0.0/node@v17.3.1+x64 (win32)","dist":{"integrity":"sha512-WFIrh7Pm40bnRQrg5npQuB1NQ7uM19NIBc1jra0fbkvYS6/s4L7QOGVp+nTgzh94thrn6KYHoDAAKDdyoZNwmg==","shasum":"c31ca7476ced7215c48b54c3c6859809a7168ef7","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.10.0-alpha.8.tgz","fileCount":29,"unpackedSize":227828,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+ij6CRA9TVsSAnZWagAATY4QAJLD8pqS4jcZ+I7G4LyU\n7w4knlFMyermgZm0IwrDVMC8FTdDOkg/UdF2KI8GNlHtdCBCDK2QppMulIpe\nGtubkFZidxMXRKSDU5l1cUP+sDxOUXbFBLnG1vEpzy2e4iWghFHXrXF7V/FR\nBwjwEotOxgCTzFyjlhKwS5De7812zZDQ1n9czUagfvPz3QT8Ue+2rk3Vbunz\n3ctiMhxjgzCiqc5coV+loNj3B/wjg5RtOqpLjhXJ1sVyZYOZ/1+KhpqPnGaV\nmxC+ECS1Lz4I4BwRd3xrvXTBJ3Wfs6L/2AM0S5WgmtUrS4U2QKWDOVoobY4O\n1Jl8d/Pi6pzM+1+nJdNDW2nQWK4w6ZTAfZBKgIq+WryUvly6+6yn2FiuoxEs\nldVlKi8v9UhBGsWtNykBNFX3LmumfsimgpM7U6KIwBdklBNTQjTX9d6b/5Qr\n2ZLVE4fH7cNjEdp/bOWTBitWh5jjsWPJTMrQCTes+IeIzh7xau/W3WVag1Un\ngXHzxBQKYQ4X85s5i9UNNON6ZiDQ7rbU4lT5YbxQRLJnFggsJRHg1jd+8+S9\n2EXCRQosxZNdzyxBHMwcgHFsUHOT4dRPHDRoPkoAOoCiAABgu+dInXU1MUk0\n4Fikb6JflVqN0+hUp0LesnbR6xzEV7yNfCHFFeWNVlYMGi0b0JWrZ0eG9J2m\ngkno\r\n=0jCM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD8hrE4xmzrfy3S9vC8Dj4RO0LFKYueA+61OeGwvTrbIQIhAMmy5B/p+zRIukxiYCYJdXzOypfqF0ODf3OspvPIQ4Jx"}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.10.0-alpha.8_1643784442246_0.30706447362617006"},"_hasShrinkwrap":false},"0.10.0":{"name":"@gjv/redux-slice-factory","version":"0.10.0","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:update":"npx npm-check -u","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"~1"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.10.0","@jest/globals":"^27.4.6","@microsoft/api-extractor":"^7.19.4","@reduxjs/toolkit":"^1.7.1","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^5.10.2","@typescript-eslint/parser":"^5.10.2","eslint-plugin-tsdoc":"^0.2.14","tsdx":"^0.14.1"},"dependencies":{"lodash.merge":"^4.6.2","tslib":"^2.3.1"},"keywords":["redux","react","starter","toolkit","reducer","slice","state","immer","immutable","predictable","functional","action","selector","factory","shape","model","entity","createSlice","createModelSlice","createEntitySlice","redux-toolkit","redux-slice-factory"],"gitHead":"4c1a9bcc8e7d5de4ad16c947613e634fd79ca534","_id":"@gjv/redux-slice-factory@0.10.0","_nodeVersion":"17.3.1","_npmVersion":"8.3.0","dist":{"integrity":"sha512-3nG/CWrL2iRqgv4XAZneOYrjYXfEUF7vQJ/HHDRimINcSe5bSGyMQ+IX/nYwforMQtYIGeC8ThwCBedVTSJmHQ==","shasum":"51bdd6a3e38cc972b9680347b750cdbdb0b7e4c2","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.10.0.tgz","fileCount":29,"unpackedSize":227796,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+is9CRA9TVsSAnZWagAA3P4P/iOkpnE2uaNuj1PbopIf\nJhREQqAML0CvtYEJw6PeLn4ZcndaEOkwtOdSWlkjrYMuT58Sytww4wNoWCN0\nSdBblmbFtiexTa1QB8XOXALjssK+Q7jJpK0ydiI5swcLhZBlETEQajY6KlFT\nB58fDSbioWnQVw5JsB+8VMqnp7MOYXWpyptspWLmMx4os3yUWGYmG4WLPbq5\n7rxf+cz2K7FDyynldcEbKh904qPJpb490yztnnMY3jSL73Gi0ogXzzIV5cMi\nqpKRwjjc6g6alK8yHGmsOvbMdY3MQe9B7BmEJOcSEmKJxMRLKykF12PYdy+K\nZGuIHSk97KnPioT4wuyDrIK4jgcABF6uiBoVaHFDsSriC0l6T9KIoNLm7+9J\nWqjGN8fnWdu0Jg6qWt03AGVDyDmrUBNs6uUHq+sZxJ6NqDEjUeAGAt7yLXlu\nti/b1C9XKRfz5mzlcplf1ydvefWykwUDHLhlWCXPbACW3s4JvQduCyOXgNKS\ncrKSTVY/dHD2D5dJs5yANmXNLJnDSBaDtV+BPPPdUje+w1ecxxVQor8Jl2rg\n11aAXSLKVvX/lRyi9NQFskQ0i5acGsL9lwu/N7OyBf+OOo6KjICTa3XK/zhT\n3kmIRZsf8jqTXeg4uU6Y6rI5ArlOVVJduQBGqX1RfHcQkUhRew4l0renV/1B\n39VW\r\n=wn15\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDF49M8RZ49fYe4duhtqCn6q5BbCpGsbiJ/q+We9TLJqgIgQ4i4GKO50elUVH9jBR2wbkK1MPag9WZwuq5H1YbDmWA="}]},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.10.0_1643785021368_0.9467813087863681"},"_hasShrinkwrap":false},"0.10.1-alpha.10":{"name":"@gjv/redux-slice-factory","version":"0.10.1-alpha.10","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:update":"npx npm-check -u","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"~1"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.10.1-alpha.10+547588c","@jest/globals":"^27.5.1","@microsoft/api-extractor":"^7.22.1","@reduxjs/toolkit":"^1.8.1","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^5.19.0","@typescript-eslint/parser":"^5.19.0","eslint-plugin-tsdoc":"^0.2.16","tsdx":"^0.14.1"},"dependencies":{"lodash.merge":"^4.6.2","tslib":"^2.3.1"},"keywords":["redux","react","starter","toolkit","reducer","slice","state","immer","immutable","predictable","functional","action","selector","factory","shape","model","entity","createSlice","createModelSlice","createEntitySlice","redux-toolkit","redux-slice-factory"],"gitHead":"547588c6ad7ff29b9b5070c8d7fc0fc80ce58464","readme":"# `redux-slice-factory` 🍕🏭\r\n\r\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\r\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\r\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\r\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\r\n\r\n> A light-weight package with generic factory functions for common slice data structures\r\n\r\n## Install 💾\r\n```shell\r\nnpm install @gjv/redux-slice-factory\r\n```\r\n\r\n## What's the goal? 🏆\r\nThis package will\r\n- reduce boilerplate\r\n- prevent duplicate code\r\n- save you time & effort\r\n\r\nby providing\r\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\r\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\r\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\r\n- a common set of actions and selectors shared by slices of the same data structure\r\n\r\n## What's included? 📦\r\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\r\nHere's an [example](https://github.com/gregjoeval/package-library/blob/master/packages/redux-slice-factory/docs/CreateModelSlice.md) with a slice for a user profile.\r\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\r\nHere's an [example](https://github.com/gregjoeval/package-library/blob/master/packages/redux-slice-factory/docs/CreateEntitySlice.md) with a slice for multiple user profiles.\r\n\r\n## What's a slice? 🍕\r\nSimilar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\r\n\r\nthe `name` describes the domain the slice is responsible for, \r\n\r\nthe `reducer` manages data interactions between state and actions,\r\n\r\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\r\n \r\nthe `selectors` expose memoized functions to read data from global state.\r\n\r\n#### Where are the `action types`?\r\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\r\n\r\n```typescript\r\nconst { actions } = createModelSlice('MyModelSliceName', ...)\r\nconsole.log(`${actions.update}`)\r\n// -> \"MyModelSliceName/update\r\n```\r\n\r\n## Show me the code 💻\r\nFor a more extensive, real-world use cases check out the [examples](#What's-included?) listed above.\r\n\r\n```typescript\r\n//\r\n// STEP 1: create the slice\r\n// UserSlice.ts\r\n//\r\nimport { createModelSlice, IModelState, StatusEnum } from '@gjv/redux-slice-factory';\r\nimport { IGlobalState } from './configureStore';\r\n\r\ninterface IUserModel {\r\n    id: string;\r\n    name: string;\r\n    age: string;\r\n}\r\n\r\nconst bob: IUserModel = {\r\n    id: '456def',\r\n    name: 'bobby',\r\n    age: '30'\r\n};\r\n\r\ntype IUserSliceState = IModelState<IUserModel>\r\n\r\nconst slice = createModelSlice<IGlobalState, IUserModel>({\r\n    name: 'user',\r\n    selectSliceState: (globalState) => globalState.User,\r\n    initialState: bob\r\n});\r\n\r\nconst UserSlice = {\r\n    name: slice.name,\r\n    reducer: slice.reducer,\r\n    actions: slice.actions,\r\n    selectors: slice.selectors\r\n};\r\n\r\nexport default UserSlice;\r\nexport type { IUserSliceState }\r\n\r\n//\r\n// STEP 2: attach the slice to the global store\r\n// configureStore.ts\r\n//\r\nimport { configureStore } from '@reduxjs/toolkit'\r\nimport UserSlice, { IUserSliceState } from './UserSlice'\r\n\r\ninterface IGlobalState {\r\n  user: IUserSliceState;\r\n}\r\n\r\nconst reducers = {\r\n    user: UserSlice.reducer\r\n};\r\n\r\nconst store = rtkConfigureStore({\r\n  reducer: reducers,\r\n  middleware: (getDefaultMiddleware) => getDefaultMiddleware(),\r\n});\r\n\r\nexport default store;\r\nexport type { IGlobalState };\r\n\r\n//\r\n// STEP 3: use the slice\r\n//\r\n\r\n// initial state of state.user\r\n/**\r\n{\r\n  \"status\": \"Settled\",\r\n  \"error\": null,\r\n  \"lastModified\": null,\r\n  \"lastHydrated\": null,\r\n  \"model\": {\r\n    \"id\": \"456def\",\r\n    \"name\": \"bobby\",\r\n    \"age\": \"30\"\r\n  }\r\n}\r\n**/\r\n\r\n// update the slice state with a partial model\r\nstore.dispatch(userSlice.actions.update({ age: '26' }));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\r\n  \"model\": {\r\n    \"id\": \"456def\",\r\n    \"name\": \"bobby\",\r\n    \"age\": \"26\"\r\n  }\r\n}\r\n**/\r\n\r\n// set the slice state with a model\r\nstore.dispatch(userSlice.actions.set({\r\n    id: '456def',\r\n    name: 'bob',\r\n    age: '30'\r\n}));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\r\n  \"model\": {\r\n    \"id\": \"456def\",\r\n    \"name\": \"bob\",\r\n    \"age\": \"30\"\r\n  }\r\n}\r\n**/\r\n\r\n// set the slice state status enum\r\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\r\n// or\r\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"status\": \"Requesting\",\r\n}\r\n**/\r\n\r\n// hydrate the slice state with a model\r\nstore.dispatch(userSlice.actions.hydrate({\r\n    id: '789ghi',\r\n    name: 'carl',\r\n    age: '35'\r\n}));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"lastModified\": null,\r\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\r\n  \"model\": {\r\n    \"id\": \"789ghi\",\r\n    \"name\": \"carl\",\r\n    \"age\": \"35\"\r\n  }\r\n}\r\n**/\r\n\r\n// set the slice state error\r\n// NOTE: the Error is mapped to a serialize-able object by the action creator\r\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"error\": {\r\n    \"stack\": 'Error: Uh-oh\\n ...',\r\n    \"message\": 'Uh-oh'\r\n  },\r\n}\r\n**/\r\n\r\n// reset the slice state back to its initial state\r\nstore.dispatch(userSlice.actions.reset());\r\n// state.user is now...\r\n/**\r\n{\r\n  \"status\": \"Settled\",\r\n  \"error\": null,\r\n  \"lastModified\": null,\r\n  \"lastHydrated\": null,\r\n  \"model\": {\r\n    \"id\": \"456def\",\r\n    \"name\": \"bobby\",\r\n    \"age\": \"30\"\r\n  }\r\n}\r\n**/\r\n```\r\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.10.1-alpha.10","_nodeVersion":"17.3.1","_npmVersion":"lerna/4.0.0/node@v17.3.1+x64 (win32)","dist":{"integrity":"sha512-JxZeeU7z6WA0NTCkjLDtPeSM8VAMyj46treo+jk2bR8b0yjGmzVnufhCmv1poBavECFOruqeOKy27T6dyZ+WCQ==","shasum":"1833105f250b39cc90d31804dc73c971f48c4b98","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.10.1-alpha.10.tgz","fileCount":29,"unpackedSize":228071,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC/FuFA+rOFaun3Y9hsTMu8HVhwIAn++wK4Ya5uym2FdAIhAPoe84P9r38Ritx/YUEksvSy8+Va+jmy52MkN6bRbcIR"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiV4x7ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpNpw//QVqyCuMK18ZldvP37Xbu/rl5GK2Jpd7UprzcslbH2aW4RRKF\r\n2IYsdr8s8hPdvQPYnhmuFGi4ZEEXDLAAaKJ1Y5w5jXHuiMRE4cICySMTHuU4\r\nqub3/X/d2egR0RrPjc3XtjVu0MtbK69OIM4doRPnunkM474TFBoUQ/N/H2Vw\r\nr18ao02B1vZ+fmNsHKikm1MvQnPlh8CZUIRklsoMqMl4IUoAPwPi/E9TS3uV\r\nc4qt9058nliRXH04A1I+HSdddHas8jzrl9HYdDFHj04wcEqz1HrFq3/UPhlh\r\n+cbsLb132dwJWKiNDV+aHcNjOpYdRsC9dIH00GMOETxFEyeoG+v2VStjDJEj\r\n643Ep1vbJO8nT4xSwGDBmFedED5ImHV9wWnByd4R9tUPurQZ3TEE1II020q7\r\n3mUEGKkgbFiRsNDiEplXuy4TcXXO/MPj3qVaX5W5yYdcOqj+12TElrSQCOam\r\nQStancJX9CyVDbyBPFWsHOcKUZVntsuXLQ54WjxhatDN4V8K3+63Ln7MHUHo\r\noEqAq4sz8aTvGvZ+gtbO7DCoL63okTR1vCRUzMHUTK95T7MtRXgiEmMekBDw\r\n/Q7lq5Vg7FI7a/Yz1HsyYufqLw48XjnHhH/QBr80MGoTunH1IWlGi/qIfIQQ\r\nU73MamMppMS9O4bMh08fX7E/4rVTH+ZtTV0=\r\n=7cHJ\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.10.1-alpha.10_1649904762732_0.3031229403438285"},"_hasShrinkwrap":false},"0.10.1-alpha.11":{"name":"@gjv/redux-slice-factory","version":"0.10.1-alpha.11","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:update":"npx npm-check -u","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"~1"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.10.1-alpha.11+e79c6d4","@jest/globals":"^27.5.1","@microsoft/api-extractor":"^7.22.1","@reduxjs/toolkit":"^1.8.1","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^5.19.0","@typescript-eslint/parser":"^5.19.0","eslint-plugin-tsdoc":"^0.2.16","tsdx":"^0.14.1"},"dependencies":{"lodash.merge":"^4.6.2","tslib":"^2.3.1"},"keywords":["redux","react","starter","toolkit","reducer","slice","state","immer","immutable","predictable","functional","action","selector","factory","shape","model","entity","createSlice","createModelSlice","createEntitySlice","redux-toolkit","redux-slice-factory"],"gitHead":"e79c6d4192db7052d9486667f194e8a101a7af6b","readme":"# `redux-slice-factory` 🍕🏭\r\n\r\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\r\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\r\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\r\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\r\n\r\n> A light-weight package with generic factory functions for common slice data structures\r\n\r\n## Install 💾\r\n```shell\r\nnpm install @gjv/redux-slice-factory\r\n```\r\n\r\n## What's the goal? 🏆\r\nThis package will\r\n- reduce boilerplate\r\n- prevent duplicate code\r\n- save you time & effort\r\n\r\nby providing\r\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\r\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\r\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\r\n- a common set of actions and selectors shared by slices of the same data structure\r\n\r\n## What's included? 📦\r\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\r\nHere's an [example](https://github.com/gregjoeval/package-library/blob/master/packages/redux-slice-factory/docs/CreateModelSlice.md) with a slice for a user profile.\r\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\r\nHere's an [example](https://github.com/gregjoeval/package-library/blob/master/packages/redux-slice-factory/docs/CreateEntitySlice.md) with a slice for multiple user profiles.\r\n\r\n## What's a slice? 🍕\r\nSimilar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\r\n\r\nthe `name` describes the domain the slice is responsible for, \r\n\r\nthe `reducer` manages data interactions between state and actions,\r\n\r\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\r\n \r\nthe `selectors` expose memoized functions to read data from global state.\r\n\r\n#### Where are the `action types`?\r\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\r\n\r\n```typescript\r\nconst { actions } = createModelSlice('MyModelSliceName', ...)\r\nconsole.log(`${actions.update}`)\r\n// -> \"MyModelSliceName/update\r\n```\r\n\r\n## Show me the code 💻\r\nFor a more extensive, real-world use cases check out the [examples](#What's-included?) listed above.\r\n\r\n```typescript\r\n//\r\n// STEP 1: create the slice\r\n// UserSlice.ts\r\n//\r\nimport { createModelSlice, IModelState, StatusEnum } from '@gjv/redux-slice-factory';\r\nimport { IGlobalState } from './configureStore';\r\n\r\ninterface IUserModel {\r\n    id: string;\r\n    name: string;\r\n    age: string;\r\n}\r\n\r\nconst bob: IUserModel = {\r\n    id: '456def',\r\n    name: 'bobby',\r\n    age: '30'\r\n};\r\n\r\ntype IUserSliceState = IModelState<IUserModel>\r\n\r\nconst slice = createModelSlice<IGlobalState, IUserModel>({\r\n    name: 'user',\r\n    selectSliceState: (globalState) => globalState.User,\r\n    initialState: bob\r\n});\r\n\r\nconst UserSlice = {\r\n    name: slice.name,\r\n    reducer: slice.reducer,\r\n    actions: slice.actions,\r\n    selectors: slice.selectors\r\n};\r\n\r\nexport default UserSlice;\r\nexport type { IUserSliceState }\r\n\r\n//\r\n// STEP 2: attach the slice to the global store\r\n// configureStore.ts\r\n//\r\nimport { configureStore } from '@reduxjs/toolkit'\r\nimport UserSlice, { IUserSliceState } from './UserSlice'\r\n\r\ninterface IGlobalState {\r\n  user: IUserSliceState;\r\n}\r\n\r\nconst reducers = {\r\n    user: UserSlice.reducer\r\n};\r\n\r\nconst store = rtkConfigureStore({\r\n  reducer: reducers,\r\n  middleware: (getDefaultMiddleware) => getDefaultMiddleware(),\r\n});\r\n\r\nexport default store;\r\nexport type { IGlobalState };\r\n\r\n//\r\n// STEP 3: use the slice\r\n//\r\n\r\n// initial state of state.user\r\n/**\r\n{\r\n  \"status\": \"Settled\",\r\n  \"error\": null,\r\n  \"lastModified\": null,\r\n  \"lastHydrated\": null,\r\n  \"model\": {\r\n    \"id\": \"456def\",\r\n    \"name\": \"bobby\",\r\n    \"age\": \"30\"\r\n  }\r\n}\r\n**/\r\n\r\n// update the slice state with a partial model\r\nstore.dispatch(userSlice.actions.update({ age: '26' }));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\r\n  \"model\": {\r\n    \"id\": \"456def\",\r\n    \"name\": \"bobby\",\r\n    \"age\": \"26\"\r\n  }\r\n}\r\n**/\r\n\r\n// set the slice state with a model\r\nstore.dispatch(userSlice.actions.set({\r\n    id: '456def',\r\n    name: 'bob',\r\n    age: '30'\r\n}));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\r\n  \"model\": {\r\n    \"id\": \"456def\",\r\n    \"name\": \"bob\",\r\n    \"age\": \"30\"\r\n  }\r\n}\r\n**/\r\n\r\n// set the slice state status enum\r\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\r\n// or\r\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"status\": \"Requesting\",\r\n}\r\n**/\r\n\r\n// hydrate the slice state with a model\r\nstore.dispatch(userSlice.actions.hydrate({\r\n    id: '789ghi',\r\n    name: 'carl',\r\n    age: '35'\r\n}));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"lastModified\": null,\r\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\r\n  \"model\": {\r\n    \"id\": \"789ghi\",\r\n    \"name\": \"carl\",\r\n    \"age\": \"35\"\r\n  }\r\n}\r\n**/\r\n\r\n// set the slice state error\r\n// NOTE: the Error is mapped to a serialize-able object by the action creator\r\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"error\": {\r\n    \"stack\": 'Error: Uh-oh\\n ...',\r\n    \"message\": 'Uh-oh'\r\n  },\r\n}\r\n**/\r\n\r\n// reset the slice state back to its initial state\r\nstore.dispatch(userSlice.actions.reset());\r\n// state.user is now...\r\n/**\r\n{\r\n  \"status\": \"Settled\",\r\n  \"error\": null,\r\n  \"lastModified\": null,\r\n  \"lastHydrated\": null,\r\n  \"model\": {\r\n    \"id\": \"456def\",\r\n    \"name\": \"bobby\",\r\n    \"age\": \"30\"\r\n  }\r\n}\r\n**/\r\n```\r\n","readmeFilename":"README.md","_id":"@gjv/redux-slice-factory@0.10.1-alpha.11","_nodeVersion":"17.3.1","_npmVersion":"lerna/4.0.0/node@v17.3.1+x64 (win32)","dist":{"integrity":"sha512-IBKLo4br9IHovxMh1+t60O10aQHa5uyD52e600lhQJXPdAyUodeb3iwEqbjh37acYlVikxjASi3UPwo0mmN/Ag==","shasum":"55cf0493c0c769451aa5e80f49a7eb497891c834","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.10.1-alpha.11.tgz","fileCount":29,"unpackedSize":228071,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDrWFxB17h9TMcnxN00PoVaP2AZjEQqYiVoUy5T12zIHAiEAtcEanWlO4uDijZPi5cugryzQ5+cd7FSTLsqmfnEqcA0="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiV4ylACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq7zhAAk7yvHmu4kxntw4Ft2QAWj+gpFSVvLPBulx2appcknIqgp0Tk\r\nMj1WLVPwvduawd7qkTuMfgxLHur4EqTrYNRGlHUfk9rKA0dDCnfJqmM/6TTR\r\nWHB+aq0Qtn2z4uLnwpG9cefys3NOq1DFht+3wzaAiJhfcgZYhhnmUFkX7HPz\r\nBllhai07gJe4Sobe1H/N/fUYDWNwvcch5tiBeJHBFw1GS1f1wagcJ74b+hoq\r\nJESsBx7Qjd7LdmiPohis3uU8pMP6nx3yu+xpqzriQrwbc+U1ak5gjmgfAPHF\r\nL7412wy+iPEk43Uhgo2aCGTO5KkSV/7SAH80roTOd3KK8rcmbMZkM5JHlVLR\r\njqQrbaY2cIuf9fBqwEbzXrz5msbec7P20ih9469ZOcbrAzWsbkqigRYDz9FY\r\nDZQ8PvIjZU7fO4P61ZgtuoZ5QJW0OCTXBZW/z0wipRYBhAv/V7rGuMkUN/n8\r\nBHGaJPkqP7QjpIXtKC3YD4prHWQMMRxFyjsf5O3VLPn6vOTiq5Esja5/vb7W\r\nm/vGIC6Oni9Yl0AtHNSrTX9cNgjCeaQS1opZ5EmPYH9ysUdjBQ/kZ+rNUpGp\r\nS1VFyVy+M+n6uypYZB5mNtRoGxYh5jg1UGeXHy89WTfqyACnAfq7sjK/OeVD\r\n8HM37G7/vRxFLIF911qjyoJJCSz6RPTBe94=\r\n=I0zU\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.10.1-alpha.11_1649904805494_0.24885196923606823"},"_hasShrinkwrap":false},"0.10.3":{"name":"@gjv/redux-slice-factory","version":"0.10.3","description":"Generic factory functions for common slice data structures","author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"homepage":"https://github.com/gregjoeval/package-library#readme","license":"MIT","main":"dist/index.js","types":"dist/redux-slice-factory.d.ts","typings":"dist/redux-slice-factory.d.ts","module":"dist/redux-slice-factory.esm.js","sideEffects":false,"scripts":{"setup:install":"npm install","setup:clean-install":"npm ci","setup:update":"npx npm-check -u","setup:clean":"rimraf ./node_modules","build":"tsdx build --format cjs,esm --name redux-slice-factory && api-extractor run","build:clean":"rimraf ./dist && rimraf ./temp","lint":"eslint ./src --ext .js,.jsx,.ts,.tsx  --max-warnings 0","lint:fix":"npm run lint -- --fix","lint:config":"eslint --print-config ./src/index.ts","typecheck":"npm run build && npm run build:clean","test":"tsdx test ./src --runInBand --watchAll=false","check":"npm run lint && npm run typecheck && npm run test","prepublishOnly":"npm run build"},"publishConfig":{"access":"public"},"directories":{"lib":"src"},"repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"peerDependencies":{"@reduxjs/toolkit":"~1"},"devDependencies":{"@gjv/eslint-config-typescript":"^0.10.3","@jest/globals":"^27.5.1","@microsoft/api-extractor":"^7.22.1","@reduxjs/toolkit":"^1.8.1","@types/lodash.merge":"^4.6.6","@typescript-eslint/eslint-plugin":"^5.19.0","@typescript-eslint/parser":"^5.19.0","eslint-plugin-tsdoc":"^0.2.16","tsdx":"^0.14.1"},"dependencies":{"lodash.merge":"^4.6.2","tslib":"^2.3.1"},"keywords":["redux","react","starter","toolkit","reducer","slice","state","immer","immutable","predictable","functional","action","selector","factory","shape","model","entity","createSlice","createModelSlice","createEntitySlice","redux-toolkit","redux-slice-factory"],"gitHead":"03e8c49fbaff054e4e8fefd8ced12e28876cd3aa","_id":"@gjv/redux-slice-factory@0.10.3","_nodeVersion":"17.3.1","_npmVersion":"lerna/4.0.0/node@v17.3.1+x64 (win32)","dist":{"integrity":"sha512-d2gWqG7RwzT2xW7+lIamkQwJMurQAAkLrinz+AugQMWhz20E8YPvmDAr89dWIkvfl7vG28jcAPE+FskuScYnmw==","shasum":"9f4384728648c5cee989632d6a9bf4b690559f37","tarball":"https://registry.npmjs.org/@gjv/redux-slice-factory/-/redux-slice-factory-0.10.3.tgz","fileCount":29,"unpackedSize":228037,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCkHbW0R5mR2rt/ivUlpIH0wds37dyfOUSAgcH/IPlylgIgcmmEBMHrIQanItxkSEbFWdI0gE11gu9TNFAqTN6uSwk="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiV43PACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoi+Q//V/Ekw2akvpofFnS7JytG7RiG/pIXNRJJUW2rlFBn7SKxlhaL\r\n2Vr+46/7HrM/loFmG+/ase4RnvUirHIWg8l9PqOTj5YXBb7+Yqezyv3HfR91\r\n7oGrT4wD0t86CEeVda2pVpFvN1oqn6rDVyjEehFrJJrXBQecKKZDlN0eOSca\r\n+OOiCIAifSGu1dRp9pQXBV3dRInCLmSxEJESBxwlvMbCGCo77GXOWmQBgP7u\r\nh0MlCpUpYnojO3o3XApgmJXxJPPABMZSEfY19vfF5C1n0C8kN0wCKNQf3kv1\r\nKGKte6AvqEO60h/o0j+LCfdFyZIq38RlQ46fBo9r1KaDEh92TKhZXGXNmNdx\r\nDCg6d/IcMAteRS6HMiveJuUmMtSa7uSE/9kUhHwZ9SvnHJcc2ZOfeaAq2Ysz\r\nXJDz0gz11bqImaqIMxCp1pjg51VQ0pD2EttkyJYmtcouSL9ZzIDYWmlQ99AD\r\n4gQetWZ/HeqBtdXII8M0EjSNHAJeW8WjlT0dROQ3WTgthM4+5pXzt4wP7IkG\r\nqJ+1RaCk29uMRWqv/mJ6hqWhRKlkM6eJpcIRmk4NKauI7heuFQ6Xo16sTGxg\r\nqD4WYnSuO6aVL1tDEX/ucUb9hr9Qo3eNrgwYIJ2beiRbq37KRwLGyxLxGiFe\r\nXcd23uvu5QKXlESXhLQB+LH/PYivqBcBW9I=\r\n=7gec\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"gregjoeval","email":"gregjoeval@gmail.com"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-slice-factory_0.10.3_1649905103131_0.1939059665790377"},"_hasShrinkwrap":false}},"time":{"created":"2020-07-10T02:07:19.525Z","0.2.1-alpha.13":"2020-07-10T02:07:19.955Z","modified":"2022-04-14T02:58:23.371Z","0.2.1-alpha.15":"2020-07-10T16:26:13.517Z","0.2.1":"2020-07-10T16:29:56.181Z","0.3.0":"2020-07-10T17:21:32.899Z","0.2.1-alpha.17":"2020-07-10T17:24:36.213Z","0.3.2":"2020-07-10T18:15:16.180Z","0.2.1-alpha.19":"2020-07-10T18:20:58.505Z","0.2.1-alpha.20":"2020-07-11T02:11:08.446Z","0.3.3":"2020-07-11T02:11:14.296Z","0.2.1-alpha.22":"2020-07-11T02:14:22.375Z","0.4.0":"2020-07-12T03:40:46.479Z","0.2.1-alpha.26":"2020-07-12T03:47:10.866Z","0.2.1-alpha.27":"2020-07-12T05:16:43.773Z","0.4.1":"2020-07-12T17:11:31.534Z","0.4.2-alpha.0":"2020-07-12T17:14:23.645Z","0.4.2":"2020-07-15T17:00:35.224Z","0.4.2-alpha.1":"2020-07-15T17:03:04.880Z","0.4.2-alpha.3":"2020-07-15T17:11:50.168Z","0.4.2-alpha.4":"2020-07-16T17:00:29.530Z","0.4.2-alpha.5":"2020-07-20T03:07:53.744Z","0.4.2-alpha.7":"2020-07-29T04:25:41.994Z","0.4.2-alpha.8":"2020-07-29T04:44:02.196Z","0.4.2-alpha.11":"2020-07-29T04:51:07.506Z","0.5.0":"2020-07-29T04:55:08.251Z","0.4.2-alpha.15":"2020-07-29T05:00:05.934Z","0.4.2-alpha.17":"2020-07-30T03:17:42.704Z","0.4.2-alpha.18":"2020-07-30T05:02:43.357Z","0.5.1":"2020-07-30T05:05:04.641Z","0.4.2-alpha.19":"2020-07-30T05:05:26.961Z","0.5.2-alpha.0":"2020-07-30T05:10:23.173Z","0.5.2-alpha.1":"2020-08-02T20:24:03.604Z","0.5.2":"2020-08-02T20:25:15.900Z","0.5.3-alpha.0":"2020-08-02T20:29:47.536Z","0.5.3":"2020-08-03T00:22:16.916Z","0.5.6-alpha.0":"2020-08-04T02:28:40.128Z","0.5.6-alpha.1":"2020-08-17T18:56:44.355Z","0.5.6-alpha.3":"2020-08-25T03:41:44.221Z","0.5.6-alpha.4":"2020-08-25T03:49:51.933Z","0.5.6-alpha.6":"2020-08-25T03:50:00.058Z","0.5.6-alpha.8":"2020-08-25T04:00:57.652Z","0.5.6-alpha.9":"2020-08-25T04:04:20.033Z","0.5.6-alpha.10":"2020-08-25T04:06:56.097Z","0.5.6":"2020-08-25T04:12:38.923Z","0.5.7-alpha.0":"2020-08-25T04:20:03.836Z","0.5.7-alpha.2":"2020-10-14T21:45:15.828Z","0.5.8":"2020-10-14T21:51:56.329Z","0.5.9-alpha.7":"2020-10-22T04:36:00.043Z","0.5.9-alpha.8":"2020-10-24T19:57:03.390Z","0.5.9":"2020-10-24T20:00:52.169Z","0.5.10":"2020-10-24T20:10:21.137Z","0.6.0":"2021-02-02T02:48:48.336Z","0.6.1":"2021-02-27T17:25:44.693Z","0.6.2":"2021-02-27T19:27:49.049Z","0.6.3-alpha.6":"2021-04-06T03:27:06.797Z","0.6.3-alpha.9":"2021-04-06T03:27:26.187Z","0.6.3-alpha.10":"2021-04-06T03:31:22.155Z","0.6.3-alpha.14":"2021-04-06T03:33:46.438Z","0.6.3-alpha.15":"2021-04-06T03:59:02.817Z","0.6.3-alpha.16":"2021-04-06T04:47:11.496Z","0.7.2":"2021-04-06T05:46:18.010Z","0.7.2-alpha.0":"2021-04-06T05:47:56.081Z","0.7.3":"2021-04-06T05:51:12.785Z","0.7.4":"2021-04-07T19:21:05.252Z","0.8.0":"2021-06-24T04:22:07.690Z","0.8.1":"2021-06-24T04:58:21.033Z","0.9.0":"2021-10-07T03:21:58.390Z","0.9.1":"2021-10-07T03:31:07.444Z","0.9.2":"2021-10-18T13:43:43.432Z","0.10.0-alpha.8":"2022-02-02T06:47:22.418Z","0.10.0":"2022-02-02T06:57:01.520Z","0.10.1-alpha.10":"2022-04-14T02:52:43.054Z","0.10.1-alpha.11":"2022-04-14T02:53:25.625Z","0.10.3":"2022-04-14T02:58:23.278Z"},"maintainers":[{"name":"gregjoeval","email":"gregjoeval@gmail.com"}],"description":"Generic factory functions for common slice data structures","homepage":"https://github.com/gregjoeval/package-library#readme","repository":{"type":"git","url":"git+https://github.com/gregjoeval/package-library.git"},"author":{"name":"Greg Valentine","email":"gregjoeval@gmail.com"},"bugs":{"url":"https://github.com/gregjoeval/package-library/issues"},"license":"MIT","readme":"# `redux-slice-factory` 🍕🏭\r\n\r\n[![npm version](https://badgen.net/npm/v/@gjv/redux-slice-factory)](https://www.npmjs.com/package/@gjv/redux-slice-factory)\r\n[![types](https://badgen.net/npm/types/@gjv/redux-slice-factory)](https://badgen.net/npm/types/@gjv/redux-slice-factory)\r\n[![install size](https://badgen.net/packagephobia/install/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\r\n[![publish size](https://badgen.net/packagephobia/publish/@gjv/redux-slice-factory)](https://packagephobia.com/result?p=%40gjv%2Fredux-slice-factory)\r\n\r\n> A light-weight package with generic factory functions for common slice data structures\r\n\r\n## Install 💾\r\n```shell\r\nnpm install @gjv/redux-slice-factory\r\n```\r\n\r\n## What's the goal? 🏆\r\nThis package will\r\n- reduce boilerplate\r\n- prevent duplicate code\r\n- save you time & effort\r\n\r\nby providing\r\n- a familiar API inspired by [Redux Toolkit](https://redux-toolkit.js.org/)\r\n- out-of-the-box best-practice interfaces for slice state models (e.g. [status enums vs boolean flags](https://kentcdodds.com/blog/stop-using-isloading-booleans))\r\n- [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself), strongly-typed, generic factory functions for common slice data structures\r\n- a common set of actions and selectors shared by slices of the same data structure\r\n\r\n## What's included? 📦\r\n- `createModelSlice()` creates a slice for a <b>single model</b>. <br>\r\nHere's an [example](https://github.com/gregjoeval/package-library/blob/master/packages/redux-slice-factory/docs/CreateModelSlice.md) with a slice for a user profile.\r\n- `createEntitySlice()` creates a slice for a <b>collection of entities</b>. <br>\r\nHere's an [example](https://github.com/gregjoeval/package-library/blob/master/packages/redux-slice-factory/docs/CreateEntitySlice.md) with a slice for multiple user profiles.\r\n\r\n## What's a slice? 🍕\r\nSimilar to the [Ducks](https://github.com/erikras/ducks-modular-redux) and [Ducks++](https://github.com/dhassaine/ducks-modular-redux) proposals, a slice is a bundle of everything associated to a piece of state (i.e. `{ name, reducer, actions, selectors }`)\r\n\r\nthe `name` describes the domain the slice is responsible for, \r\n\r\nthe `reducer` manages data interactions between state and actions,\r\n\r\nthe `actions` surface an api of dispatch-able functions to interact with the reducer, and\r\n \r\nthe `selectors` expose memoized functions to read data from global state.\r\n\r\n#### Where are the `action types`?\r\nSince these factory functions use `createSlice()` from [Redux Toolkit](https://redux-toolkit.js.org/), you can get the action type for any action creator by simply referencing the function without executing it:\r\n\r\n```typescript\r\nconst { actions } = createModelSlice('MyModelSliceName', ...)\r\nconsole.log(`${actions.update}`)\r\n// -> \"MyModelSliceName/update\r\n```\r\n\r\n## Show me the code 💻\r\nFor a more extensive, real-world use cases check out the [examples](#What's-included?) listed above.\r\n\r\n```typescript\r\n//\r\n// STEP 1: create the slice\r\n// UserSlice.ts\r\n//\r\nimport { createModelSlice, IModelState, StatusEnum } from '@gjv/redux-slice-factory';\r\nimport { IGlobalState } from './configureStore';\r\n\r\ninterface IUserModel {\r\n    id: string;\r\n    name: string;\r\n    age: string;\r\n}\r\n\r\nconst bob: IUserModel = {\r\n    id: '456def',\r\n    name: 'bobby',\r\n    age: '30'\r\n};\r\n\r\ntype IUserSliceState = IModelState<IUserModel>\r\n\r\nconst slice = createModelSlice<IGlobalState, IUserModel>({\r\n    name: 'user',\r\n    selectSliceState: (globalState) => globalState.User,\r\n    initialState: bob\r\n});\r\n\r\nconst UserSlice = {\r\n    name: slice.name,\r\n    reducer: slice.reducer,\r\n    actions: slice.actions,\r\n    selectors: slice.selectors\r\n};\r\n\r\nexport default UserSlice;\r\nexport type { IUserSliceState }\r\n\r\n//\r\n// STEP 2: attach the slice to the global store\r\n// configureStore.ts\r\n//\r\nimport { configureStore } from '@reduxjs/toolkit'\r\nimport UserSlice, { IUserSliceState } from './UserSlice'\r\n\r\ninterface IGlobalState {\r\n  user: IUserSliceState;\r\n}\r\n\r\nconst reducers = {\r\n    user: UserSlice.reducer\r\n};\r\n\r\nconst store = rtkConfigureStore({\r\n  reducer: reducers,\r\n  middleware: (getDefaultMiddleware) => getDefaultMiddleware(),\r\n});\r\n\r\nexport default store;\r\nexport type { IGlobalState };\r\n\r\n//\r\n// STEP 3: use the slice\r\n//\r\n\r\n// initial state of state.user\r\n/**\r\n{\r\n  \"status\": \"Settled\",\r\n  \"error\": null,\r\n  \"lastModified\": null,\r\n  \"lastHydrated\": null,\r\n  \"model\": {\r\n    \"id\": \"456def\",\r\n    \"name\": \"bobby\",\r\n    \"age\": \"30\"\r\n  }\r\n}\r\n**/\r\n\r\n// update the slice state with a partial model\r\nstore.dispatch(userSlice.actions.update({ age: '26' }));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"lastModified\": \"2020-07-08T19:34:24-04:00\",\r\n  \"model\": {\r\n    \"id\": \"456def\",\r\n    \"name\": \"bobby\",\r\n    \"age\": \"26\"\r\n  }\r\n}\r\n**/\r\n\r\n// set the slice state with a model\r\nstore.dispatch(userSlice.actions.set({\r\n    id: '456def',\r\n    name: 'bob',\r\n    age: '30'\r\n}));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"lastModified\": \"2020-07-08T19:35:23-04:00\",\r\n  \"model\": {\r\n    \"id\": \"456def\",\r\n    \"name\": \"bob\",\r\n    \"age\": \"30\"\r\n  }\r\n}\r\n**/\r\n\r\n// set the slice state status enum\r\nstore.dispatch(userSlice.actions.setStatus(StatusEnum.Requesting));\r\n// or\r\nstore.dispatch(userSlice.actions.setStatus('Requesting'));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"status\": \"Requesting\",\r\n}\r\n**/\r\n\r\n// hydrate the slice state with a model\r\nstore.dispatch(userSlice.actions.hydrate({\r\n    id: '789ghi',\r\n    name: 'carl',\r\n    age: '35'\r\n}));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"lastModified\": null,\r\n  \"lastHydrated\": \"2020-07-08T19:37:37-04:00\",\r\n  \"model\": {\r\n    \"id\": \"789ghi\",\r\n    \"name\": \"carl\",\r\n    \"age\": \"35\"\r\n  }\r\n}\r\n**/\r\n\r\n// set the slice state error\r\n// NOTE: the Error is mapped to a serialize-able object by the action creator\r\nstore.dispatch(userSlice.actions.setError(new Error('Uh-oh')));\r\n// state.user is now...\r\n/**\r\n{\r\n  ...\r\n  \"error\": {\r\n    \"stack\": 'Error: Uh-oh\\n ...',\r\n    \"message\": 'Uh-oh'\r\n  },\r\n}\r\n**/\r\n\r\n// reset the slice state back to its initial state\r\nstore.dispatch(userSlice.actions.reset());\r\n// state.user is now...\r\n/**\r\n{\r\n  \"status\": \"Settled\",\r\n  \"error\": null,\r\n  \"lastModified\": null,\r\n  \"lastHydrated\": null,\r\n  \"model\": {\r\n    \"id\": \"456def\",\r\n    \"name\": \"bobby\",\r\n    \"age\": \"30\"\r\n  }\r\n}\r\n**/\r\n```\r\n","readmeFilename":"README.md","keywords":["redux","react","starter","toolkit","reducer","slice","state","immer","immutable","predictable","functional","action","selector","factory","shape","model","entity","createSlice","createModelSlice","createEntitySlice","redux-toolkit","redux-slice-factory"]}