{"_id":"y-cap-sqlite","name":"y-cap-sqlite","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"y-cap-sqlite","version":"1.0.0","description":"y-cap-sqlite is a persistence provider for [Yjs](https://github.com/yjs/yjs) that uses [@capacitor-community/sqlite](https://github.com/capacitor-community/sqlite) to store document changes in a SQLite database. This is useful for Capacitor projects that ","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","sideEffects":false,"type":"module","scripts":{"dev":"tsup --watch","build":"tsup"},"keywords":["yjs","sqlite","local-first","offline-first","realtime","collaboration","yjs-provider","yjs-provider-sqlite","capacitor"],"author":{"name":"Loseq","email":"loseq@proton.me"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/l0seq/y-cap-sqlite.git"},"devDependencies":{"@types/node":"^20.12.7","tsup":"^8.4.0","typescript":"^5.4.5"},"dependencies":{"buffer":"^6.0.3","lib0":"^0.2.93"},"peerDependencies":{"@capacitor-community/sqlite":"^7.0.0","yjs":"^13.0.0"},"_id":"y-cap-sqlite@1.0.0","gitHead":"45b6ad74cd11063ae1f8a53df19bbc0bce53a7b4","bugs":{"url":"https://github.com/l0seq/y-cap-sqlite/issues"},"homepage":"https://github.com/l0seq/y-cap-sqlite#readme","_nodeVersion":"20.18.2","_npmVersion":"11.1.0","dist":{"integrity":"sha512-9shy02mrhECoCoLuz9gZ4NugSrAp4B4OpiP8d2RJcd+1f1/qaVQFjhDsQ/Zl99tl83V/VjtB6tlGa3yBGY/ttQ==","shasum":"14181d98bacb583eaddc6f44c9f4662658f2720e","tarball":"https://registry.npmjs.org/y-cap-sqlite/-/y-cap-sqlite-1.0.0.tgz","fileCount":10,"unpackedSize":50138,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCKKkfvHi8pnblcaW29ETaY/vvJ8UzWyQtPdxtkL6yzsAIgDkv/OZFqAwRllPXJAg+TYWh9T20F80xY0jsbRVW4ueY="}]},"_npmUser":{"name":"loseq","email":"loseq@proton.me"},"directories":{},"maintainers":[{"name":"loseq","email":"loseq@proton.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/y-cap-sqlite_1.0.0_1741276430571_0.05592275971022409"},"_hasShrinkwrap":false}},"time":{"created":"2025-03-06T15:53:50.570Z","1.0.0":"2025-03-06T15:53:50.704Z","modified":"2025-03-06T15:53:50.940Z"},"maintainers":[{"name":"loseq","email":"loseq@proton.me"}],"description":"y-cap-sqlite is a persistence provider for [Yjs](https://github.com/yjs/yjs) that uses [@capacitor-community/sqlite](https://github.com/capacitor-community/sqlite) to store document changes in a SQLite database. This is useful for Capacitor projects that ","homepage":"https://github.com/l0seq/y-cap-sqlite#readme","keywords":["yjs","sqlite","local-first","offline-first","realtime","collaboration","yjs-provider","yjs-provider-sqlite","capacitor"],"repository":{"type":"git","url":"git+https://github.com/l0seq/y-cap-sqlite.git"},"author":{"name":"Loseq","email":"loseq@proton.me"},"bugs":{"url":"https://github.com/l0seq/y-cap-sqlite/issues"},"license":"MIT","readme":"## About\n\ny-cap-sqlite is a persistence provider for [Yjs](https://github.com/yjs/yjs) that uses [@capacitor-community/sqlite](https://github.com/capacitor-community/sqlite) to store document changes in a SQLite database. This is useful for Capacitor projects that need to access YJS documents without an internet connection to enable a local-first experience.\n\n## Installing\n\nYou can install y-cap-sqlite and its peer dependencies using your favorite package manager:\n\n```sh\n# install using npm\nnpm install ls yjs @capacitor-community/sqlite\n\n# install using bun\nbun add y-cap-sqlite yjs @capacitor-community/sqlite\n\n# install using pnpm\npnpm add y-cap-sqlite yjs @capacitor-community/sqlite\n```\n\n## Usage\n\n\n```ts\nimport { CapSQLitePersistence } from 'y-cap-sqlite';\n\n// other code...\n\nconst provider = await OPSQLitePersistence.create(config: Omit<capConnectionOptions, \"database\">, doc: Y.Doc, name: string, sqlite: SQLiteConnection);\n\nprovider.whenSynced.then(() => {\n  console.log(\"content finished loading from database.\");\n});\n```\n\nWhen you're done accessing the document, you can destroy the connection to the provider:\n\n```ts\n// stop syncing with database\nprovider.destroy();\n```\n\n\n## Attribution\n\nThis library is based on [y-op-sqlite](https://github.com/malte-j/y-op-sqlite) by Malte J, thanks to him for the support !\n","readmeFilename":"README.md","_rev":"1-029d226e884172055b4727a319b4f48f"}