{"bugs":{"url":"https://github.com/sanity-io/sanity/issues"},"dist":{"shasum":"32ad4d2b58150c54e6b2e44ad5110bfa455e3e1e","tarball":"https://registry.npmjs.org/@sanity/document-store/-/document-store-0.135.7-canary.266.tgz","fileCount":21,"integrity":"sha512-uClCJntGygqD2zOB3sOKzcvN13UH7teIE5I6NR8ID7bXWeIAVocK2dtph/2gwRVOrc1YVDuVBJJ7uG2rWYclwQ==","signatures":[{"sig":"MEUCIQCbbdKqhJCsUE+9lvLqWtbcoAPruoRH94O5C10pia0mlQIgBB9ChVKmmq0dPRGBYQ0XSjtenKOsCrQO9ooKSZg6qNQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":31553,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb7UGlCRA9TVsSAnZWagAAZ3YP/AwuBe+voWhVfqKxP9+Z\nIwmV69dj5Q7BgGxlpp390h7Vddt5YJs206dGNKYxw/EkXLEXH099eYO2zTpI\nWiEUEPZcrGQqlCZ52M52vX4WpJRXS9Kp0v41RmA5JBee7uNlHdi0hQNMJkBt\n0b2N+eRnzhMrE/Y/w67SWKDMYEm6qJrTsgcf5jc3DWcYyhuoX46NTRfhyK5h\nzH4tKlI5g5vkpLR4xSunFak+iecRGV8lWHXuUsaua4NEsCbhhqtxbwZAeAh+\nYE2w1icAqu5j2JgwW1XqOam+pQMOnB4ThKHyJ9wjsDSJybt2BoUp9jOUm/sb\nQBOFekODSFbzLCCU/XhO3HonmttLv+bZZxQWkN3EJhSNGGiTpajAI9mhA8n2\nj5dEHw3OMIx0jEj310aoyAqEh0roPoDn3+9yp3TSsVSRW3vihk8scaSEIC6p\nZT9fEixHVmc34zTmBYCRqcWKYytlhaMQYhNsawhyEGHKCU0FKr3UKus9zcDn\nrBJBOW2kQo6mDwgEXbyW+dFzaJQ8DwsgIeVfdkixcXlp7z+0W/kq1CdY2ilI\nTa8pOj/w9yojKXlby4WTlcqNdkLQxye1KZtX2dFb9zLGME+quZLjaVN8Ruas\nT/JgFwQ9/tth35i37/sYIwxQiwmXWApX8lp4HDwDKI5ZTQpIhs6WRWnUN9zb\nw5R4\r\n=NOHW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/index.js","name":"@sanity/document-store","_from":"file:sanity-document-store-0.135.7-canary.266.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":"ac554ee5344e0d52dc5987f77b2ec78240590ba6","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":"bjoerge","email":"bjoerge@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":"simenss","email":"simen@bengler.no"},{"name":"skogsmaskin","email":"per.kristian.nordnes@gmail.com"},{"name":"thomax","email":"thomas@sanity.io"}],"_nodeVersion":"10.9.0","dependencies":{"rxjs":"^6.1.0","lodash":"^4.17.4","nano-pubsub":"^1.0.2","@sanity/mutator":"0.135.7-canary.266+ac554ee53"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/document-store_0.135.7-canary.266_1542275493131_0.910901727152615","host":"s3://npm-registry-packages"},"_id":"@sanity/document-store@0.135.7-canary.266","version":"0.135.7-canary.266"}