{"_id":"@ahmetskilinc/sync-client","_rev":"5-c687d023a65a4406e05705879de9bf3b","name":"@ahmetskilinc/sync-client","dist-tags":{"latest":"0.4.0"},"versions":{"0.1.0":{"name":"@ahmetskilinc/sync-client","version":"0.1.0","keywords":["sync","realtime","local-first","offline-first","optimistic-ui"],"license":"MIT","_id":"@ahmetskilinc/sync-client@0.1.0","maintainers":[{"name":"ahmetskilinc","email":"ahmetskilinc@icloud.com"}],"homepage":"https://github.com/ahmetskilinc/sync-engine#readme","bugs":{"url":"https://github.com/ahmetskilinc/sync-engine/issues"},"dist":{"shasum":"d0c3b348f7be337b59a018d9f3adfab6f13a7397","tarball":"https://registry.npmjs.org/@ahmetskilinc/sync-client/-/sync-client-0.1.0.tgz","fileCount":21,"integrity":"sha512-Cvt9xOTNJuXtugpgAFkhTsrGEInV7hkc4+ekt5Td2oe/TX0Ng4Pq2hq6EKvpKIC7bm42CXjY3vo2GNauSlUnlQ==","signatures":[{"sig":"MEUCIQC6a+vIbY7/J5HITQ6RKDbOqNSq/vOEXZbPT/h4BK6n7wIgYcEyuPfoCyV36Z3p2hERnJAmjCkyEtDBdy9AezVM8js=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":54869},"main":"./dist/index.js","type":"module","_from":"file:packages/client/ahmetskilinc-sync-client-0.1.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"build":"tsc -b","prepublishOnly":"bunx tsc -b"},"_npmUser":{"name":"ahmetskilinc","email":"ahmetskilinc@icloud.com"},"_resolved":"/Users/ahmetkilinc/Developer/sync-engine/packages/client/ahmetskilinc-sync-client-0.1.0.tgz","_integrity":"sha512-Cvt9xOTNJuXtugpgAFkhTsrGEInV7hkc4+ekt5Td2oe/TX0Ng4Pq2hq6EKvpKIC7bm42CXjY3vo2GNauSlUnlQ==","repository":{"url":"git+https://github.com/ahmetskilinc/sync-engine.git","type":"git","directory":"packages/client"},"_npmVersion":"11.6.2","description":"Local-first client for sync-engine: optimistic transactions, offline queue, rebase, IndexedDB persistence","directories":{},"sideEffects":false,"_nodeVersion":"24.12.0","dependencies":{"@ahmetskilinc/sync-core":"0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/sync-client_0.1.0_1785253947560_0.6729630291831257","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@ahmetskilinc/sync-client","version":"0.2.0","keywords":["sync","realtime","local-first","offline-first","optimistic-ui"],"license":"MIT","_id":"@ahmetskilinc/sync-client@0.2.0","maintainers":[{"name":"ahmetskilinc","email":"ahmetskilinc@icloud.com"}],"dist":{"shasum":"31323291a8c2c78d4aa2806b14427a4169f7e38b","tarball":"https://registry.npmjs.org/@ahmetskilinc/sync-client/-/sync-client-0.2.0.tgz","fileCount":21,"integrity":"sha512-VLHtYXaFUx0txjQwKBhR0aA6m7GI0ou0oSPnRIGoA5Q5vcZar6t9ZYwnmPrwhy/N+viTGqSS2/nKi4kQjPbVoA==","signatures":[{"sig":"MEYCIQDmx1BDMd8TbQzS1BZUCs1crz2DqKOc+FMfuM235CaibwIhAM1zx37LRKJCqH3tmKhE3dx5TZOZJjrZuuJB6GtBWlm/","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":56086},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","shasum":"31323291a8c2c78d4aa2806b14427a4169f7e38b","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"build":"tsc -b","prepublishOnly":"bunx tsc -b"},"_npmUser":{"name":"ahmetskilinc","email":"ahmetskilinc@icloud.com"},"_integrity":"sha512-VLHtYXaFUx0txjQwKBhR0aA6m7GI0ou0oSPnRIGoA5Q5vcZar6t9ZYwnmPrwhy/N+viTGqSS2/nKi4kQjPbVoA==","repository":{"url":"git+https://github.com/ahmetskilinc/sync-engine.git","type":"git","directory":"packages/client"},"_npmVersion":"10.8.3","description":"Local-first client for sync-engine: optimistic transactions, offline queue, rebase, IndexedDB persistence","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@ahmetskilinc/sync-core":"0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/sync-client_0.2.0_1785257747236_0.1515824407045443","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@ahmetskilinc/sync-client","version":"0.2.1","keywords":["sync","realtime","local-first","offline-first","optimistic-ui"],"license":"MIT","_id":"@ahmetskilinc/sync-client@0.2.1","maintainers":[{"name":"ahmetskilinc","email":"ahmetskilinc@icloud.com"}],"dist":{"shasum":"3a5df418cba9dceaea9173bae6799a1e50418e7a","tarball":"https://registry.npmjs.org/@ahmetskilinc/sync-client/-/sync-client-0.2.1.tgz","fileCount":21,"integrity":"sha512-+glqep5cmpXCDIDUa7lui6Q2onokhtSUfcua7DOWXsVOThZfn+qM0LGCPqgTZ7wZ6Dj7rvKMLzCwycWTSRD0rw==","signatures":[{"sig":"MEQCIHvQJa3/ENbvbXCMIstn1oKRSApFTIzEH0KN6elnom7EAiBu/E2e2tmH7TczI5h2tfCerH2H3gtWu9XDGQGJFJidgA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":56087},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","shasum":"3a5df418cba9dceaea9173bae6799a1e50418e7a","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"build":"tsc -b","prepublishOnly":"bunx tsc -b"},"_npmUser":{"name":"ahmetskilinc","email":"ahmetskilinc@icloud.com"},"_integrity":"sha512-+glqep5cmpXCDIDUa7lui6Q2onokhtSUfcua7DOWXsVOThZfn+qM0LGCPqgTZ7wZ6Dj7rvKMLzCwycWTSRD0rw==","repository":{"url":"git+https://github.com/ahmetskilinc/sync-engine.git","type":"git","directory":"packages/client"},"_npmVersion":"10.8.3","description":"Local-first client for sync-engine: optimistic transactions, offline queue, rebase, IndexedDB persistence","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@ahmetskilinc/sync-core":"^0.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/sync-client_0.2.1_1785258635183_0.15475278269704784","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@ahmetskilinc/sync-client","version":"0.3.0","keywords":["sync","realtime","local-first","offline-first","optimistic-ui"],"author":{"name":"Ahmet Kilinc"},"license":"MIT","_id":"@ahmetskilinc/sync-client@0.3.0","maintainers":[{"name":"ahmetskilinc","email":"ahmetskilinc@icloud.com"}],"homepage":"https://github.com/ahmetskilinc/sync-engine#readme","bugs":{"url":"https://github.com/ahmetskilinc/sync-engine/issues"},"dist":{"shasum":"dc2819da82dd36a67d3606793df30441602a4ce8","tarball":"https://registry.npmjs.org/@ahmetskilinc/sync-client/-/sync-client-0.3.0.tgz","fileCount":28,"integrity":"sha512-i0C4Kc64OzPVUaeU+TUkQ1Gu4YJtfVm+j1UB5bs4oURStF2Odht12aC+lg7lAxzztc6S+wCHXs9uskk8YwD3vQ==","signatures":[{"sig":"MEQCIA39Q5rehyH6PhDh15RSfpiuBqbLB2KsIP17mtCJ+RrqAiB+pdrleTW+KTFn9EGxwfBrFjyhqs8lzybeQQbo34aeVQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":95016},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"731047322ef77a734afac45762fbc4ed735a0bad","scripts":{"build":"tsc -b","prepublishOnly":"bunx tsc -b"},"_npmUser":{"name":"ahmetskilinc","email":"ahmetskilinc@icloud.com"},"repository":{"url":"git+https://github.com/ahmetskilinc/sync-engine.git","type":"git","directory":"packages/client"},"_npmVersion":"11.6.2","description":"Local-first client for sync-engine: optimistic transactions, offline queue, rebase, IndexedDB persistence","directories":{},"sideEffects":false,"_nodeVersion":"24.12.0","dependencies":{"@ahmetskilinc/sync-core":"^0.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/sync-client_0.3.0_1785598982535_0.840834441580274","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@ahmetskilinc/sync-client","version":"0.4.0","description":"Local-first client for sync-engine: optimistic transactions, offline queue, rebase, IndexedDB persistence","license":"MIT","type":"module","sideEffects":false,"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"keywords":["sync","realtime","local-first","offline-first","optimistic-ui"],"scripts":{"build":"tsc -b","prepublishOnly":"bunx tsc -b"},"dependencies":{"@ahmetskilinc/sync-core":"^0.4.0"},"repository":{"type":"git","url":"git+https://github.com/ahmetskilinc/sync-engine.git","directory":"packages/client"},"publishConfig":{"access":"public"},"engines":{"node":">=18"},"homepage":"https://github.com/ahmetskilinc/sync-engine#readme","bugs":{"url":"https://github.com/ahmetskilinc/sync-engine/issues"},"author":{"name":"Ahmet Kilinc"},"gitHead":"1bb2539de11edec64b930ee0cb1d362aca50d201","_id":"@ahmetskilinc/sync-client@0.4.0","_nodeVersion":"24.19.0","_npmVersion":"12.0.2","dist":{"integrity":"sha512-O40juQ4pJ7r5GocuXapmbaHLCM8kRT8lWzKwyZyfJclmJXw8lU9pKQ3oLTOFfQWia73hEjnUFgUYUxzYuzMoIw==","shasum":"359e5082773248014ce95c98995caad79007490d","tarball":"https://registry.npmjs.org/@ahmetskilinc/sync-client/-/sync-client-0.4.0.tgz","fileCount":33,"unpackedSize":196499,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAzVTJ0jFo0ed0diJ3IWY4faSFr5ANTPomsgCkOEEoTzAiAEItmRTOShU2MUFfwpTpvnAjSEs2vDVc3Zz1iyCM+1Tw=="}]},"_npmUser":{"name":"ahmetskilinc","email":"ahmetskilinc@icloud.com"},"directories":{},"maintainers":[{"name":"ahmetskilinc","email":"ahmetskilinc@icloud.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sync-client_0.4.0_1787933670429_0.30294364136972174"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-28T15:52:27.260Z","modified":"2026-08-28T16:14:30.775Z","0.1.0":"2026-07-28T15:52:27.700Z","0.2.0":"2026-07-28T16:55:47.372Z","0.2.1":"2026-07-28T17:10:35.361Z","0.3.0":"2026-08-01T15:43:02.675Z","0.4.0":"2026-08-28T16:14:30.587Z"},"bugs":{"url":"https://github.com/ahmetskilinc/sync-engine/issues"},"author":{"name":"Ahmet Kilinc"},"license":"MIT","homepage":"https://github.com/ahmetskilinc/sync-engine#readme","keywords":["sync","realtime","local-first","offline-first","optimistic-ui"],"repository":{"type":"git","url":"git+https://github.com/ahmetskilinc/sync-engine.git","directory":"packages/client"},"description":"Local-first client for sync-engine: optimistic transactions, offline queue, rebase, IndexedDB persistence","maintainers":[{"name":"ahmetskilinc","email":"ahmetskilinc@icloud.com"}],"readme":"# @ahmetskilinc/sync-client\n\nThe client half of [sync-engine](https://github.com/ahmetskilinc/sync-engine): a full local copy of your data, optimistic transactions, a durable offline queue, and automatic rebase of pending writes on top of incoming server state.\n\nEvery read is a synchronous local read — no loading states.\n\n```bash\nnpm install @ahmetskilinc/sync-client @ahmetskilinc/sync-core\n```\n\n```ts\nimport {\n  SyncClient,\n  WebSocketTransport,\n  IndexedDBPersistence,\n} from \"@ahmetskilinc/sync-client\";\nimport { schema, Issue } from \"./schema.js\";\n\nconst client = new SyncClient({\n  schema,\n  transport: new WebSocketTransport(\"wss://sync.example.com\"),\n  persistence: new IndexedDBPersistence(),   // MemoryPersistence by default\n  onTransactionRejected: (id, reason) => console.warn(reason),\n});\n\nawait client.start();\n\n// Synchronous local reads.\nconst issues = client.store.getAll(Issue);\n\n// Optimistic writes — applied locally, queued durably, sent as a delta.\nclient.update(Issue, issueId, { status: \"done\" });\n\n// Several mutations, applied atomically by the server.\nclient.transact((tx) => {\n  tx.create(Issue, { title: \"New\", status: \"todo\", teamId });\n  tx.update(Issue, otherId, { status: \"done\" });\n});\n```\n\n## Behaviour worth knowing\n\n- **Writes are optimistic.** They apply locally at once, persist, and flush when online. `client.hasPendingChanges` tells you whether anything is unconfirmed.\n- **Rejected transactions roll back automatically** and call `onTransactionRejected`. Surface that to the user — the local change disappears otherwise.\n- **Conflicts resolve per property.** Two people editing different fields of one record both win.\n- **Reconnects catch up incrementally**, or re-bootstrap if the client is too far behind the server's sync log. Backoff is exponential with jitter.\n- **`stop()` disconnects; `start()` resumes.** Persisted state (snapshot, queue, sync ID) survives a reload.\n\n## Environment\n\nESM only. The package is safe to import in a server environment, but `start()` needs a WebSocket, and `IndexedDBPersistence` needs a browser — use `MemoryPersistence` elsewhere. Zero runtime dependencies beyond `@ahmetskilinc/sync-core`.\n\n---\n\nFull documentation: [github.com/ahmetskilinc/sync-engine](https://github.com/ahmetskilinc/sync-engine) · Upgrading? See [MIGRATION.md](https://github.com/ahmetskilinc/sync-engine/blob/main/MIGRATION.md)\n\nMIT\n","readmeFilename":"README.md"}