{"bugs":{"url":"https://github.com/sanity-io/sanity/issues"},"dist":{"shasum":"162d99956d8b335c1c8b3c4cee96edd584378c5c","tarball":"https://registry.npmjs.org/@sanity/document-store/-/document-store-0.135.7-canary.262.tgz","fileCount":21,"integrity":"sha512-/bbGzZC7Sp4RPjV6Uuc0aeCfFXihDOwCLXIQvoR7V4B4Ncg/9Q7XOgI24gGEs07R5ysNNtNsauwJDjxWX7pv0w==","signatures":[{"sig":"MEYCIQCir52juh//he9IfslOGgPfYVAQzMZIATLh7FE+u0p1awIhAOISdDemsae5ki0fTUWtx6nFbXZ6swNKry6YbT6r94x7","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\nwsFcBAEBCAAQBQJb7TA8CRA9TVsSAnZWagAA4ZsQAIWnWKKFP4enkuKshXs6\n1mqhD/S5kxge9YaaOOSHM7UwkaPBpg4X10AtAOvCeuCHqVfqMangN+VdojaF\ncrC+7CFwgdQo54HVhMHFECyIiZ78AEf+P2wULc2x/zVY99gJxsotvaJSo5uB\n8OhMK9cFKa/i2mbixo90WmyZtwREcO0BE1w8A1qpBgGIgpw3d6N2QBQ9LbEH\nIDuOQPjhO6pqlW3W9abnt9w/2UopOAipZhWM+NqPCxq50q8stYxan9w8nKcd\nKKSJc/odRCPSSOUG/31h/iZ2pq8+52lcl+sRMqLO6W5L0MxvtADhRsNMHNMT\nfglDxC3F+eht9jgr11hz2mXh10s/3bBt5ftdk3fdN9Plx5WgYS2eRvDhhf2A\npR/+sZ6XX3s7VOCneoSpXBGJRuGyepfGSM4lKqvHx/6sHFLM8UckApNCohZm\njTDTvMgxOLHm1VKTBPZ2XoI7LHjApf4R1gPjsXCnASQd5OAtmSMLdMHVs7em\ngZmFiShtyV5C9hBgwWiDKPjrMN0LXOJhDv31oTWYP4/+ZFjX6+b7y/Bt3Xe5\nj0CHmBAU8hsE0DsM0PIx9/MNZBj27JiC9iB42GNH/jBm+zvZk2TCBkC8JtjD\n69a11/bK7omCAR66O5k/sQRhoqog1T5VCay9W8Uydl0d85wE9U9fwLXPZpRc\nrfgD\r\n=qgAR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/index.js","name":"@sanity/document-store","_from":"file:sanity-document-store-0.135.7-canary.262.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":"15a1421eba50c319c821df3b0e22561576e0cde8","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.262+15a1421eb"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/document-store_0.135.7-canary.262_1542271036202_0.11202204848355013","host":"s3://npm-registry-packages"},"_id":"@sanity/document-store@0.135.7-canary.262","version":"0.135.7-canary.262"}