{"bugs":{"url":"https://github.com/sanity-io/sanity/issues"},"dist":{"shasum":"21bf7093d5b9dc7ab49311198781531ed1bd69fe","tarball":"https://registry.npmjs.org/@sanity/document-store/-/document-store-0.138.0-alpha.20.tgz","fileCount":22,"integrity":"sha512-Dml01Wdrdy4DfkuStLnXcrbk/ID1I11VJ4vte5sfYUxwdRXL7e4GwiwBtQHK7Z1pUNOGMNGBm1bnXEo4SSe8eg==","signatures":[{"sig":"MEYCIQDpG2cvscQ1sE+MxC9ljiy8vCxjb6hskkCzCJfT/3EQfwIhAN6hjHX5OsuiBsEA25rbLhDn6+3zoOUalQhEU2rK7sNu","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":94906,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcFIEsCRA9TVsSAnZWagAAD9gP/06CFbuWfvxfY8pXevIe\ny4JSXY+QMrTELsU1562JMH9OQnkxUFnP/P2U1YPt0Dmm4FdHME7y7S3S2bVo\nEGvgt6rDdJUrp/8YleS+avD6MnZwjKVN2kn5j9LbLIEv8MJ0y8p0edrmYvxG\nKvDc+XRs1JHXp23eLv6ekJa56Qen5dJGN3dK7S+H6BaeE4ovRHGnewX0BIJ9\nvU9xF4WoczUPMwic9dqNRUo884INvznefcwvFwzeH3+KL39Gii2SvxIIUHmy\nTKlMRiev0SUs0uaOleE97VFVg9POCVZn7fZqJuRqoYe8jsJ7bcWgVy5ghoSY\ntWUmqVNHk3evzR0ZofMWANL5qk9scGMv5nKdwHOZRoczc2nFJSVqTgwmrPCH\nLiFRgPW5OfcVF/ungJ0GIobl9jZmmpvhzdXA5CN/zHIabYGYskMsgGZvym25\nCVNyc1/rv98/o0etFEIvC4eb0EgNFTAvW7hh+2dBNbyb5U7B7tcnoJq7XAD1\nZRrywCE+k7Fr2wmblKO8JJtdSpzJnaWb2oMAMfg6u4C8ya31O5E/HhwIZ6l5\n8IaCIeHnOmyqqtCXSakmubJYHm23eL8J8JU5242e81RiffJDNtcluADGKB6V\nmUZl+2RUcvR2Pb607/kyDqxzvI84HTz77RJM02XO8G421Vinu1XNvvkLO5zb\nEReJ\r\n=+XdH\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/index.js","name":"@sanity/document-store","_from":"file:sanity-document-store-0.138.0-alpha.20.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":"eb63d91386007237de2852c08921b4be09f69cd5","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":"skogsmaskin","email":"per.kristian.nordnes@gmail.com"},"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.4.1","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.12.0","dependencies":{"rxjs":"^6.1.0","lodash":"^4.17.4","nano-pubsub":"^1.0.2","@sanity/mutator":"0.138.0-alpha.20+eb63d9138"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/document-store_0.138.0-alpha.20_1544847659435_0.29061781983419976","host":"s3://npm-registry-packages"},"_id":"@sanity/document-store@0.138.0-alpha.20","version":"0.138.0-alpha.20"}