{"bugs":{"url":"https://github.com/sanity-io/sanity/issues"},"dist":{"shasum":"b50682881048613a8ff34434a5de1cddc13ae2cd","tarball":"https://registry.npmjs.org/@sanity/document-store/-/document-store-0.140.10-alpha.80.tgz","fileCount":21,"integrity":"sha512-uOQ8TztzePmipHmqQ5KUw0XQcTiuwUXECF8Xdg3cqGoEA99HLbzrHHPWAaE2peJjlDAiQOAjuAA08J8SF8G/lw==","signatures":[{"sig":"MEUCIQD/dKyHxKfJdFGoyH6koEqr73qSv/sONOT0ovExV/pRpwIgNGFsFb9UJtr+daiEqp8dghpwjEvAOYl4ZeT4Ns6OVlY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":32199,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJch47ICRA9TVsSAnZWagAA6nQP/34u3tNkcDzCy0fKlH4P\ntk0XQNgX7U//Jf8bJ1s0blv8KKqHIOURufi+/KKOJnQTIOfc3zr1N2AEecK0\nRy+pLQG59m0u5dUk+7hf2R93K4pIbMbJ5R6jhH4WNqFs4eWykamQE6pFnYn6\n95XvcQ0iRr/XbwXcr3IRZOknAGomkcqWIOilrYtFig6ce1CWsRSVzTEaGBTQ\nSYfwBve/LReZoEz/APKRK/5PUxlF6kCvg1Rr7TT1uu3MQh9tik31tC107hVQ\nGJpqgi1HTdQRmbj7w2cSI9GY9wtYqFgvazAsgCa1mmonhaqtTBLiJH8WnRnR\nOwmdMEWK8Ln3pVdpULsqP5VJ56892iXFGM490lu+37aVveLEN6gtxGXd8Sez\nxexJZZkqte3kzovsw85X5Gz+WpH+ytu2a85QIohPA9hq6kya1R2wUxj3ToJQ\ni92P9krAgyBkKB2FjY6mMKZ88z/JcQ/daEaEWYSgYNnc1yF1KZjZG/EvuTCT\nVzBOsjy35cC0yYkINPxIe+RICm8Kez7KVxcDiNum6sMicz4BmRkcnBbO9j1a\nf5gztNTSUysdCXd+8lfceYRS6FD1Rhl9WV+ZPxp/9Q095s8bnNVc6060xYur\nMWyeUWqtaGOYsbrgd5gPS1WaT/Cl+9Sdih2UMA2PMthqJiXJQV0Ezbw5JL9y\nXMk8\r\n=BCpk\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/index.js","name":"@sanity/document-store","_from":"file:sanity-document-store-0.140.10-alpha.80.tgz","author":{"name":"Sanity.io","email":"hello@sanity.io"},"readme":"# Document store\n\nSanity / gradient document store\n\n## Example\n```js\n// If you are interested in everything that happens with document `lol42`\nconst subscription = documents.byId(\"lol42\").subscribe(event => {\n  console.log('Something happened with document lol42!', event)\n})\n\n// After a while, when you are no longer interested in updates fom document `lol42`:\nsubscription.unsubscribe()\n```\n\n## How it works\nWhen you add a subscriber to a document the first thing that happens is that the subscriber function is called with a snapshot of the document's current state. This happens as soon as the snapshot is retrieved. If there is a cached version of it on the client, the snapshot is received immediately (synchronously).\n\nFrom that moment on, you will receive a new event every time something happens to the document, until you unsubscribe again.\n\n## API\n\n- `createDocumentStore({serverConnection: ServerConnection}) : DocumentStore`\n\nServerConnection must be an object with the following api:\n- `byId(id : string) : Observable<DocumentEvent>`\n- `query(query : string) : Observable<QueryResultEvent>`\n(todo, add more)\n\n### DocumentStore\n\n### Query methods\n- `byId(id : string) : Observable<DocumentEvent>`\n- `byIds(ids : Array<string>) : Observable<QueryResultEvent>`\n- `query(query : string) : Observable<QueryResultEvent>`\n\n### Mutation methods\n- `update(id : string, spec : UpdateSpec) : Observable<OperationEvent>`\n- `create(document : Document) : Observable<OperationEvent>`\n- `replace(documentId : string, document : Document) : Observable<OperationEvent>`\n- `createOrReplace(document : Document) : Observable<OperationEvent>`\n- `delete(documentId : string) :  : Observable<OperationEvent>`\n\n### Document\n- `_id : string`\n- `_type : string`\n\n### DocumentEventType\n\n### DocumentEvent\n- `type : string` either one of `snapshot`, `update`\n- `snapshot : Document`\n","gitHead":"e21f54fb123e5f9ef60a946a469300b336b03289","license":"MIT","scripts":{"clean":"rimraf lib","examples":"echo 'Running examples'; for i in examples/*.js; do echo '\n## '$i' ----\n' && node $i; done"},"_npmUser":{"name":"thomax","email":"thomas@sanity.io"},"homepage":"https://www.sanity.io/","keywords":["sanity","cms","headless","realtime","content","document-store"],"_resolved":"","_integrity":"","repository":{"url":"git+https://github.com/sanity-io/sanity.git","type":"git"},"_npmVersion":"6.9.0","description":"Sanity / gradient document store","directories":{},"maintainers":[{"name":"bjoerge","email":"bjoerge@gmail.com"},{"name":"kmelve","email":"knut.melvaer@gmail.com"},{"name":"kristofferj","email":"kristoffer@sanity.io"},{"name":"mariuslundgard","email":"studio@mariuslundgard.com"},{"name":"rexxars","email":"espen@hovlandsdal.com"},{"name":"sanity-io","email":"developers@sanity.io"},{"name":"simenss","email":"simen@bengler.no"},{"name":"skogsmaskin","email":"per.kristian.nordnes@gmail.com"},{"name":"thomax","email":"thomas@sanity.io"}],"_nodeVersion":"10.13.0","dependencies":{"rxjs":"^6.1.0","lodash":"^4.17.4","nano-pubsub":"^1.0.2","@sanity/mutator":"0.140.10-alpha.80+e21f54fb1"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/document-store_0.140.10-alpha.80_1552387783945_0.6293366878745672","host":"s3://npm-registry-packages"},"_id":"@sanity/document-store@0.140.10-alpha.80","version":"0.140.10-alpha.80"}