{"bugs":{"url":"https://github.com/sanity-io/sanity/issues"},"dist":{"shasum":"8134cdd41e6809d1779b00fe8bbb83ef44cc4100","tarball":"https://registry.npmjs.org/@sanity/document-store/-/document-store-0.135.7-canary.252.tgz","fileCount":21,"integrity":"sha512-J0K3Aq+AohXbe1vW+ootck7Rv3TRVIrACENPXoP5TzeEwvJnn5mDmsIE1XRcwvXY3fX+tT2jUfvJeboTW3Uyaw==","signatures":[{"sig":"MEYCIQCQ6pNd/dMBQhyhTMdafpNyI1FB4ZEDBqF3YZqe2x0WnQIhAIcPimeUne4vn/O7G61Vb+JOu4cI6DA1IbFRpag/57Lv","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\nwsFcBAEBCAAQBQJb7C6mCRA9TVsSAnZWagAApL0QAI+++NPBf0uc/c4tpfCi\nIUUy63wr+PREaCfJ6SUw9wEZA71S3rs0MbfvVUWzG2rX8UjNRAspsmP/dlSg\n/yAicxyBbHJNNILO0qvFDSOu/BLSrAZ6WpMpXmJBVy4HO0TycWx70mRnYvdx\nT6TCGSI5Rt+HJ1NghkrZ2pswdAyaMZYY9K4ZPqyPSCPw0fgdo2av2c0mx8eN\nxk0tzh1scxd1OIJx8gJANRZHHHagK3MXVzfKno79pvUXb1faI1RrBlwYy3Qq\n6i8KbZoBnvpVSgsA6QPXdVMLLXgLoiTMXc3ZKYB6Kh1SAL+9ivldIxH5nWPx\nTQisIGl5O3nA4uMBR54TsxASSSdGvf02u7Q1WYwxGZCy2tvHyz47qcnyiESY\npl+BaXXAjEWKKW64JTAMUIve4nQTIbmxKABUtMR+3weTXZ5YcgBSB/v4cMD8\nZbRGXYl9jqAlwsxUVLzmZH8sLcOQY685iM2fG6sTorVmUOwW2bHAgcN6hoSy\n4bf977TDOYgNpBtGm3rNvShuGdemaJ1h86eESFeuUj8RBdT3drb2NVT9elbf\nPADp9uoWVA4UDq1VGBtfknuBdrfqYFgZdXFZdl7QzEUaizeqg9BFYcFL3z2a\nceaqFlggGuO7zNgL69+BNbew3hhc3MVhRmfOw1AwBl99l8e6TvbtrvyB3AEl\nVOgW\r\n=qBhL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/index.js","name":"@sanity/document-store","_from":"file:sanity-document-store-0.135.7-canary.252.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":"6941134293c00c7553af903e83fa704481d3dd3e","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":"mariuslundgard","email":"studio@mariuslundgard.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.11.0","dependencies":{"rxjs":"^6.1.0","lodash":"^4.17.4","nano-pubsub":"^1.0.2","@sanity/mutator":"0.135.7-canary.252+694113429"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/document-store_0.135.7-canary.252_1542205094236_0.6818549015853921","host":"s3://npm-registry-packages"},"_id":"@sanity/document-store@0.135.7-canary.252","version":"0.135.7-canary.252"}