{"_id":"@claire-cleany/redux-offline","_rev":"1-cad45dcf86ac6980d4be4f0906018004","name":"@claire-cleany/redux-offline","dist-tags":{"latest":"2.5.1"},"versions":{"2.5.1":{"name":"@claire-cleany/redux-offline","version":"2.5.1","description":"Redux Offline-First Architecture","main":"lib/index.js","types":"./typings.d.ts","scripts":{"build":"babel src --out-dir lib --ignore '**/__tests__/**'","flow:start":"flow server","flow:stop":"flow stop","flow":"flow; test $? -eq 0 -o $? -eq 2","lint":"eslint src/","prepublishOnly":"npm run lint && npm run flow && npm run test && npm run build","prettier":"eslint src --fix","test":"jest","test:watch":"jest --watch","watch":"npm run build -- --watch"},"jest":{"rootDir":"src"},"repository":{"type":"git","url":"git+https://github.com/redux-offline/redux-offline.git"},"author":"","license":"MIT","bugs":{"url":"https://github.com/redux-offline/redux-offline/issues"},"homepage":"https://github.com/redux-offline/redux-offline#readme","devDependencies":{"@babel/cli":"^7.1.2","@babel/core":"^7.1.2","babel-core":"^7.0.0-bridge.0","babel-eslint":"^10.0.1","babel-jest":"^23.6.0","@babel/plugin-syntax-object-rest-spread":"^7.0.0","@babel/plugin-proposal-class-properties":"^7.1.0","@babel/plugin-transform-flow-strip-types":"^7.0.0","@babel/plugin-transform-runtime":"^7.1.0","@babel/preset-env":"^7.1.0","eslint":"^5.8.0","eslint-config-airbnb-base":"^13.1.0","eslint-config-prettier":"^3.1.0","eslint-plugin-babel":"^5.2.1","eslint-plugin-import":"^2.14.0","eslint-plugin-prettier":"^3.0.0","eslint-plugin-flowtype":"^3.1.1","flow-bin":"^0.84.0","jest":"^23.6.0","prettier":"^1.14.3","redux":"^4.0.1","redux-devtools-instrument":"^1.9.0","redux-logger":"^3.0.6","redux-persist-node-storage":"^1.0.2","release":"^4.0.2"},"dependencies":{"@babel/runtime":"^7.1.2","redux-persist":"^4.6.0"},"peerDependencies":{"redux":">=3"},"gitHead":"4a3db023f1f2d6be0de5939dcbaccbdc09aff537","_id":"@claire-cleany/redux-offline@2.5.1","_npmVersion":"5.6.0","_nodeVersion":"10.1.0","_npmUser":{"name":"claire-cleany","email":"claire@cleany.fr"},"dist":{"integrity":"sha512-wfpx+v2Fp7CYOhBUtUhZ4B4iXiqfnz+nqfOUrfqn++camR7Y0CAxOOXZEVVMqIxIEq2Hb4gLRtXBhB5b/P7+hQ==","shasum":"7a71a14d1a4bc3e25419cb4cc6aaa8ae92026fd5","tarball":"https://registry.npmjs.org/@claire-cleany/redux-offline/-/redux-offline-2.5.1.tgz","fileCount":78,"unpackedSize":424518,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdMXWmCRA9TVsSAnZWagAAJhcP/iEaW4W1T8AlgUbb0b0l\nHS78nvcz6Whf9PwHHUYQjbdBN/TSuVgkysvL0I+YrL/+2mWfYptOM75A0KaF\nYVuf2++AwEm5bEesnM11MP4JtPhbzL7thRXBA1A+abj6myok2WDa57FciEnD\naIpYxww5CtgU/+GCeTsfCzy7LoUlpbYIagLNvLFsxr5JeQKTRj5MRIhw8pKL\neG2fSlDok76s3iq5OXuUXN/vGLmNcGdv9e1wcqAmWtWj2j4ohOHwfSqBx5KZ\nYhAWsif7vOVIfxfgWU4JRr7EL1ZmWQgaMWPgoZx6qjErY2Be9r19Q55F5Lny\nnV/KWHmZzCrO3y4Dd2/e5P/vfQEVlkHFj5ktbq+KAGW2uSovG/spHtTcgwm6\nYNqsYdkgMhkCj9hasWBzGda6pWUkiYlabtSqi98YvPzPr6ubQagXi8EszVa1\n2r4YElutAnEDPRniOkVL+YZ/6pruOUB83C/MetffZaYrR3EMI7VzvkyVJD55\nwcKhS8H/rTMJCxeaa+camNfgUz2tnzr037RnFRDe0sFuvk1ltV8oaHPJh+10\nUU0F6l0VUhQDQNapGFFwOQHJgLcokq4FWApmjtVEgiry/umO/FCyezfpEown\ns7rZePrNZTYzBi1YPZitN6k3s/DV8gQWlXHktAWqJhS7PJ5v6U0xwH2TaNXF\nE694\r\n=AfyA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCz6FQWks9Ji8kkf6mrC2y/sKDbm9/Ok4sSzng4X0KdsAIhAKjzxicQ3bo8Vfo8yTJnOY49d0Mnrr3Ak6iAmtzCcj10"}]},"maintainers":[{"name":"claire-cleany","email":"claire@cleany.fr"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redux-offline_2.5.1_1563522470243_0.6386705423269334"},"_hasShrinkwrap":false}},"time":{"created":"2019-07-19T07:47:50.027Z","2.5.1":"2019-07-19T07:47:50.365Z","modified":"2022-04-04T23:11:56.068Z"},"maintainers":[{"name":"claire-cleany","email":"claire@cleany.fr"}],"description":"Redux Offline-First Architecture","homepage":"https://github.com/redux-offline/redux-offline#readme","repository":{"type":"git","url":"git+https://github.com/redux-offline/redux-offline.git"},"bugs":{"url":"https://github.com/redux-offline/redux-offline/issues"},"license":"MIT","readme":"<p>\n  <img alt=\"redux-offline\" src=\"docs/logo.png\" width=\"300\"></img>\n</p>\n<p>\n  <a title='License' href=\"https://raw.githubusercontent.com/redux-offline/redux-offline/master/LICENSE\" height=\"18\">\n    <img src='https://img.shields.io/badge/license-MIT-blue.svg' />\n  </a>\n  <a href=\"https://badge.fury.io/js/%40redux-offline%2Fredux-offline\">\n    <img src=\"https://badge.fury.io/js/%40redux-offline%2Fredux-offline.svg\" alt=\"npm version\" height=\"18\">\n  </a>\n  <a href=\"https://travis-ci.org/redux-offline/redux-offline\">\n    <img src=\"https://travis-ci.org/redux-offline/redux-offline.svg?branch=master\" alt=\"travis\" height=\"18\">\n  </a>\n</p>\n\nPersistent Redux store for _Reasonaboutable_:tm: Offline-First applications, with first-class support for optimistic UI. Use with React, React Native, or as standalone state container for any web app.\n\n> Redux Offline is now being maintained by a community driven team. The new versions of the library will now be available under the npm organization `@redux-offline`. Big thank you to [@jevakallio](https://github.com/jevakallio) for creating this amazing library in the first place.\n\n## Quick start\n\n##### 1. Install with npm (or [Yarn](https://yarnpkg.com))\n```shell\nnpm install --save @redux-offline/redux-offline\n```\n\n##### 2. Add the `offline` [store enhancer](http://redux.js.org/docs/Glossary.html#store-enhancer) with `compose`\n```js\n\nimport { applyMiddleware, createStore, compose } from 'redux';\nimport { offline } from '@redux-offline/redux-offline';\nimport offlineConfig from '@redux-offline/redux-offline/lib/defaults';\n\n// ...\n\nconst store = createStore(\n  reducer,\n  preloadedState,\n  compose(\n    applyMiddleware(middleware),\n    offline(offlineConfig)\n  )\n);\n```\n\n##### 3. Decorate actions with offline metadata\n\n```js\nconst followUser = userId => ({\n  type: 'FOLLOW_USER_REQUEST',\n  payload: { userId },\n  meta: {\n    offline: {\n      // the network action to execute:\n      effect: { url: '/api/follow', method: 'POST', json: { userId } },\n      // action to dispatch when effect succeeds:\n      commit: { type: 'FOLLOW_USER_COMMIT', meta: { userId } },\n      // action to dispatch if network action fails permanently:\n      rollback: { type: 'FOLLOW_USER_ROLLBACK', meta: { userId } }\n    }\n  }\n});\n```\n\nIf the effect payload is something other than JSON you can pass the body and headers:\n\n```js\nconst followUser = userId => ({\n  type: 'REGISTER_USER',\n  payload: { name, email },\n  meta: {\n    offline: {\n      // the network action to execute:\n      effect: { url: '/api/register', method: 'POST', body: `name=${name}&email=${email}`, headers: { 'content-type': 'application/x-www-form-urlencoded' } },\n      // action to dispatch when effect succeeds:\n      commit: { type: 'REGISTER_USER_COMMIT', meta: { name, email } },\n      // action to dispatch if network action fails permanently:\n      rollback: { type: 'REGISTER_USER_ROLLBACK', meta: { name, email } }\n    }\n  }\n});\n```\n\n##### 4. (React Native Android) Ask permission to read network status\n\nIf writing a native app for Android, you'll need to make sure to request the permission to access network state in your `AndroidManifest.xml`:\n\n```xml\n  <uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" />\n```\n* * *\n\nSee [Documentation](docs/README.md) for configuration options, the full API, and common recipes.\n\n## Contributing\n\nImprovements and additions welcome. For large changes, please submit a discussion issue before jumping to coding; we'd hate you to waste the effort.\n\nIf you are reporting a bug, please include code that reproduces the error. Here is a starting application on [CodeSandbox](https://codesandbox.io/s/8xml9l1r0j).\n\nIn lieu of a formal style guide, follow the included eslint rules, and use Prettier to format your code.\n\n## Miscellanea\n\n### Usage with Redux Persist v5\n\nIn case you want to use a custom [redux-persist](https://github.com/rt2zz/redux-persist) version, there is an\n[example](https://gist.github.com/jarvisluong/f14872b9c7ed00bc2afc89c4622e3b55) configuration.\n\n### Prior art\n\nRedux Offline is a distillation of patterns discovered while building apps using previously existing libraries:\n\n* Forbes Lindesay's [redux-optimist](https://github.com/ForbesLindesay/redux-optimist)\n* Zack Story's [redux-persist](https://github.com/rt2zz/redux-persist/tree/v4)\n\nWithout their work, Redux Offline wouldn't exist. If you like the ideas behind Redux Offline, but want to build your own stack from lower-level components, these are good places to start.\n\n### License\n\nMIT\n","readmeFilename":"README.md"}