{"bugs":{"url":"https://github.com/sanity-io/sanity/issues"},"dist":{"shasum":"d3fcc68bb231c1acedce40e2332e0db7e6cf829d","tarball":"https://registry.npmjs.org/@sanity/document-store/-/document-store-0.133.0-babel-7.06032ac5.tgz","fileCount":18,"integrity":"sha512-OZvIm8GZ5rwOPr7mAE+rRtAkAK5Iu8306ogGhr0xZ4EyPagyuIkgQ5M2dk1ZaSFIPqYCxbzDozoDybQiZwZRWQ==","signatures":[{"sig":"MEUCID/TBrlP3FTmZKN2KUBbRKHIRDX5usBtgh9KUs5InqgYAiEAjzUwVn42EP7b8cvvrAx8NE9jU3iugdzA4I5o0LZRz58=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":28700,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbjqi7CRA9TVsSAnZWagAAlsoP/1fXBKSaTHa1stnjjl/w\nT4TFxgHZWLbLmfLrNZQon6uH1NgL+SPd9MrSxlZpiV5qvoNdNBsbQenxfx2l\nFFIENedwcNlAsh8QQya28RbDtPDbU4ZRVwUJYAmVNe7hSuD3ZfrjgEvaIdVQ\nUE/ZJe5EQyrMI+qoECm4KygpuYZ+wpsEZGnBVLVyXbBgSQ6uC9+Ai7VCjKFP\nQuOIRRDRBh7iB4vTtNf8EoAB/qN9Qd8rXqxhxduK8JFPIWt2mQ39RFF8ZJ6X\nwloQix8h/homJzOuQrck1rD1HrDcj1mq/P/VFfhVEL/TEDv+qoi4WE98n4ha\nGbJWMZpZUsm3cosUJ8bxiE9tm3QkEIWhbVi1/uVXImARLpHdO6kFl+20vuAk\nz2GKyFkuSouj854IMuSqGcCeIdtOm02g/DnD3NDJJr59LACL2v9g1DZcbXJV\nxa7Set5fBk+Luj/kjTuVoezQO/5M+XpaD8r+qqdcKOGCXcffaM8dxoX19k/o\ndV4mU8zj4lFKqRwj5ozeTPM7Bjtm+4o8liJHX+sgut6SyK7sxC+zURUYQ2tr\nLdfLfpJitoh5V2eY+3v5YGaWLwyGybX2EyJF6IGfmxfnUzySJhrs2pID5Vy+\nGVQ3joHaxIDAUpGRDPHj+kxj/MrI1ZKKrsylZJ6RQUtspnRguC/d3ijuCAwM\n1Xc8\r\n=Gu5f\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/index.js","name":"@sanity/document-store","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","license":"MIT","scripts":{"tap":"tap --node-arg=--require --node-arg=babel-register test/*.test.js","test":"npm run tap && npm run examples","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"],"repository":{"url":"git+https://github.com/sanity-io/sanity.git","type":"git"},"_npmVersion":"5.6.0","description":"Sanity / gradient document store","directories":{},"maintainers":[{"name":"bjoerge","email":"bjoerge@gmail.com"},{"name":"kmelve","email":"knut.melvaer@gmail.com"},{"name":"kristofferj","email":"kristoffer@bengler.no"},{"name":"rexxars","email":"espen@hovlandsdal.com"},{"name":"simenss","email":"simen@bengler.no"},{"name":"skogsmaskin","email":"per.kristian.nordnes@gmail.com"},{"name":"thomax","email":"thomas@bengler.no"}],"_nodeVersion":"8.11.4","dependencies":{"rxjs":"^6.1.0","lodash":"^4.17.4","nano-pubsub":"^1.0.2","@sanity/mutator":"0.133.0-babel-7.06032ac5"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"tap":"^11.0.1","rimraf":"^2.6.2","in-publish":"^2.0.0","get-random-values":"^1.2.0"},"_npmOperationalInternal":{"tmp":"tmp/document-store_0.133.0-babel-7.06032ac5_1536075963076_0.615854119505219","host":"s3://npm-registry-packages"},"_id":"@sanity/document-store@0.133.0-babel-7.06032ac5","version":"0.133.0-babel-7.06032ac5"}