{"_id":"@codehz/sync","_rev":"8-769802d0ff863f5edb96f2f0a024e826","name":"@codehz/sync","dist-tags":{"latest":"0.3.2"},"versions":{"0.1.0":{"name":"@codehz/sync","version":"0.1.0","keywords":["bun","typescript","websocket","sync","realtime"],"_id":"@codehz/sync@0.1.0","maintainers":[{"name":"codehz","email":"CodeHz@Outlook.com"}],"homepage":"https://github.com/codehz/sync#readme","bugs":{"url":"https://github.com/codehz/sync/issues"},"dist":{"shasum":"cf337fbb88fb234410e3d7fb1e41592b5e9a7323","tarball":"https://registry.npmjs.org/@codehz/sync/-/sync-0.1.0.tgz","fileCount":4,"integrity":"sha512-gFI8GWCS/PhfPayVXdC7nxIyWhy3YQHTSTVy+2oTtoU0Xa2SviWhkHNoW+1eR7eVPx7HiB7eW/+oWIMivQQwSA==","signatures":[{"sig":"MEUCIDDmYJbtBzmTWPiP0kvNBjR7EwtlCIkPYiBtEOEwQNBQAiEAriYRkZ57CBc8usAXrJDltJnviuNKRwilf0sDZGToowQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":46765},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","shasum":"cf337fbb88fb234410e3d7fb1e41592b5e9a7323","engines":{"bun":">=1.3.14"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./package.json":"./package.json"},"scripts":{"lint":"eslint .","test":"bun test","build":"tsdown","format":"prettier --write .","prepack":"bun run build","prepare":"husky || exit 0","lint:fix":"eslint . --fix","typecheck":"tsc --noEmit","lint-staged":"lint-staged","format:check":"prettier --check ."},"_npmUser":{"name":"codehz","email":"CodeHz@Outlook.com"},"_integrity":"sha512-gFI8GWCS/PhfPayVXdC7nxIyWhy3YQHTSTVy+2oTtoU0Xa2SviWhkHNoW+1eR7eVPx7HiB7eW/+oWIMivQQwSA==","repository":{"url":"git+https://github.com/codehz/sync.git","type":"git"},"_npmVersion":"10.8.3","description":"A Bun-first TypeScript WebSocket sync library with scoped methods, state, selectors, and streams.","directories":{},"lint-staged":{"*.{js,mjs,cjs,ts,mts,cts}":"eslint --fix","*.{js,mjs,cjs,ts,mts,cts,json,md}":"prettier --write"},"sideEffects":false,"_nodeVersion":"24.3.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.7","eslint":"^10.5.0","tsdown":"^0.22.2","globals":"^17.6.0","prettier":"^3.8.4","@eslint/js":"^10.0.1","@types/bun":"latest","typescript":"^6","lint-staged":"^17.0.7","typescript-eslint":"^8.61.0","prettier-plugin-organize-imports":"^4.3.0"},"_npmOperationalInternal":{"tmp":"tmp/sync_0.1.0_1781542335367_0.048360412849498324","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@codehz/sync","version":"0.1.1","keywords":["bun","typescript","websocket","sync","realtime"],"_id":"@codehz/sync@0.1.1","maintainers":[{"name":"codehz","email":"CodeHz@Outlook.com"}],"homepage":"https://github.com/codehz/sync#readme","bugs":{"url":"https://github.com/codehz/sync/issues"},"dist":{"shasum":"6b5c145875566d47f34a222531ca16d69d9bdfe9","tarball":"https://registry.npmjs.org/@codehz/sync/-/sync-0.1.1.tgz","fileCount":4,"integrity":"sha512-nqVXpGtRQYag7jgU50VUxU0bpJk/4YK+uwGANwSZwlsB4Tk1/opHRrP6kesKlSTPO43XDlAdCm1y3IUo3Ba+gg==","signatures":[{"sig":"MEUCIQDtWXjZ+WAnyqHXF2NF5rw4LtY87aowag/6vjIziIaFRgIgFVJodU0M18YLhR47p9dkHBioKmUyCY31n82tjYeNOZw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":77677},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"bun":">=1.3.14"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./react":{"types":"./dist/react.d.ts","import":"./dist/react.js","default":"./dist/react.js"},"./package.json":"./package.json"},"gitHead":"fefb9fe963a420021f0a2cf04718ea202c38c105","scripts":{"lint":"eslint .","test":"bun test","build":"tsdown","format":"prettier --write .","prepack":"bun run build","prepare":"husky || exit 0","lint:fix":"eslint . --fix","typecheck":"tsc --noEmit","lint-staged":"lint-staged","format:check":"prettier --check ."},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:840d377a-8f98-4606-b895-789cc0ef2120"}},"repository":{"url":"git+https://github.com/codehz/sync.git","type":"git"},"_npmVersion":"11.13.0","description":"A Bun-first TypeScript WebSocket sync library with scoped methods, state, selectors, and streams.","directories":{},"lint-staged":{"*.{js,mjs,cjs,ts,mts,cts}":"eslint --fix","*.{js,mjs,cjs,ts,mts,cts,json,md}":"prettier --write"},"sideEffects":false,"_nodeVersion":"24.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.7","react":"^19.2.7","eslint":"^10.5.0","tsdown":"^0.22.2","globals":"^17.6.0","prettier":"^3.8.4","@eslint/js":"^10.0.1","@types/bun":"latest","typescript":"^6","lint-staged":"^17.0.7","@types/react":"^19.2.17","typescript-eslint":"^8.61.0","react-test-renderer":"^19.2.7","@types/react-test-renderer":"^19.1.0","prettier-plugin-organize-imports":"^4.3.0"},"peerDependencies":{"react":">=18"},"_npmOperationalInternal":{"tmp":"tmp/sync_0.1.1_1781570476846_0.4453805158777706","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@codehz/sync","version":"0.1.2","keywords":["bun","typescript","websocket","sync","realtime"],"_id":"@codehz/sync@0.1.2","maintainers":[{"name":"codehz","email":"CodeHz@Outlook.com"}],"homepage":"https://github.com/codehz/sync#readme","bugs":{"url":"https://github.com/codehz/sync/issues"},"dist":{"shasum":"16659727034b34b2cbdcb3dbf01828764dead2e9","tarball":"https://registry.npmjs.org/@codehz/sync/-/sync-0.1.2.tgz","fileCount":7,"integrity":"sha512-WnIco6EB+ztrHPVoySv1mXX2TCcUDd5udl/pkqF/kf6np2hwx4z6UIYkgH4CZqMrp4YUhl17Yj9DVssUcxHmzg==","signatures":[{"sig":"MEUCIQD05vZSVz7r2wuZk0py3rK++55c+ISy8dwEskleEZRxqAIgVhmUJ5t43VWnkXcpmE8ZVsuhie4GzIXFslwEBgJ1nvo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":85339},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"bun":">=1.3.14"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./react":{"types":"./dist/react.d.ts","import":"./dist/react.js","default":"./dist/react.js"},"./package.json":"./package.json"},"gitHead":"46c4fd7310bb2fa188378393b6995228919544ef","scripts":{"lint":"eslint .","test":"bun test","build":"tsdown","format":"prettier --write .","prepack":"bun run build","prepare":"husky || exit 0","lint:fix":"eslint . --fix","typecheck":"tsc --noEmit","lint-staged":"lint-staged","format:check":"prettier --check ."},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:840d377a-8f98-4606-b895-789cc0ef2120"}},"repository":{"url":"git+https://github.com/codehz/sync.git","type":"git"},"_npmVersion":"11.13.0","description":"A Bun-first TypeScript WebSocket sync library with scoped methods, state, selectors, and streams.","directories":{},"lint-staged":{"*.{js,mjs,cjs,ts,mts,cts}":"eslint --fix","*.{js,mjs,cjs,ts,mts,cts,json,md}":"prettier --write"},"sideEffects":false,"_nodeVersion":"24.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.7","react":"^19.2.7","eslint":"^10.5.0","tsdown":"^0.22.2","globals":"^17.6.0","prettier":"^3.8.4","@eslint/js":"^10.0.1","@types/bun":"latest","typescript":"^6","lint-staged":"^17.0.7","@types/react":"^19.2.17","typescript-eslint":"^8.61.0","react-test-renderer":"^19.2.7","@types/react-test-renderer":"^19.1.0","prettier-plugin-organize-imports":"^4.3.0"},"peerDependencies":{"react":">=18"},"_npmOperationalInternal":{"tmp":"tmp/sync_0.1.2_1781570894568_0.295710489932862","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@codehz/sync","version":"0.1.3","keywords":["bun","typescript","websocket","sync","realtime"],"_id":"@codehz/sync@0.1.3","maintainers":[{"name":"codehz","email":"CodeHz@Outlook.com"}],"homepage":"https://github.com/codehz/sync#readme","bugs":{"url":"https://github.com/codehz/sync/issues"},"dist":{"shasum":"961c443498528ac66360704a0de9fc6d7f1255f6","tarball":"https://registry.npmjs.org/@codehz/sync/-/sync-0.1.3.tgz","fileCount":8,"integrity":"sha512-238ZUpjtIyCwlkbvFgi2zqd66NYZnQNpDZwFqfTa7OZFIKQKRJ3aa8WK/1JX4MVqCqPIvxB6KEbdmZerm8iShA==","signatures":[{"sig":"MEUCIA1XtRn1MC6WD4dQGFQY504H3F/5ldTBnYCfqYUayA4gAiEAuCurlNmX4u3wbRO9516e+XcEuN1N/3diAnTzu3aNu+g=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":125163},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"bun":">=1.3.14"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./react":{"types":"./dist/react.d.ts","import":"./dist/react.js","default":"./dist/react.js"},"./package.json":"./package.json"},"gitHead":"75b21786d06e8adf4782a65b516c5480c2aeee91","scripts":{"lint":"eslint .","test":"bun test","build":"tsdown","format":"prettier --write .","prepack":"bun run build","prepare":"husky || exit 0","lint:fix":"eslint . --fix","typecheck":"tsgo --noEmit --pretty false --noErrorTruncation","lint-staged":"lint-staged","format:check":"prettier --check ."},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:840d377a-8f98-4606-b895-789cc0ef2120"}},"repository":{"url":"git+https://github.com/codehz/sync.git","type":"git"},"_npmVersion":"11.13.0","description":"A Bun-first TypeScript WebSocket sync library with scoped methods, state, selectors, and streams.","directories":{},"lint-staged":{"*.{js,mjs,cjs,ts,mts,cts}":"eslint --fix","*.{js,mjs,cjs,ts,mts,cts,json,md}":"prettier --write"},"sideEffects":false,"_nodeVersion":"24.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.7","react":"^19.2.7","eslint":"^10.5.0","tsdown":"^0.22.2","globals":"^17.6.0","prettier":"^3.8.4","@eslint/js":"^10.0.1","@types/bun":"latest","typescript":"^6","lint-staged":"^17.0.7","@types/react":"^19.2.17","typescript-eslint":"^8.61.0","react-test-renderer":"^19.2.7","@types/react-test-renderer":"^19.1.0","@typescript/native-preview":"^7.0.0-dev.20260615.1","prettier-plugin-organize-imports":"^4.3.0"},"peerDependencies":{"react":">=18"},"_npmOperationalInternal":{"tmp":"tmp/sync_0.1.3_1781575320340_0.31649000196490373","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@codehz/sync","version":"0.2.0","keywords":["bun","typescript","websocket","sync","realtime"],"_id":"@codehz/sync@0.2.0","maintainers":[{"name":"codehz","email":"CodeHz@Outlook.com"}],"homepage":"https://github.com/codehz/sync#readme","bugs":{"url":"https://github.com/codehz/sync/issues"},"dist":{"shasum":"712939f2c80954f81d082fff12f694af1afce13c","tarball":"https://registry.npmjs.org/@codehz/sync/-/sync-0.2.0.tgz","fileCount":8,"integrity":"sha512-qZXpkJy3QUWiJvFzxHASvAxm3dTCKJdsPRQj2qMx7JQ0uX63hMmKAvJkpII5pUfTn95bXwpwn1KPvj8WCygTQg==","signatures":[{"sig":"MEYCIQCbBLsWdb3gKapzel3eKaIHdaytQQs4sKL0viFvO32mEgIhAIcr/LkAiu66XBkZBFejPWQOHwIC2ONrjzf9Kcz0XuKS","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":103960},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"bun":">=1.3.14"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./react":{"types":"./dist/react.d.ts","import":"./dist/react.js","default":"./dist/react.js"},"./package.json":"./package.json"},"gitHead":"9e49150563f2cb6bb6c83e398ff2d9d00b786ad7","scripts":{"lint":"eslint .","test":"bun test","build":"tsdown","format":"prettier --write .","prepack":"bun run build","prepare":"husky || exit 0","lint:fix":"eslint . --fix","typecheck":"tsgo --noEmit --pretty false --noErrorTruncation","lint-staged":"lint-staged","format:check":"prettier --check ."},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:840d377a-8f98-4606-b895-789cc0ef2120"}},"repository":{"url":"git+https://github.com/codehz/sync.git","type":"git"},"_npmVersion":"11.13.0","description":"A Bun-first TypeScript WebSocket sync library with scoped queries, commands, streams, and workflow primitives.","directories":{},"lint-staged":{"*.{js,mjs,cjs,ts,mts,cts}":"eslint --fix","*.{js,mjs,cjs,ts,mts,cts,json,md}":"prettier --write"},"sideEffects":false,"_nodeVersion":"24.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.7","react":"^19.2.7","eslint":"^10.5.0","tsdown":"^0.22.2","globals":"^17.6.0","prettier":"^3.8.4","@eslint/js":"^10.0.1","@types/bun":"latest","typescript":"^6","lint-staged":"^17.0.7","@types/react":"^19.2.17","typescript-eslint":"^8.61.0","react-test-renderer":"^19.2.7","@types/react-test-renderer":"^19.1.0","@typescript/native-preview":"^7.0.0-dev.20260615.1","prettier-plugin-organize-imports":"^4.3.0"},"peerDependencies":{"react":">=18"},"_npmOperationalInternal":{"tmp":"tmp/sync_0.2.0_1781577654105_0.6904977175530811","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@codehz/sync","version":"0.2.1","keywords":["bun","typescript","websocket","sync","realtime"],"_id":"@codehz/sync@0.2.1","maintainers":[{"name":"codehz","email":"CodeHz@Outlook.com"}],"homepage":"https://github.com/codehz/sync#readme","bugs":{"url":"https://github.com/codehz/sync/issues"},"dist":{"shasum":"47c97860bb292c444dba01e2e8bd5036461b811e","tarball":"https://registry.npmjs.org/@codehz/sync/-/sync-0.2.1.tgz","fileCount":8,"integrity":"sha512-qBhWQtYs/Iu4lVAe4gde8OmIAOvFfxc9MX3qsSGh1VLKKas6yGFan2sWEBxM7Fv1wBf+swQJFOmzKZkx0/xRFQ==","signatures":[{"sig":"MEQCIAcrTIwb4Hmn5NGkcWJymAoE1nIH68jDiOkFya26Va9QAiAWMEY9i2fCxMxhtyCHw/ArCK2gHR3ZxVjJ8GuB90o8DA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":169885},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"bun":">=1.3.14"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./react":{"types":"./dist/react.d.ts","import":"./dist/react.js","default":"./dist/react.js"},"./package.json":"./package.json"},"gitHead":"c2c0ad1dfc95e0c1a984e72ad47244326fefe8a9","scripts":{"lint":"eslint .","test":"bun test","build":"tsdown","format":"prettier --write .","prepack":"bun run build","prepare":"husky || exit 0","lint:fix":"eslint . --fix","typecheck":"tsgo --noEmit --pretty false --noErrorTruncation","lint-staged":"lint-staged","format:check":"prettier --check ."},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:840d377a-8f98-4606-b895-789cc0ef2120"}},"repository":{"url":"git+https://github.com/codehz/sync.git","type":"git"},"_npmVersion":"11.13.0","description":"A Bun-first TypeScript WebSocket sync library with scoped queries, commands, streams, and workflow primitives.","directories":{},"lint-staged":{"*.{js,mjs,cjs,ts,mts,cts}":"eslint --fix","*.{js,mjs,cjs,ts,mts,cts,json,md}":"prettier --write"},"sideEffects":false,"_nodeVersion":"24.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.7","react":"^19.2.7","eslint":"^10.5.0","tsdown":"^0.22.2","globals":"^17.6.0","prettier":"^3.8.4","@eslint/js":"^10.0.1","@types/bun":"latest","typescript":"^6","lint-staged":"^17.0.7","@types/react":"^19.2.17","typescript-eslint":"^8.61.0","react-test-renderer":"^19.2.7","@types/react-test-renderer":"^19.1.0","@typescript/native-preview":"^7.0.0-dev.20260615.1","prettier-plugin-organize-imports":"^4.3.0"},"peerDependencies":{"react":">=18"},"_npmOperationalInternal":{"tmp":"tmp/sync_0.2.1_1781587618232_0.6539566130745891","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@codehz/sync","version":"0.3.0","keywords":["bun","typescript","websocket","sync","realtime"],"_id":"@codehz/sync@0.3.0","maintainers":[{"name":"codehz","email":"CodeHz@Outlook.com"}],"homepage":"https://github.com/codehz/sync#readme","bugs":{"url":"https://github.com/codehz/sync/issues"},"dist":{"shasum":"25848b6063329e3e1dfd1c2db31c853e1bd7fecb","tarball":"https://registry.npmjs.org/@codehz/sync/-/sync-0.3.0.tgz","fileCount":8,"integrity":"sha512-cQoKUJkmzi349e6YwTxM9e5Oc0Joi6a1Mexfsfcaw1/QCHMHtKcIGfA/hRghepsQrNC0pgGAH8tnbmSJo/PRDw==","signatures":[{"sig":"MEUCIGwF9nBAK3b3jcGtt0mMITM9Y9fFf5E+VNs8XPJp/f93AiEA7MF3OUXWEvkCmhPjGK9bfBrNFN3p1P5EJDk4BjYSGEc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":152287},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"bun":">=1.3.14"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./react":{"types":"./dist/react.d.ts","import":"./dist/react.js","default":"./dist/react.js"},"./package.json":"./package.json"},"gitHead":"d085816b2953997db71b9df901ec001e810c9bbe","scripts":{"lint":"eslint .","test":"bun test","build":"tsdown","format":"prettier --write .","prepack":"bun run build","prepare":"husky || exit 0","lint:fix":"eslint . --fix","typecheck":"tsgo --noEmit --pretty false --noErrorTruncation","lint-staged":"lint-staged","format:check":"prettier --check ."},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:840d377a-8f98-4606-b895-789cc0ef2120"}},"repository":{"url":"git+https://github.com/codehz/sync.git","type":"git"},"_npmVersion":"11.13.0","description":"A Bun-first TypeScript WebSocket sync library with scoped queries, commands, streams, and workflow primitives.","directories":{},"lint-staged":{"*.{js,mjs,cjs,ts,mts,cts}":"eslint --fix","*.{js,mjs,cjs,ts,mts,cts,json,md}":"prettier --write"},"sideEffects":false,"_nodeVersion":"24.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.7","react":"^19.2.7","eslint":"^10.5.0","tsdown":"^0.22.2","globals":"^17.6.0","prettier":"^3.8.4","@eslint/js":"^10.0.1","@types/bun":"latest","typescript":"^6","lint-staged":"^17.0.7","@types/react":"^19.2.17","typescript-eslint":"^8.61.0","react-test-renderer":"^19.2.7","@types/react-test-renderer":"^19.1.0","@typescript/native-preview":"^7.0.0-dev.20260615.1","prettier-plugin-organize-imports":"^4.3.0"},"peerDependencies":{"react":">=18"},"_npmOperationalInternal":{"tmp":"tmp/sync_0.3.0_1781590012694_0.7419092750390865","host":"s3://npm-registry-packages-npm-production"}},"0.3.2":{"name":"@codehz/sync","version":"0.3.2","description":"A Bun-first TypeScript WebSocket sync library with scoped queries, commands, streams, and workflow primitives.","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./react":{"types":"./dist/react.d.ts","import":"./dist/react.js","default":"./dist/react.js"},"./package.json":"./package.json"},"sideEffects":false,"repository":{"type":"git","url":"git+https://github.com/codehz/sync.git"},"bugs":{"url":"https://github.com/codehz/sync/issues"},"homepage":"https://github.com/codehz/sync#readme","keywords":["bun","typescript","websocket","sync","realtime"],"publishConfig":{"access":"public"},"peerDependencies":{"react":">=18"},"engines":{"bun":">=1.3.14"},"scripts":{"build":"tsdown","prepack":"bun run build","prepare":"husky || exit 0","format":"prettier --write .","format:check":"prettier --check .","lint":"eslint .","lint:fix":"eslint . --fix","lint-staged":"lint-staged","test":"bun test","typecheck":"tsgo --noEmit --pretty false --noErrorTruncation"},"lint-staged":{"*.{js,mjs,cjs,ts,mts,cts,json,md}":"prettier --write","*.{js,mjs,cjs,ts,mts,cts}":"eslint --fix"},"devDependencies":{"@eslint/js":"^10.0.1","@happy-dom/global-registrator":"^20.10.4","@testing-library/react":"^16.3.2","@types/bun":"latest","@types/react":"^19.2.17","@typescript/native-preview":"^7.0.0-dev.20260615.1","eslint":"^10.5.0","globals":"^17.6.0","husky":"^9.1.7","lint-staged":"^17.0.7","prettier":"^3.8.4","prettier-plugin-organize-imports":"^4.3.0","react":"^19.2.7","tsdown":"^0.22.2","typescript":"^6","typescript-eslint":"^8.61.0"},"gitHead":"e7d70b2deb4cf335e799d9ece5de58922bff338d","_id":"@codehz/sync@0.3.2","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-ZfWU7GPXSayMtt7FFw67w4LAd+ZyQYhLQMrssmo6w+KanfdE4xKhh93Z0t4WjY9yQLWwzJXnN5NYwp5NrOoz/g==","shasum":"87fee708164ec738b8f49f2e5cd8562e7e349897","tarball":"https://registry.npmjs.org/@codehz/sync/-/sync-0.3.2.tgz","fileCount":8,"unpackedSize":199503,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDSKMxDA07YY9C9Wa84fE0jVSqPlf9Mzrg7KbqKnpyUqwIgOzXZkugjX3il3/g0dxH/OE3TvZbz5Bs0W0al7Mc19XQ="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:840d377a-8f98-4606-b895-789cc0ef2120"}},"directories":{},"maintainers":[{"name":"codehz","email":"CodeHz@Outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sync_0.3.2_1781617550719_0.5987200753698074"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-15T16:52:14.694Z","modified":"2026-06-16T13:45:50.944Z","0.1.0":"2026-06-15T16:52:15.494Z","0.1.1":"2026-06-16T00:41:16.972Z","0.1.2":"2026-06-16T00:48:14.698Z","0.1.3":"2026-06-16T02:02:00.483Z","0.2.0":"2026-06-16T02:40:54.292Z","0.2.1":"2026-06-16T05:26:58.390Z","0.3.0":"2026-06-16T06:06:52.833Z","0.3.2":"2026-06-16T13:45:50.859Z"},"bugs":{"url":"https://github.com/codehz/sync/issues"},"homepage":"https://github.com/codehz/sync#readme","keywords":["bun","typescript","websocket","sync","realtime"],"repository":{"type":"git","url":"git+https://github.com/codehz/sync.git"},"description":"A Bun-first TypeScript WebSocket sync library with scoped queries, commands, streams, and workflow primitives.","maintainers":[{"name":"codehz","email":"CodeHz@Outlook.com"}],"readme":"# @codehz/sync\n\n`@codehz/sync` 是一个 Bun-only、TypeScript-first 的 WebSocket 同步库。\n\n当前版本围绕 WebSocket 会话模型和一个对话预设组织：\n\n- `invoke`：统一读写订阅协议（query / command / action / snapshot / stream）\n- `action`：单次启动、可发事件、可取消、最终只返回一个终态结果的写操作\n- `conversation`：AI 多轮对话预设（start / resume / submitInput / abort + output 流）\n\n## 安装\n\n```bash\nbun add @codehz/sync\n```\n\n## 核心模型\n\n服务端定义 sync 树，客户端通过 WebSocket 访问 scope 实例。\n\n```ts\nimport {\n  createBunSyncServer,\n  createClient,\n  createSync,\n  defineAction,\n  defineCommand,\n  defineConversationScope,\n  defineScope,\n  invalidateTag,\n  query,\n  scope,\n  stream,\n} from \"@codehz/sync\";\n```\n\n## 服务端示例\n\n```ts\nconst jobs = new Map<string, JobState>();\n\nconst sync = createSync({\n  root: defineScope({\n    snapshot: () => ({ online: true }),\n    queries: {\n      online: query<boolean>({ read: async () => true }),\n    },\n    commands: {\n      identify: async () => ({ scope: \"root\" as const }),\n    },\n  }),\n  scopes: {\n    job: scope<{ id: string }>()(\n      defineConversationScope({\n        snapshot: ({ id }) => jobs.get(id)!,\n        commands: {\n          start: defineCommand(async ({ id }, input: { prompt: string }) => {\n            const job = jobs.get(id)!;\n            job.status = \"running\";\n            await syncServer.publishScope({ name: \"job\", params: { id } });\n            return { accepted: true };\n          }),\n          submitInput: defineCommand(\n            async ({ id }, input: { approved: boolean }) => {\n              const job = jobs.get(id)!;\n              job.status = \"completed\";\n              job.inputRequest = undefined;\n              job.result = {\n                output: input.approved ? \"approved\" : \"rejected\",\n              };\n              await syncServer.publishScope({ name: \"job\", params: { id } });\n              return job.result;\n            }\n          ),\n        },\n        streams: {\n          lifecycle: stream<{ type: string }, number, { id: string }>({\n            replay: ({ id }, _ctx, from) => ({\n              items: (jobEvents.get(id) ?? []).filter((item) =>\n                from === null ? true : item.cursor > from\n              ),\n              nextCursor: null,\n            }),\n          }),\n          output: stream<{ delta: string }, number, { id: string }>(),\n        },\n      })\n    ),\n  },\n});\n\nconst syncServer = createBunSyncServer(sync);\n\nBun.serve({\n  port: 3000,\n  routes: {\n    \"/sync/v1\": syncServer.fetch,\n    \"/*\": new Response(\"Not Found\", { status: 404 }),\n  },\n  websocket: syncServer.websocket,\n});\n```\n\n## Dependency Tags\n\n读侧 resolver 现在接收 `ctx` 对象：\n\n- `ctx.context`：应用自己的 request/context 数据\n- `ctx.watchTag([...])`：声明本次读取依赖的语义 tag\n\n```ts\nconst sync = createSync({\n  root: defineScope({\n    snapshot: (_params, ctx) => {\n      ctx.watchTag([\"catalog\"]);\n      return { count: items.size };\n    },\n    queries: {\n      detail: query<{ id: string; label: string }, { id: string }>({\n        read: (_params, ctx, input) => {\n          ctx.watchTag([\"entity\", input.id]);\n          return items.get(input.id)!;\n        },\n      }),\n    },\n    commands: {\n      rename: defineCommand(\n        async (_params, input: { id: string; label: string }) => {\n          items.get(input.id)!.label = input.label;\n          return { id: input.id };\n        },\n        {\n          invalidate: [invalidateTag((_params, input) => [\"entity\", input.id])],\n        }\n      ),\n    },\n  }),\n  scopes: {},\n});\n\nawait syncServer.publishTag([\"entity\", \"item_1\"]);\n```\n\n## Action 模型\n\n`defineAction(...)` 适合“由客户端启动，但执行过程中需要回传进度/领域事件”的写操作。\n\n可恢复 action 通过 `recoverable: true` 开启。客户端用 `clientActionKey`\n避免重复启动，并可在重连后继续恢复同一个 action 实例。\n\n```ts\nconst sync = createSync({\n  root: defineScope({\n    snapshot: () => ({ ready: true }),\n    actions: {\n      generate: defineAction({\n        recoverable: true,\n        run: async (_params, input: { prompt: string }, ctx) => {\n          ctx.emit({ type: \"started\" });\n          ctx.emit({ type: \"progress\", value: input.prompt });\n          return {\n            output: input.prompt.toUpperCase(),\n          };\n        },\n        invalidateTags: [(_params, _input, result) => [\"job\", result.output]],\n      }),\n    },\n  }),\n  scopes: {},\n});\n\nconst run = client\n  .root()\n  .actions.generate.start(\n    { prompt: \"hello\" },\n    { clientActionKey: \"draft:42:submit:3\" }\n  );\n\nfor await (const event of run) {\n  console.log(event.event);\n}\n\nconsole.log(run.getActionInstanceId());\nconsole.log(await run.result);\n```\n\n`createBunSyncServer(sync)` 默认启用进程内 recoverable action store。需要自定义保留策略或持久化时，可传入：\n\n```ts\nconst syncServer = createBunSyncServer(sync, {\n  actionStore: createInMemoryActionStore({\n    completedRetentionMs: 300_000,\n  }),\n});\n```\n\n## 客户端示例\n\n```ts\nconst client = createClient<typeof sync>({\n  url: \"ws://127.0.0.1:3000/api/rpc\",\n  definition: sync,\n});\n\nconst conv = client.conversation(\"job\", { id: \"job_123\" });\n\nawait conv.start({ prompt: \"hello\" });\n\nconst statusSource = conv.queries.status.source();\nawait statusSource.ensure();\n\nawait conv.submitInput({ approved: true });\nconsole.log(await conv.queries.result.source().ensure());\n\nfor await (const item of conv.streams.lifecycle.subscribe()) {\n  console.log(item.cursor, item.event);\n}\n\nclient.close();\n```\n\n## Conversation 模型\n\n`defineConversationScope(...)` 为 AI 对话提供标准约束：\n\n- 生命周期：`pending` / `running` / `awaiting_input` / `completed` / `failed` / `cancelled`\n- 控制：`start` / `abort` / `resume` / `submitInput`\n- 标准查询：`status` / `result` / `error` / `inputRequest` / `checkpoint` / `capabilities`\n- 事件流：`streams.lifecycle`（生命周期）+ `streams.output`（turn 内 token/delta）\n\n`capabilities` 由服务端根据当前 snapshot 计算，React 与原生 client 行为一致。\n标准布尔字段保持稳定，领域扩展数据放在 `capabilities.domain`。\n\n```ts\ndefineConversationScope({\n  snapshot: ({ id }) => jobs.get(id)!,\n  conversation: {\n    resolveCapabilities: (snapshot, { defaults, params }) => ({\n      ...defaults,\n      canAbort: false,\n      domain: {\n        scopeId: params.id,\n        hasCheckpoint: snapshot.checkpoint !== undefined,\n      },\n    }),\n  },\n  commands: {\n    start: defineCommand(async () => ({ accepted: true })),\n  },\n  streams: {\n    lifecycle: stream<{ type: string }, number, { id: string }>({}),\n  },\n});\n```\n\n## React 集成\n\n```ts\nimport { createQueryClient } from \"@codehz/sync\";\nimport {\n  useAction,\n  useConversation,\n  useManagedQuery,\n  useMutation,\n} from \"@codehz/sync/react\";\n\nconst controller = useConversation(conv, {\n  channels: {\n    lifecycle: {\n      initialReduced: 0,\n      reduce: (count: number) => count + 1,\n    },\n  },\n  resume: {\n    key: \"job:job_123\",\n    storage: localStorage,\n  },\n});\n\nconst queryClient = createQueryClient();\nconst statusQuery = queryClient.query(client.root().queries.online.source());\nconst status = useManagedQuery(statusQuery, { client: queryClient });\n\nconst rename = useMutation(client.root().commands.identify, {\n  onMutate(tx) {\n    const previous = tx.get(statusQuery);\n    tx.set(statusQuery, true);\n    return { previous };\n  },\n  onError(_error, ctx) {\n    console.log(\"rollback context\", ctx.previous);\n  },\n});\n\nconst generate = useAction(client.root().actions.generate, {\n  onMutate(tx, input) {\n    tx.set(statusQuery, false);\n    return { input };\n  },\n  onEvent(event) {\n    console.log(event.event);\n  },\n});\n\nawait rename.execute();\nawait generate.startAsync({ prompt: \"hello\" });\n```\n\n## 参考文档\n\n- [设计说明](./DESIGN.md)\n- [建模模式](./docs/reference-patterns.md)\n","readmeFilename":"README.md"}