{"_id":"@comtstore/y-leveldb","_rev":"3-5ba0432d8d99fe07ef6ce4cd30668aeb","name":"@comtstore/y-leveldb","dist-tags":{"latest":"0.1.6"},"versions":{"0.1.3":{"name":"@comtstore/y-leveldb","version":"0.1.3","description":"LevelDb database adapter for Yjs","type":"module","main":"./dist/y-leveldb.cjs","module":"./src/y-leveldb.js","types":"./dist/src/y-leveldb.d.ts","sideEffects":false,"funding":{"type":"GitHub Sponsors ❤","url":"https://github.com/sponsors/dmonad"},"scripts":{"clean":"rm -rf dist","test":"rollup -c && nyc --check-coverage --lines 100 --branches 100 --functions 100 --statements 100 node ./dist/test.cjs","dist":"rollup -c","lint":"markdownlint README.md && standard && tsc","preversion":"npm run lint && npm run test && npm run clean && npm run dist && tsc && test -e dist/src/y-leveldb.d.ts && test -e dist/y-leveldb.cjs","debug":"concurrently 'rollup -wc' 'http-server -o .'"},"standard":{"ignore":["/dist","/node_modules","/docs"]},"exports":{"./package.json":"./package.json",".":{"import":"./src/y-leveldb.js","require":"./dist/y-leveldb.cjs"}},"repository":{"type":"git","url":"git+https://github.com/yjs/y-leveldb.git"},"keywords":["Yjs","CRDT","offline","shared editing","collaboration","concurrency"],"author":{"name":"Kevin Jahns","email":"kevin.jahns@protonmail.com"},"license":"MIT","bugs":{"url":"https://github.com/yjs/y-leveldb/issues"},"homepage":"https://yjs.dev","dependencies":{"level":"^6.0.1","lib0":"^0.2.31"},"devDependencies":{"@comtstore/y-protocols":"^1.0.6","@comtstore/yjs":"^13.5.45","@rollup/plugin-commonjs":"^13.0.0","@rollup/plugin-node-resolve":"^8.1.0","concurrently":"^3.6.1","http-server":"^0.12.3","jsdoc":"^3.6.3","level-mem":"^5.0.1","markdownlint-cli":"^0.23.2","nyc":"^15.1.0","rollup":"^2.20.0","rollup-plugin-node-polyfills":"^0.2.1","standard":"^14.3.4","typescript":"^3.9.6"},"peerDependencies":{"@comtstore/yjs":"^13.5.45"},"gitHead":"eccd767ef9de58e557e57b38954903294f0bf87e","_id":"@comtstore/y-leveldb@0.1.3","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-bcyXSOazIujrwUqflKqHuOTywxDecSrbaD5gRSRRJO5PinpSmFS2o8GHu0kIMYrICEUiyn67tvyLwFSJ41fYFw==","shasum":"36d4b9729691b32ccd74a203bb1c38b4bb196f59","tarball":"https://registry.npmjs.org/@comtstore/y-leveldb/-/y-leveldb-0.1.3.tgz","fileCount":10,"unpackedSize":2202830,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID8MPOdoz3qX+4+dFvsWViVRf/rVocxtDsgZaQ16oSKVAiAwOiXQI3cRdJRqQHZMDLtBZ96zCHO7/W9GhLGGIZ0QWg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj6z4lACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmro+A//al1tru2QF2qf7VqiLCXy8Fn0IOVSO6VDtLAu2WUceRX93MBK\r\ndDX9NQLf3/j2pa7pD478H9WTxsW2AeONLan6qCP8tObRsznT5X/gwErVoPXR\r\nfIk6W/4hZm3GXIDSQm8FcfYRrzfICMdMtUKfdeS2ZYBaHqA+hGzwOCI/QEE+\r\nuE8jVQcKyPG2HGQlOgJ1hvGrXWgHa/rJgfKgpEXU8ZBPhYjUYOvoo2zmKOvc\r\nediR9C6a6YMD4FZ5nYB8mYQ2h6McdX/yhWenxnOUDsF4IB+skJ+GqSToycOn\r\n/L9LGPHTjBrSaqKnph7qWkfmCNH9rDZAQZc2EqVTPHtlW7wK74MBeQ/85xme\r\nKAPZQ8jYDMQzISO1gekFmDPUDF0r8B9uzpoxLLv4V2W9crOe3ksPGXJCEPwZ\r\nz48U1URl9XByTV6/XQiW/j0pu/uyvfOSartEeQBwZI3actJzWWVEwNe8fDvd\r\nlH3beESMZi9y9R3a8gPXN43FA/xTCeCB/XcmxUIFMJg4fwOdV2bUM+2odsZ/\r\nYJZOGzg9LnyY1TaCMKHFKO4430antmbM5HlP3Nbn7nP7KvBSY81RwNqCZ12I\r\nc5M+sv2UB3CTieUVXMt9TWtOEJ0vPHxto8ShxcuAgKwfHzY1Txqpe49W1Ysw\r\nf3QO67kv/Skmz9iqmD9JeCamPKmUtKSPoN4=\r\n=LBk1\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"solingjees","email":"1600346867@qq.com"},"directories":{},"maintainers":[{"name":"solingjees","email":"1600346867@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/y-leveldb_0.1.3_1676361253436_0.7747019310996113"},"_hasShrinkwrap":false},"0.1.4":{"name":"@comtstore/y-leveldb","version":"0.1.4","description":"LevelDb database adapter for Yjs","type":"module","main":"./dist/y-leveldb.cjs","module":"./src/y-leveldb.js","types":"./dist/src/y-leveldb.d.ts","sideEffects":false,"funding":{"type":"GitHub Sponsors ❤","url":"https://github.com/sponsors/dmonad"},"scripts":{"clean":"rm -rf dist","test":"rollup -c && nyc --check-coverage --lines 100 --branches 100 --functions 100 --statements 100 node ./dist/test.cjs","dist":"rollup -c","lint":"markdownlint README.md && standard && tsc","preversion":"npm run lint && npm run test && npm run clean && npm run dist && tsc && test -e dist/src/y-leveldb.d.ts && test -e dist/y-leveldb.cjs","debug":"concurrently 'rollup -wc' 'http-server -o .'"},"standard":{"ignore":["/dist","/node_modules","/docs"]},"exports":{"./package.json":"./package.json",".":{"import":"./src/y-leveldb.js","require":"./dist/y-leveldb.cjs"}},"repository":{"type":"git","url":"git+https://github.com/yjs/y-leveldb.git"},"keywords":["Yjs","CRDT","offline","shared editing","collaboration","concurrency"],"author":{"name":"Kevin Jahns","email":"kevin.jahns@protonmail.com"},"license":"MIT","bugs":{"url":"https://github.com/yjs/y-leveldb/issues"},"homepage":"https://yjs.dev","dependencies":{"level":"^6.0.1","lib0":"npm:@comtstore/lib0@^0.2.82"},"devDependencies":{"@comtstore/y-protocols":"^1.0.6","@comtstore/yjs":"^13.7.6","@rollup/plugin-commonjs":"^13.0.0","@rollup/plugin-node-resolve":"^8.1.0","concurrently":"^3.6.1","http-server":"^0.12.3","jsdoc":"^3.6.3","level-mem":"^5.0.1","markdownlint-cli":"^0.23.2","nyc":"^15.1.0","rollup":"^2.20.0","rollup-plugin-node-polyfills":"^0.2.1","standard":"^14.3.4","typescript":"^3.9.6"},"peerDependencies":{"@comtstore/yjs":"^13.7.6"},"gitHead":"eccd767ef9de58e557e57b38954903294f0bf87e","_id":"@comtstore/y-leveldb@0.1.4","_nodeVersion":"16.20.1","_npmVersion":"8.19.4","dist":{"integrity":"sha512-fyJCzucL/strP2oh/WquoZbDlMsIntCIg2EK4yLiqw8F/bmC+NZ4LU00YcPmMsiv9uVJ5v+oQYM956qhIH5P4A==","shasum":"1b91e700070ad9c4e5463b3acaedb1aece60e1f5","tarball":"https://registry.npmjs.org/@comtstore/y-leveldb/-/y-leveldb-0.1.4.tgz","fileCount":10,"unpackedSize":15658439,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC+lKks2Zfni70feUrAxmE4ABtp73NeMpaCBkyklt8aLAIhAMYO9V4ZJpTnLKtQXRoeWJCv9u3g/9nsYve8/dQ8WbVN"}]},"_npmUser":{"name":"solingjees","email":"1600346867@qq.com"},"directories":{},"maintainers":[{"name":"solingjees","email":"1600346867@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/y-leveldb_0.1.4_1692092432147_0.062327280606949476"},"_hasShrinkwrap":false},"0.1.5":{"name":"@comtstore/y-leveldb","version":"0.1.5","description":"LevelDb database adapter for Yjs","type":"module","main":"./dist/y-leveldb.cjs","module":"./src/y-leveldb.js","types":"./dist/src/y-leveldb.d.ts","sideEffects":false,"funding":{"type":"GitHub Sponsors ❤","url":"https://github.com/sponsors/dmonad"},"scripts":{"clean":"rm -rf dist","test":"rollup -c && nyc --check-coverage --lines 100 --branches 100 --functions 100 --statements 100 node ./dist/test.cjs","dist":"rollup -c","lint":"markdownlint README.md && standard && tsc","preversion":"npm run lint && npm run test && npm run clean && npm run dist && tsc && test -e dist/src/y-leveldb.d.ts && test -e dist/y-leveldb.cjs","debug":"concurrently 'rollup -wc' 'http-server -o .'"},"standard":{"ignore":["/dist","/node_modules","/docs"]},"exports":{"./package.json":"./package.json",".":{"import":"./src/y-leveldb.js","require":"./dist/y-leveldb.cjs"}},"repository":{"type":"git","url":"git+https://github.com/yjs/y-leveldb.git"},"keywords":["Yjs","CRDT","offline","shared editing","collaboration","concurrency"],"author":{"name":"Kevin Jahns","email":"kevin.jahns@protonmail.com"},"license":"MIT","bugs":{"url":"https://github.com/yjs/y-leveldb/issues"},"homepage":"https://yjs.dev","dependencies":{"level":"^6.0.1","lib0":"npm:@comtstore/lib0@^0.2.82"},"devDependencies":{"@comtstore/y-protocols":"^1.0.6","@comtstore/yjs":"^13.7.6","@rollup/plugin-commonjs":"^13.0.0","@rollup/plugin-node-resolve":"^8.1.0","concurrently":"^3.6.1","http-server":"^0.12.3","jsdoc":"^3.6.3","level-mem":"^5.0.1","markdownlint-cli":"^0.23.2","nyc":"^15.1.0","rollup":"^2.20.0","rollup-plugin-node-polyfills":"^0.2.1","standard":"^14.3.4","typescript":"^3.9.6"},"peerDependencies":{"@comtstore/yjs":"^13.7.6"},"gitHead":"eccd767ef9de58e557e57b38954903294f0bf87e","_id":"@comtstore/y-leveldb@0.1.5","_nodeVersion":"16.20.1","_npmVersion":"8.19.4","dist":{"integrity":"sha512-qfV/dZi9BuXcBkvCtohlEaJu36KNHMbhumIvjOxIAjoGO7whkCvzMtqAmasDDLYHK3gcGTj2LctSBvCLoatghQ==","shasum":"5392ca56dc0a5e4f6f2ee8a5b6327c2c618240ee","tarball":"https://registry.npmjs.org/@comtstore/y-leveldb/-/y-leveldb-0.1.5.tgz","fileCount":10,"unpackedSize":15659451,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHYnJZEzdaNB1Jsp0yB234PX7Nci+YRCUTgrHq5MZ+2nAiBlRk0r01ba4Riol9iuu0HQxio6WsXXwwPnVgE9t1DgeA=="}]},"_npmUser":{"name":"solingjees","email":"1600346867@qq.com"},"directories":{},"maintainers":[{"name":"solingjees","email":"1600346867@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/y-leveldb_0.1.5_1692100817100_0.36429573007298677"},"_hasShrinkwrap":false},"0.1.6":{"name":"@comtstore/y-leveldb","version":"0.1.6","description":"LevelDb database adapter for Yjs","type":"module","main":"./dist/y-leveldb.cjs","module":"./src/y-leveldb.js","types":"./dist/src/y-leveldb.d.ts","sideEffects":false,"funding":{"type":"GitHub Sponsors ❤","url":"https://github.com/sponsors/dmonad"},"scripts":{"clean":"rm -rf dist","test":"rollup -c && nyc --check-coverage --lines 100 --branches 100 --functions 100 --statements 100 node ./dist/test.cjs","dist":"rollup -c","lint":"markdownlint README.md && standard && tsc","preversion":"npm run lint && npm run test && npm run clean && npm run dist && tsc && test -e dist/src/y-leveldb.d.ts && test -e dist/y-leveldb.cjs","debug":"concurrently 'rollup -wc' 'http-server -o .'"},"standard":{"ignore":["/dist","/node_modules","/docs"]},"exports":{"./package.json":"./package.json",".":{"import":"./src/y-leveldb.js","require":"./dist/y-leveldb.cjs"}},"repository":{"type":"git","url":"git+https://github.com/yjs/y-leveldb.git"},"keywords":["Yjs","CRDT","offline","shared editing","collaboration","concurrency"],"author":{"name":"Kevin Jahns","email":"kevin.jahns@protonmail.com"},"license":"MIT","bugs":{"url":"https://github.com/yjs/y-leveldb/issues"},"homepage":"https://yjs.dev","dependencies":{"level":"^6.0.1","lib0":"npm:@comtstore/lib0@^0.2.82"},"devDependencies":{"@comtstore/y-protocols":"^1.0.6","@comtstore/yjs":"^13.7.7","@rollup/plugin-commonjs":"^13.0.0","@rollup/plugin-node-resolve":"^8.1.0","concurrently":"^3.6.1","http-server":"^0.12.3","jsdoc":"^3.6.3","level-mem":"^5.0.1","markdownlint-cli":"^0.23.2","nyc":"^15.1.0","rollup":"^2.20.0","rollup-plugin-node-polyfills":"^0.2.1","standard":"^14.3.4","typescript":"^3.9.6"},"peerDependencies":{"@comtstore/yjs":"^13.7.7"},"gitHead":"c4e14bea8ea80a87470197eaa4887a25b1ae3c23","_id":"@comtstore/y-leveldb@0.1.6","_nodeVersion":"16.20.1","_npmVersion":"8.19.4","dist":{"integrity":"sha512-enUyPWArPbWLCzWY4MNz7QqQqbuPWoFiuGhMjWnzgB9cgCdVVJuCK74vPQSTEb5A5eR7CBD55Hct2QpFaOXITw==","shasum":"2330d812c38038465419621ca1c9f8b3a493986f","tarball":"https://registry.npmjs.org/@comtstore/y-leveldb/-/y-leveldb-0.1.6.tgz","fileCount":10,"unpackedSize":15623628,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCvrrN381xpvnOhpGZ+hM9XOx0W0/cF5BeEbAoQLbNTYQIhAKnP6IM1tAfTS6Y9aaTqrQWuhAN89Sd4BknxwTtJDMBI"}]},"_npmUser":{"name":"solingjees","email":"1600346867@qq.com"},"directories":{},"maintainers":[{"name":"solingjees","email":"1600346867@qq.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/y-leveldb_0.1.6_1692124973378_0.9239905530866053"},"_hasShrinkwrap":false}},"time":{"created":"2023-02-14T07:54:13.368Z","0.1.3":"2023-02-14T07:54:13.785Z","modified":"2023-08-15T18:42:54.030Z","0.1.4":"2023-08-15T09:40:32.399Z","0.1.5":"2023-08-15T12:00:17.423Z","0.1.6":"2023-08-15T18:42:53.787Z"},"maintainers":[{"name":"solingjees","email":"1600346867@qq.com"}],"description":"LevelDb database adapter for Yjs","homepage":"https://yjs.dev","keywords":["Yjs","CRDT","offline","shared editing","collaboration","concurrency"],"repository":{"type":"git","url":"git+https://github.com/yjs/y-leveldb.git"},"author":{"name":"Kevin Jahns","email":"kevin.jahns@protonmail.com"},"bugs":{"url":"https://github.com/yjs/y-leveldb/issues"},"license":"MIT","readme":"# LevelDB database adapter for [Yjs](https://github.com/yjs/yjs)\n\nLevelDB is a fast embedded database. It is the underlying technology of IndexedDB.\n\nInternally, y-leveldb uses [`level`](https://github.com/Level/level) which\nallows to exchange the storage medium for a different supported database.\nHence this adapter also supports rocksdb, lmdb, and many more..\n\n* Persistent storage for the server\n* Exchangeable storage medium\n* Can be used in [y-websocket](https://github.com/yjs/y-websocket)\n* A single y-leveldb instance can handle many documents.\n\n## Use it\n\n```sh\nnpm install y-leveldb --save\n```\n\n```js\nimport * as Y from 'yjs'\nimport { LeveldbPersistence } from 'y-leveldb'\n\nconst persistence = new LeveldbPersistence('./storage-location')\n\nconst ydoc = new Y.Doc()\nydoc.getArray('arr').insert(0, [1, 2, 3])\nydoc.getArray('arr').toArray() // => [1, 2, 3]\n\n// store document updates retrieved from other clients\npersistence.storeUpdate('my-doc', Y.encodeStateAsUpdate(ydoc))\n\n// when you want to sync, or store data to a database,\n// retrieve the temporary Y.Doc to consume data\nconst ydocPersisted = await persistence.getYDoc('my-doc')\nydocPersisted.getArray('arr') // [1, 2, 3]\n```\n\n## API\n\n### `persistence = LeveldbPersistence(storageLocation, [{ [level] }])`\n\nCreate a y-leveldb persistence instance.\n\nYou can use any levelup-compatible adapter.\n\n```js\nimport { LeveldbPersistence } from 'y-leveldb'\nimport level from 'level-mem'\n\nconst persistence = new LeveldbPersistence('./storage-location', { level })\n```\n\n#### `persistence.getYDoc(docName: string): Promise<Y.Doc>`\n\nCreate a Y.Doc instance with the data persistet in leveldb. Use this to\ntemporarily create a Yjs document to sync changes or extract data.\n\n#### `persistence.storeUpdate(docName: string, update: Uint8Array): Promise`\n\nStore a single document update to the database.\n\n#### `persistence.getStateVector(docName: string): Promise<Uint8Array>`\n\nThe state vector (describing the state of the persisted document - see\n[Yjs docs](https://github.com/yjs/yjs#Document-Updates)) is maintained in a separate\nfield and constantly updated.\n\nThis allows you to sync changes without actually creating a Yjs document.\n\n#### `persistence.getDiff(docName: string, stateVector: Uint8Array): Promise<Uint8Array>`\n\nGet the differences directly from the database. The same as\n`Y.encodeStateAsUpdate(ydoc, stateVector)`.\n\n#### `persistence.clearDocument(docName: string): Promise`\n\nDelete a document, and all associated data from the database.\n\n#### `persistence.setMeta(docName: string, metaKey: string, value: any): Promise`\n\nPersist some meta information in the database and associate it with a document.\nIt is up to you what you store here. You could, for example, store credentials\nhere.\n\n#### `persistence.getMeta(docName: string, metaKey: string): Promise<any|undefined>`\n\nRetrieve a store meta value from the database. Returns undefined if the\n`metaKey` doesn't exist.\n\n#### `persistence.delMeta(docName: string, metaKey: string): Promise`\n\nDelete a store meta value.\n\n#### `persistence.getAllDocNames(docName: string): Promise<Array<string>>`\n\nRetrieve the names of all stored documents.\n\n#### `persistence.getAllDocStateVectors(docName: string): Promise<Array<{ name:string,clock:number,sv:Uint8Array}`\n\nRetrieve the state vectors of all stored documents. You can use this to sync\ntwo y-leveldb instances.\n\nNote: The state vectors might be outdated if the associated document is not\nyet flushed. So use with caution.\n\n#### `persistence.flushDocument(docName: string): Promise` (dev only)\n\nInternally y-leveldb stores incremental updates. You can merge all document\nupdates to a single entry. You probably never have to use this.\n\n## License\n\ny-leveldb is licensed under the [MIT License](./LICENSE).\n\n<kevin.jahns@protonmail.com>\n","readmeFilename":"README.md"}