{"bugs":{"url":"https://github.com/sanity-io/sanity/issues"},"dist":{"shasum":"1e7b27341245e222c1624f6e58b26f46800fcf3c","tarball":"https://registry.npmjs.org/@sanity/document-store/-/document-store-0.140.0-alpha.1.tgz","fileCount":22,"integrity":"sha512-geHZh7ynf7CdnmFP9wDAU2vW8jgRiaxGvWlJ65Yd748UqfKY5cNR/jP3ekWI4TK4UPA/M7YKpJvPWTxA1t1sbQ==","signatures":[{"sig":"MEYCIQDDSUu1QUHKkMpagURF2aAUNPU+EV48dUX57nkUNqX2/gIhAJqJOcVI8k9+SanGfNmBPIq37gBVg+EEAhiwmukt/ZwY","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":94904,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcGrBlCRA9TVsSAnZWagAAEY4P/3Rebx3g9ZHWi3XGo2ig\netW8tc7bhPAgPlN4u1VT/1bYvKZ9XwTmDFb56Tnayq4EWFO+880QRXj5vpvo\nHGnHSFELq2r7arYUAH4S/o5AhGIhcdvRPE8ton1rRkdiNTzaSJrLAdpEU9w7\nGbrsA17P/wXDJB3fXXhufjf9v3MO2hidCfvpGRHsY+7gJzMoC6BkyVZYVibd\nhePn4AqL2bfVe8SqSqevslUYn/zlRd7nhTenI15qijE9M6OfUfc1tRnKcW4d\npc3+jxD+Mw5phOT/5AaaFEo/ezAQRrJW8GHVRMThehTM/Qo3Ui30vfNl36sd\n6AY4R6nxRfEEg74PkE1RgO8RmA/vXow1g9+Gs/3YXlFN0PHBhHsdwlI8kHgM\ncl/uT6xkuD6/Ck/BS4d6CgCnWDq7pjyl3/ACpQXqD0dvL4BBT3X/USba7ETK\nj3e8pLa34Tqa3CY/OzXmd7Dv6uxhlyEf8Kn0Q1k3jlKq3bFWFhwQUG9vB9NT\n/hjZTIhh+3qZ7GQDDHoATaJniPprE1jZSBzk2WI7DJjd9TTTKcsOXwUylcRN\nKqkga1l99jXQmdnnISe/ELI5TmTpUde9i69TG4h2FZ/14NkxzYBeFSsOIcTZ\nRJg9VTqbZqrNUl2thpAeIgnRWwJRsEDiEUww3Kq0wUzW61Yltctv7zwVpZaj\nuFMW\r\n=aYCG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/index.js","name":"@sanity/document-store","_from":"file:sanity-document-store-0.140.0-alpha.1.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":"39719d06ed035d4b485dad8b10d2a4884e1fa5ce","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.140.0-alpha.1+39719d06e"},"_hasShrinkwrap":false,"readmeFilename":"README.md","_npmOperationalInternal":{"tmp":"tmp/document-store_0.140.0-alpha.1_1545252964517_0.07100467201806948","host":"s3://npm-registry-packages"},"_id":"@sanity/document-store@0.140.0-alpha.1","version":"0.140.0-alpha.1"}