{"_id":"@convex-dev/sharded-counter","_rev":"25-ebc58fc268fd06486f6160280dd7bcff","name":"@convex-dev/sharded-counter","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.1":{"name":"@convex-dev/sharded-counter","version":"0.1.1","keywords":["convex","count","component"],"license":"Apache-2.0","_id":"@convex-dev/sharded-counter@0.1.1","maintainers":[{"name":"ianatconvex","email":"ian@convex.dev"},{"name":"pashabitz","email":"pavelbitz@gmail.com"},{"name":"jordanhunt","email":"jordan@convex.dev"},{"name":"ldanilek","email":"iwork96+npm@gmail.com"},{"name":"sshader","email":"sarah@convex.dev"},{"name":"arnoldtrakh","email":"arnold@convex.dev"},{"name":"ballingt","email":"thomasballinger@gmail.com"},{"name":"emmaling27","email":"emma@convex.dev"},{"name":"ikhare","email":"ikhare@convex.dev"},{"name":"sujayakar","email":"sujayakar@convex.dev"},{"name":"nipunn","email":"nipunn1313@gmail.com"},{"name":"gautamg795","email":"gautam@convex.dev"},{"name":"cowling","email":"james@convex.dev"}],"homepage":"https://github.com/get-convex/sharded-counter#readme","bugs":{"url":"https://github.com/get-convex/sharded-counter/issues","email":"support@convex.dev"},"dist":{"shasum":"ef35bca551c10f33be8f0ab43c040465e9880899","tarball":"https://registry.npmjs.org/@convex-dev/sharded-counter/-/sharded-counter-0.1.1.tgz","fileCount":63,"integrity":"sha512-KSdfdHRDY2FrJ7OtEdFffXiTN0OxOZ+8W//mgX6vFOz/0mdsAH/HYyetwEN56jzOBURdBT1rVlHCiaL70e49cg==","signatures":[{"sig":"MEUCIAxfEEqf+Xl/SvbjP5tC+2bN7JC31eI9qiIiwc+zf8wFAiEAmwtZieB1iaD5V9Cy446Eta3FvErzUp7PBFfFqevOPaU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":83945},"main":"./dist/commonjs/client/index.js","type":"module","types":"./dist/commonjs/client/index.d.ts","module":"./dist/esm/client/index.js","exports":{".":{"import":{"types":"./dist/esm/client/index.d.ts","default":"./dist/esm/client/index.js","@convex-dev/component-source":"./src/client/index.ts"},"require":{"types":"./dist/commonjs/client/index.d.ts","default":"./dist/commonjs/client/index.js","@convex-dev/component-source":"./src/client/index.ts"}},"./package.json":"./package.json","./convex.config":{"import":{"types":"./dist/esm/component/convex.config.d.ts","default":"./dist/esm/component/convex.config.js","@convex-dev/component-source":"./src/component/convex.config.ts"}}},"gitHead":"7472fd1f6325068bbd8a9a4d888bbd12c1a1de1e","scripts":{"dev":"cd example; npm run dev","test":"vitest run","build":"npm run build:esm && npm run build:cjs","prepack":"node node10stubs.mjs","prepare":"npm run build","postpack":"node node10stubs.mjs --cleanup","build:cjs":"tsc --project ./commonjs.json && echo '{\\n  \"type\": \"commonjs\"\\n}' > dist/commonjs/package.json","build:esm":"tsc --project ./esm.json && echo '{\\n  \"type\": \"module\"\\n}' > dist/esm/package.json","typecheck":"tsc --noEmit","test:debug":"vitest --inspect-brk --no-file-parallelism","test:coverage":"vitest run --coverage --coverage.reporter=text"},"_npmUser":{"name":"ldanilek","email":"iwork96+npm@gmail.com"},"repository":{"url":"git+https://github.com/get-convex/sharded-counter.git","type":"git"},"_npmVersion":"9.8.1","description":"A sharded counter component for Convex.","directories":{},"_nodeVersion":"18.18.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.9.1","vitest":"^2.1.1","globals":"^15.9.0","prettier":"3.2.5","@eslint/js":"^9.9.1","typescript":"~5.0.3","@types/node":"^18.17.0","convex-test":"^0.0.31","typescript-eslint":"^8.4.0","@fast-check/vitest":"^0.1.3"},"peerDependencies":{"convex":"^1.16.4"},"_npmOperationalInternal":{"tmp":"tmp/sharded-counter_0.1.1_1729116865564_0.5532182316039098","host":"s3://npm-registry-packages"}},"0.1.2":{"name":"@convex-dev/sharded-counter","version":"0.1.2","keywords":["convex","count","component"],"license":"Apache-2.0","_id":"@convex-dev/sharded-counter@0.1.2","maintainers":[{"name":"aritrakh","email":"aritrakh@gmail.com"},{"name":"ianatconvex","email":"ian@convex.dev"},{"name":"pashabitz","email":"pavelbitz@gmail.com"},{"name":"jordanhunt","email":"jordan@convex.dev"},{"name":"ldanilek","email":"iwork96+npm@gmail.com"},{"name":"sshader","email":"sarah@convex.dev"},{"name":"ballingt","email":"thomasballinger@gmail.com"},{"name":"emmaling27","email":"emma@convex.dev"},{"name":"ikhare","email":"ikhare@convex.dev"},{"name":"sujayakar","email":"sujayakar@convex.dev"},{"name":"nipunn","email":"nipunn1313@gmail.com"},{"name":"gautamg795","email":"gautam@convex.dev"},{"name":"cowling","email":"james@convex.dev"}],"homepage":"https://github.com/get-convex/sharded-counter#readme","bugs":{"url":"https://github.com/get-convex/sharded-counter/issues","email":"support@convex.dev"},"dist":{"shasum":"20de0c3afafd77b08b30fd4032b94fd04f010002","tarball":"https://registry.npmjs.org/@convex-dev/sharded-counter/-/sharded-counter-0.1.2.tgz","fileCount":63,"integrity":"sha512-O3Ybz29u//XOZJjrRvwtmKMSsdSVc9LxWmVsks2G5/NXFNee7NFbqcMTk1yPmLQOYAzoB0rVQmdE1wnDXpMEFg==","signatures":[{"sig":"MEUCIQC6TpoAOAlyXu70aoOBNx/Fk14YvNyMmLjid/dAQVCoJQIgYYThI82nZv7CLp0Z6Zv0NakPAPohdcqxNdNXUt7yeCo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":91854},"main":"./dist/commonjs/client/index.js","type":"module","types":"./dist/commonjs/client/index.d.ts","module":"./dist/esm/client/index.js","exports":{".":{"import":{"types":"./dist/esm/client/index.d.ts","default":"./dist/esm/client/index.js","@convex-dev/component-source":"./src/client/index.ts"},"require":{"types":"./dist/commonjs/client/index.d.ts","default":"./dist/commonjs/client/index.js","@convex-dev/component-source":"./src/client/index.ts"}},"./package.json":"./package.json","./convex.config":{"import":{"types":"./dist/esm/component/convex.config.d.ts","default":"./dist/esm/component/convex.config.js","@convex-dev/component-source":"./src/component/convex.config.ts"}}},"gitHead":"c5f7b5c2c1795a448ceb517762bf28b410e1e0bf","scripts":{"dev":"cd example; npm run dev","test":"vitest run","build":"npm run build:esm && npm run build:cjs","prepare":"npm run build","build:cjs":"tsc --project ./commonjs.json && echo '{\\n  \"type\": \"commonjs\"\\n}' > dist/commonjs/package.json","build:esm":"tsc --project ./esm.json && echo '{\\n  \"type\": \"module\"\\n}' > dist/esm/package.json","typecheck":"tsc --noEmit","test:debug":"vitest --inspect-brk --no-file-parallelism","test:coverage":"vitest run --coverage --coverage.reporter=text"},"_npmUser":{"name":"sujayakar","email":"sujayakar@convex.dev"},"repository":{"url":"git+https://github.com/get-convex/sharded-counter.git","type":"git"},"_npmVersion":"9.8.1","description":"A sharded counter component for Convex.","directories":{},"_nodeVersion":"18.18.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.9.1","vitest":"^2.1.1","globals":"^15.9.0","prettier":"3.2.5","@eslint/js":"^9.9.1","typescript":"~5.0.3","@types/node":"^18.17.0","convex-test":"^0.0.31","typescript-eslint":"^8.4.0","@fast-check/vitest":"^0.1.3"},"peerDependencies":{"convex":"~1.16.5 || ~1.17.0"},"_npmOperationalInternal":{"tmp":"tmp/sharded-counter_0.1.2_1729213219493_0.3365726959124362","host":"s3://npm-registry-packages"}},"0.1.3":{"name":"@convex-dev/sharded-counter","version":"0.1.3","keywords":["convex","count","component"],"license":"Apache-2.0","_id":"@convex-dev/sharded-counter@0.1.3","maintainers":[{"name":"aritrakh","email":"aritrakh@gmail.com"},{"name":"ianatconvex","email":"ian@convex.dev"},{"name":"pashabitz","email":"pavelbitz@gmail.com"},{"name":"jordanhunt","email":"jordan@convex.dev"},{"name":"ldanilek","email":"iwork96+npm@gmail.com"},{"name":"sshader","email":"sarah@convex.dev"},{"name":"ballingt","email":"thomasballinger@gmail.com"},{"name":"emmaling27","email":"emma@convex.dev"},{"name":"ikhare","email":"ikhare@convex.dev"},{"name":"sujayakar","email":"sujayakar@convex.dev"},{"name":"nipunn","email":"nipunn1313@gmail.com"},{"name":"gautamg795","email":"gautam@convex.dev"},{"name":"cowling","email":"james@convex.dev"}],"homepage":"https://github.com/get-convex/sharded-counter#readme","bugs":{"url":"https://github.com/get-convex/sharded-counter/issues","email":"support@convex.dev"},"dist":{"shasum":"43a982e8529a2aa81c72cc09c81230938f2583c9","tarball":"https://registry.npmjs.org/@convex-dev/sharded-counter/-/sharded-counter-0.1.3.tgz","fileCount":63,"integrity":"sha512-xUphryWW07Z3smdh2e7teXjd/rmGdsCbNsYnB1plyTFkdtr06WOfYoiHtSB67mU22VYARcVc8FdPyLDtxgduEA==","signatures":[{"sig":"MEUCIGzG+9mSSffLsnq1qlL0Aj9Z7NwbIQXx6I4evRPGbG2+AiEA4ZFQ19BHCm5u3bwnuCmkV08zjURLGWtwntZfOr1ydzU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":91616},"main":"./dist/commonjs/client/index.js","type":"module","types":"./dist/commonjs/client/index.d.ts","module":"./dist/esm/client/index.js","exports":{".":{"import":{"types":"./dist/esm/client/index.d.ts","default":"./dist/esm/client/index.js","@convex-dev/component-source":"./src/client/index.ts"},"require":{"types":"./dist/commonjs/client/index.d.ts","default":"./dist/commonjs/client/index.js","@convex-dev/component-source":"./src/client/index.ts"}},"./package.json":"./package.json","./convex.config":{"import":{"types":"./dist/esm/component/convex.config.d.ts","default":"./dist/esm/component/convex.config.js","@convex-dev/component-source":"./src/component/convex.config.ts"}}},"gitHead":"8d81668ee87d2f9eb327b1f2f72ea822913926f9","scripts":{"dev":"cd example; npm run dev","test":"vitest run","build":"npm run build:esm && npm run build:cjs","prepare":"npm run build","build:cjs":"tsc --project ./commonjs.json && echo '{\\n  \"type\": \"commonjs\"\\n}' > dist/commonjs/package.json","build:esm":"tsc --project ./esm.json && echo '{\\n  \"type\": \"module\"\\n}' > dist/esm/package.json","typecheck":"tsc --noEmit","test:debug":"vitest --inspect-brk --no-file-parallelism","test:coverage":"vitest run --coverage --coverage.reporter=text"},"_npmUser":{"name":"sujayakar","email":"sujayakar@convex.dev"},"repository":{"url":"git+https://github.com/get-convex/sharded-counter.git","type":"git"},"_npmVersion":"9.8.1","description":"A sharded counter component for Convex.","directories":{},"_nodeVersion":"18.18.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.9.1","vitest":"^2.1.1","globals":"^15.9.0","prettier":"3.2.5","@eslint/js":"^9.9.1","typescript":"~5.0.3","@types/node":"^18.17.0","convex-test":"^0.0.31","typescript-eslint":"^8.4.0","@fast-check/vitest":"^0.1.3"},"peerDependencies":{"convex":"~1.16.5 || ~1.17.0"},"_npmOperationalInternal":{"tmp":"tmp/sharded-counter_0.1.3_1729542052047_0.07243717558362284","host":"s3://npm-registry-packages"}},"0.1.4":{"name":"@convex-dev/sharded-counter","version":"0.1.4","keywords":["convex","count","component"],"license":"Apache-2.0","_id":"@convex-dev/sharded-counter@0.1.4","maintainers":[{"name":"aritrakh","email":"aritrakh@gmail.com"},{"name":"ianatconvex","email":"ian@convex.dev"},{"name":"pashabitz","email":"pavelbitz@gmail.com"},{"name":"jordanhunt","email":"jordan@convex.dev"},{"name":"ldanilek","email":"iwork96+npm@gmail.com"},{"name":"sshader","email":"sarah@convex.dev"},{"name":"ballingt","email":"thomasballinger@gmail.com"},{"name":"emmaling27","email":"emma@convex.dev"},{"name":"ikhare","email":"ikhare@convex.dev"},{"name":"sujayakar","email":"sujayakar@convex.dev"},{"name":"nipunn","email":"nipunn1313@gmail.com"},{"name":"gautamg795","email":"gautam@convex.dev"},{"name":"cowling","email":"james@convex.dev"}],"homepage":"https://github.com/get-convex/sharded-counter#readme","bugs":{"url":"https://github.com/get-convex/sharded-counter/issues","email":"support@convex.dev"},"dist":{"shasum":"9dea91efb05578eae098751c6805ed366de3c3fd","tarball":"https://registry.npmjs.org/@convex-dev/sharded-counter/-/sharded-counter-0.1.4.tgz","fileCount":63,"integrity":"sha512-UAgMihAiLIzXh5oiGiX/IHye8MS2R3VfTjPrAcXaOFX9CeWWvTvIX/8oFkgaeH51gt00X43lFbINwdPLThrRRQ==","signatures":[{"sig":"MEUCIQCR+82VIPjwcMrUYKS5Pe2tatmt/EbFzAaXuUzOaySD5wIgI3KW/rMzdGDbWE7S3TuRuLpAHUpLKvQSnNumqIjrLyk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":131930},"main":"./dist/commonjs/client/index.js","type":"module","types":"./dist/commonjs/client/index.d.ts","module":"./dist/esm/client/index.js","exports":{".":{"import":{"types":"./dist/esm/client/index.d.ts","default":"./dist/esm/client/index.js","@convex-dev/component-source":"./src/client/index.ts"},"require":{"types":"./dist/commonjs/client/index.d.ts","default":"./dist/commonjs/client/index.js","@convex-dev/component-source":"./src/client/index.ts"}},"./package.json":"./package.json","./convex.config":{"import":{"types":"./dist/esm/component/convex.config.d.ts","default":"./dist/esm/component/convex.config.js","@convex-dev/component-source":"./src/component/convex.config.ts"}}},"gitHead":"0f604b5ff9c27b1c6a7523c1ff8cab8cfca52949","scripts":{"dev":"cd example; npm run dev","test":"vitest run","build":"npm run build:esm && npm run build:cjs","prepare":"npm run build","build:cjs":"tsc --project ./commonjs.json && echo '{\\n  \"type\": \"commonjs\"\\n}' > dist/commonjs/package.json","build:esm":"tsc --project ./esm.json && echo '{\\n  \"type\": \"module\"\\n}' > dist/esm/package.json","typecheck":"tsc --noEmit","test:debug":"vitest --inspect-brk --no-file-parallelism","test:coverage":"vitest run --coverage --coverage.reporter=text"},"_npmUser":{"name":"ldanilek","email":"iwork96+npm@gmail.com"},"repository":{"url":"git+https://github.com/get-convex/sharded-counter.git","type":"git"},"_npmVersion":"9.8.1","description":"A sharded counter component for Convex.","directories":{},"_nodeVersion":"18.18.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.9.1","vitest":"^2.1.1","globals":"^15.9.0","prettier":"3.2.5","@eslint/js":"^9.9.1","typescript":"~5.0.3","@types/node":"^18.17.0","convex-test":"^0.0.31","typescript-eslint":"^8.4.0","@fast-check/vitest":"^0.1.3"},"peerDependencies":{"convex":"~1.16.5 || ~1.17.0"},"_npmOperationalInternal":{"tmp":"tmp/sharded-counter_0.1.4_1729561378310_0.3445371719722572","host":"s3://npm-registry-packages"}},"0.1.5":{"name":"@convex-dev/sharded-counter","version":"0.1.5","keywords":["convex","count","component"],"license":"Apache-2.0","_id":"@convex-dev/sharded-counter@0.1.5","maintainers":[{"name":"cowling","email":"james@convex.dev"},{"name":"jordanhunt","email":"jordan@convex.dev"},{"name":"gautamg795","email":"gautam@convex.dev"},{"name":"emmaling27","email":"emma@convex.dev"},{"name":"nipunn","email":"nipunn1313@gmail.com"},{"name":"sujayakar","email":"sujayakar@convex.dev"},{"name":"ikhare","email":"ikhare@convex.dev"},{"name":"ldanilek","email":"iwork96+npm@gmail.com"},{"name":"ballingt","email":"thomasballinger@gmail.com"},{"name":"sshader","email":"sarah@convex.dev"},{"name":"aritrakh","email":"aritrakh@gmail.com"},{"name":"ianatconvex","email":"ian@convex.dev"},{"name":"pashabitz","email":"pavelbitz@gmail.com"}],"homepage":"https://github.com/get-convex/sharded-counter#readme","bugs":{"url":"https://github.com/get-convex/sharded-counter/issues","email":"support@convex.dev"},"dist":{"shasum":"e34cb3f68faea1ca34546798b14d34e84b7adcb5","tarball":"https://registry.npmjs.org/@convex-dev/sharded-counter/-/sharded-counter-0.1.5.tgz","fileCount":63,"integrity":"sha512-73uPJTe3+DPKekeU75DE+jIfILykEZKt9X/19IHEm0Q6D5Cofol6C2cH63IDforMIYvMN5JFHpW/XXNKuSr1Vw==","signatures":[{"sig":"MEQCIFQzJl/yA1WEMaVSvwfxCW3biUUEWdVPebRXkIeHlCMVAiB9uZCnaSzQS/ySLqSj8an3tFkWGbu1NXhJs1yem5VwnQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":139643},"main":"./dist/commonjs/client/index.js","type":"module","types":"./dist/commonjs/client/index.d.ts","module":"./dist/esm/client/index.js","exports":{".":{"import":{"types":"./dist/esm/client/index.d.ts","default":"./dist/esm/client/index.js","@convex-dev/component-source":"./src/client/index.ts"},"require":{"types":"./dist/commonjs/client/index.d.ts","default":"./dist/commonjs/client/index.js","@convex-dev/component-source":"./src/client/index.ts"}},"./package.json":"./package.json","./convex.config":{"import":{"types":"./dist/esm/component/convex.config.d.ts","default":"./dist/esm/component/convex.config.js","@convex-dev/component-source":"./src/component/convex.config.ts"}}},"gitHead":"763ccea48941140c948f662aa98e8e2145715a53","scripts":{"dev":"cd example; npm run dev","test":"vitest","build":"npm run build:esm && npm run build:cjs","prepare":"npm run build","build:cjs":"tsc --project ./commonjs.json && echo '{\\n  \"type\": \"commonjs\"\\n}' > dist/commonjs/package.json","build:esm":"tsc --project ./esm.json && echo '{\\n  \"type\": \"module\"\\n}' > dist/esm/package.json","typecheck":"tsc --noEmit","test:debug":"vitest --inspect-brk --no-file-parallelism","test:coverage":"vitest run --coverage --coverage.reporter=text"},"_npmUser":{"name":"ianatconvex","email":"ian@convex.dev"},"repository":{"url":"git+https://github.com/get-convex/sharded-counter.git","type":"git"},"_npmVersion":"9.9.3","description":"A sharded counter component for Convex.","directories":{},"_nodeVersion":"18.18.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.9.1","vitest":"^2.1.1","globals":"^15.9.0","prettier":"3.2.5","@eslint/js":"^9.9.1","typescript":"~5.0.3","@types/node":"^18.17.0","convex-test":"^0.0.31","typescript-eslint":"^8.4.0","@fast-check/vitest":"^0.1.3"},"peerDependencies":{"convex":"~1.16.5 || ~1.17.0"},"_npmOperationalInternal":{"tmp":"tmp/sharded-counter_0.1.5_1735858434531_0.5845638299173441","host":"s3://npm-registry-packages-npm-production"}},"0.1.6":{"name":"@convex-dev/sharded-counter","version":"0.1.6","keywords":["convex","count","component"],"license":"Apache-2.0","_id":"@convex-dev/sharded-counter@0.1.6","maintainers":[{"name":"cowling","email":"james@convex.dev"},{"name":"jordanhunt","email":"jordan@convex.dev"},{"name":"gautamg795","email":"gautam@convex.dev"},{"name":"emmaling27","email":"emma@convex.dev"},{"name":"nipunn","email":"nipunn1313@gmail.com"},{"name":"sujayakar","email":"sujayakar@convex.dev"},{"name":"ikhare","email":"ikhare@convex.dev"},{"name":"ldanilek","email":"iwork96+npm@gmail.com"},{"name":"ballingt","email":"thomasballinger@gmail.com"},{"name":"sshader","email":"sarah@convex.dev"},{"name":"aritrakh","email":"aritrakh@gmail.com"},{"name":"ianatconvex","email":"ian@convex.dev"},{"name":"erquhart","email":"shawn@erquh.art"}],"homepage":"https://github.com/get-convex/sharded-counter#readme","bugs":{"url":"https://github.com/get-convex/sharded-counter/issues","email":"support@convex.dev"},"dist":{"shasum":"b30c257ee88e57c1491da5d363f04b510f798719","tarball":"https://registry.npmjs.org/@convex-dev/sharded-counter/-/sharded-counter-0.1.6.tgz","fileCount":63,"integrity":"sha512-HZmH7Qj9mQsO8F9qq9K/BKkeInOZ36GfRbqCxNOIvedAfcufXNjrsUDPazNR881s2t9aUwv0zCIqWix7lyfIow==","signatures":[{"sig":"MEQCIEHkoJ3l4Sqo+hmQjIClr2LCmvjpt56zEjlZzNLvZYmaAiB2xOcfQ9WeP8x+JwN8/eINnz6OWjfvjAQl0+1iEET8Ew==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":139654},"main":"./dist/commonjs/client/index.js","type":"module","types":"./dist/commonjs/client/index.d.ts","module":"./dist/esm/client/index.js","exports":{".":{"import":{"types":"./dist/esm/client/index.d.ts","default":"./dist/esm/client/index.js","@convex-dev/component-source":"./src/client/index.ts"},"require":{"types":"./dist/commonjs/client/index.d.ts","default":"./dist/commonjs/client/index.js","@convex-dev/component-source":"./src/client/index.ts"}},"./package.json":"./package.json","./convex.config":{"import":{"types":"./dist/esm/component/convex.config.d.ts","default":"./dist/esm/component/convex.config.js","@convex-dev/component-source":"./src/component/convex.config.ts"}}},"gitHead":"424c4f54d36ad168ebb929da1a92c2305c60854c","scripts":{"dev":"cd example; npm run dev","test":"vitest","build":"npm run build:esm && npm run build:cjs","prepare":"npm run build","build:cjs":"tsc --project ./commonjs.json && echo '{\\n  \"type\": \"commonjs\"\\n}' > dist/commonjs/package.json","build:esm":"tsc --project ./esm.json && echo '{\\n  \"type\": \"module\"\\n}' > dist/esm/package.json","typecheck":"tsc --noEmit","test:debug":"vitest --inspect-brk --no-file-parallelism","test:coverage":"vitest run --coverage --coverage.reporter=text"},"_npmUser":{"name":"ballingt","email":"thomasballinger@gmail.com"},"repository":{"url":"git+https://github.com/get-convex/sharded-counter.git","type":"git"},"_npmVersion":"8.19.4","description":"A sharded counter component for Convex.","directories":{},"_nodeVersion":"18.18.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.9.1","vitest":"^2.1.1","globals":"^15.9.0","prettier":"3.2.5","@eslint/js":"^9.9.1","typescript":"~5.0.3","@types/node":"^18.17.0","convex-test":"^0.0.31","typescript-eslint":"^8.4.0","@fast-check/vitest":"^0.1.3"},"peerDependencies":{"convex":"~1.16.5 || ~1.17.0 || ~1.18.0"},"_npmOperationalInternal":{"tmp":"tmp/sharded-counter_0.1.6_1736878180557_0.8529390367525826","host":"s3://npm-registry-packages-npm-production"}},"0.1.7":{"name":"@convex-dev/sharded-counter","version":"0.1.7","keywords":["convex","count","component"],"license":"Apache-2.0","_id":"@convex-dev/sharded-counter@0.1.7","maintainers":[{"name":"cowling","email":"james@convex.dev"},{"name":"jordanhunt","email":"jordan@convex.dev"},{"name":"gautamg795","email":"gautam@convex.dev"},{"name":"emmaling27","email":"emma@convex.dev"},{"name":"nipunn","email":"nipunn1313@gmail.com"},{"name":"sujayakar","email":"sujayakar@convex.dev"},{"name":"ikhare","email":"ikhare@convex.dev"},{"name":"ldanilek","email":"iwork96+npm@gmail.com"},{"name":"ballingt","email":"thomasballinger@gmail.com"},{"name":"sshader","email":"sarah@convex.dev"},{"name":"aritrakh","email":"aritrakh@gmail.com"},{"name":"ianatconvex","email":"ian@convex.dev"},{"name":"erquhart","email":"shawn@erquh.art"}],"homepage":"https://github.com/get-convex/sharded-counter#readme","bugs":{"url":"https://github.com/get-convex/sharded-counter/issues","email":"support@convex.dev"},"dist":{"shasum":"52213e6b62eddfd59adea313638ed41b677d2fd0","tarball":"https://registry.npmjs.org/@convex-dev/sharded-counter/-/sharded-counter-0.1.7.tgz","fileCount":63,"integrity":"sha512-q5doBDdw2BLoGGY0GBEbLnPeDOKxcsdRI6szRotdCq+BRlGO0rPW3xG1pq/FJ/G9wqO/ZUUKQLPGaGdZs2li4A==","signatures":[{"sig":"MEYCIQD3lIMvfMRl2gKBO0jcu6p8sYg4Tt1va/wgQDfYgV5GUgIhAOsGaRs6NoAtH9hNP9vqQMqKBTK4dwhvDcRwWu93mC+n","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":139652},"main":"./dist/commonjs/client/index.js","type":"module","types":"./dist/commonjs/client/index.d.ts","module":"./dist/esm/client/index.js","exports":{".":{"import":{"types":"./dist/esm/client/index.d.ts","default":"./dist/esm/client/index.js","@convex-dev/component-source":"./src/client/index.ts"},"require":{"types":"./dist/commonjs/client/index.d.ts","default":"./dist/commonjs/client/index.js","@convex-dev/component-source":"./src/client/index.ts"}},"./package.json":"./package.json","./convex.config":{"import":{"types":"./dist/esm/component/convex.config.d.ts","default":"./dist/esm/component/convex.config.js","@convex-dev/component-source":"./src/component/convex.config.ts"}}},"gitHead":"e710eb4b389ea1ace1b7a4f0366f080573ef2938","scripts":{"dev":"cd example; npm run dev","test":"vitest","build":"npm run build:esm && npm run build:cjs","prepare":"npm run build","build:cjs":"tsc --project ./commonjs.json && echo '{\\n  \"type\": \"commonjs\"\\n}' > dist/commonjs/package.json","build:esm":"tsc --project ./esm.json && echo '{\\n  \"type\": \"module\"\\n}' > dist/esm/package.json","typecheck":"tsc --noEmit","test:debug":"vitest --inspect-brk --no-file-parallelism","test:coverage":"vitest run --coverage --coverage.reporter=text"},"_npmUser":{"name":"ballingt","email":"thomasballinger@gmail.com"},"repository":{"url":"git+https://github.com/get-convex/sharded-counter.git","type":"git"},"_npmVersion":"8.19.4","description":"A sharded counter component for Convex.","directories":{},"_nodeVersion":"18.18.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.9.1","vitest":"^2.1.1","globals":"^15.9.0","prettier":"3.2.5","@eslint/js":"^9.9.1","typescript":"~5.0.3","@types/node":"^18.17.0","convex-test":"^0.0.31","typescript-eslint":"^8.4.0","@fast-check/vitest":"^0.1.3"},"peerDependencies":{"convex":"~1.16.5 || >=1.17.0 <1.25.0"},"_npmOperationalInternal":{"tmp":"tmp/sharded-counter_0.1.7_1738797057032_0.4696552121013753","host":"s3://npm-registry-packages-npm-production"}},"0.1.8":{"name":"@convex-dev/sharded-counter","version":"0.1.8","keywords":["convex","count","component"],"license":"Apache-2.0","_id":"@convex-dev/sharded-counter@0.1.8","maintainers":[{"name":"cowling","email":"james@convex.dev"},{"name":"jordanhunt","email":"jordan@convex.dev"},{"name":"gautamg795","email":"gautam@convex.dev"},{"name":"emmaling27","email":"emma@convex.dev"},{"name":"nipunn","email":"nipunn1313@gmail.com"},{"name":"sujayakar","email":"sujayakar@convex.dev"},{"name":"ikhare","email":"ikhare@convex.dev"},{"name":"ldanilek","email":"iwork96+npm@gmail.com"},{"name":"ballingt","email":"thomasballinger@gmail.com"},{"name":"sshader","email":"sarah@convex.dev"},{"name":"aritrakh","email":"aritrakh@gmail.com"},{"name":"ianatconvex","email":"ian@convex.dev"},{"name":"erquhart","email":"shawn@erquh.art"},{"name":"jamwt","email":"jamwt@convex.dev"}],"homepage":"https://github.com/get-convex/sharded-counter#readme","bugs":{"url":"https://github.com/get-convex/sharded-counter/issues","email":"support@convex.dev"},"dist":{"shasum":"1b3b25252fd27da34eac17f0a664084afbaec5fa","tarball":"https://registry.npmjs.org/@convex-dev/sharded-counter/-/sharded-counter-0.1.8.tgz","fileCount":63,"integrity":"sha512-kcv9BAvqrtBAvtzBsqLVz5Elzf0xe7sio3QX5eXvk+ZVIJb+rIeF9h4ZI6qH2RuW/qQvwY5stNZghDbGzLIvDw==","signatures":[{"sig":"MEYCIQCVJkkvThktRZ3ksPpqYJpGvFCqNtZNOsUMFOTrYk9lyQIhAIAsAkuG/kI1bjk9gLQ2URogp9f7YN3IwLLPZ94pUY3l","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":139652},"main":"./dist/commonjs/client/index.js","type":"module","types":"./dist/commonjs/client/index.d.ts","module":"./dist/esm/client/index.js","exports":{".":{"import":{"types":"./dist/esm/client/index.d.ts","default":"./dist/esm/client/index.js","@convex-dev/component-source":"./src/client/index.ts"},"require":{"types":"./dist/commonjs/client/index.d.ts","default":"./dist/commonjs/client/index.js","@convex-dev/component-source":"./src/client/index.ts"}},"./package.json":"./package.json","./convex.config":{"import":{"types":"./dist/esm/component/convex.config.d.ts","default":"./dist/esm/component/convex.config.js","@convex-dev/component-source":"./src/component/convex.config.ts"}}},"gitHead":"35b17f34010aa7a79831e6f80e194cacd1b7550d","scripts":{"dev":"cd example; npm run dev","test":"vitest","build":"npm run build:esm && npm run build:cjs","prepare":"npm run build","build:cjs":"tsc --project ./commonjs.json && echo '{\\n  \"type\": \"commonjs\"\\n}' > dist/commonjs/package.json","build:esm":"tsc --project ./esm.json && echo '{\\n  \"type\": \"module\"\\n}' > dist/esm/package.json","typecheck":"tsc --noEmit","test:debug":"vitest --inspect-brk --no-file-parallelism","test:coverage":"vitest run --coverage --coverage.reporter=text"},"_npmUser":{"name":"ballingt","email":"thomasballinger@gmail.com"},"repository":{"url":"git+https://github.com/get-convex/sharded-counter.git","type":"git"},"_npmVersion":"10.8.2","description":"A sharded counter component for Convex.","directories":{},"_nodeVersion":"20.19.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.9.1","vitest":"^2.1.1","globals":"^15.9.0","prettier":"3.2.5","@eslint/js":"^9.9.1","typescript":"~5.0.3","@types/node":"^18.17.0","convex-test":"^0.0.31","typescript-eslint":"^8.4.0","@fast-check/vitest":"^0.1.3"},"peerDependencies":{"convex":"~1.16.5 || >=1.17.0 <1.35.0"},"_npmOperationalInternal":{"tmp":"tmp/sharded-counter_0.1.8_1748651434231_0.3121914425841188","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@convex-dev/sharded-counter","version":"0.2.0","keywords":["convex","count","component"],"license":"Apache-2.0","_id":"@convex-dev/sharded-counter@0.2.0","maintainers":[{"name":"cowling","email":"james@convex.dev"},{"name":"jordanhunt","email":"jordan@convex.dev"},{"name":"gautamg795","email":"gautam@convex.dev"},{"name":"emmaling27","email":"emma@convex.dev"},{"name":"nipunn","email":"nipunn1313@gmail.com"},{"name":"ballingt","email":"thomasballinger@gmail.com"},{"name":"aritrakh","email":"aritrakh@gmail.com"},{"name":"ianatconvex","email":"ian@convex.dev"},{"name":"erquhart","email":"shawn@erquh.art"},{"name":"jamwt","email":"jamwt@convex.dev"},{"name":"nicolapps","email":"nicolas@ettlin.dev"}],"homepage":"https://github.com/get-convex/sharded-counter#readme","bugs":{"url":"https://github.com/get-convex/sharded-counter/issues","email":"support@convex.dev"},"dist":{"shasum":"4e7d881182efed983eda742b4385b7279ea1b4fe","tarball":"https://registry.npmjs.org/@convex-dev/sharded-counter/-/sharded-counter-0.2.0.tgz","fileCount":45,"integrity":"sha512-Qv1TvFXyQ60rADS1fWH01mnMDNSPfmKKowXva6WxIXGIC2ta5xvohe9TfUhXp4AT1vtOXoFgse3Z9mJB9fJlSQ==","signatures":[{"sig":"MEUCIGai4P2erqC+qxIOskdiEey30ehfxwqUjBbZGv5cjxALAiEA6xAJd3QCTIUU4HGz3B4ftB4pzDfUEf4SH43n3AqCiVE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":104566},"type":"module","types":"./dist/client/index.d.ts","module":"./dist/client/index.js","exports":{".":{"types":"./dist/client/index.d.ts","default":"./dist/client/index.js"},"./test":"./src/test.ts","./package.json":"./package.json","./convex.config":{"types":"./dist/component/convex.config.d.ts","default":"./dist/component/convex.config.js"},"./convex.config.js":{"types":"./dist/component/convex.config.d.ts","default":"./dist/component/convex.config.js"},"./_generated/component.js":{"types":"./dist/component/_generated/component.d.ts"}},"gitHead":"cd3fec673e7d2d23150bf5d3c0cbf5fd9cef7db6","scripts":{"all":"run-p -r 'dev:*' 'test:watch'","dev":"run-p -r 'dev:*'","lint":"eslint .","test":"vitest run --typecheck","alpha":"npm run clean && npm ci && run-p test lint typecheck && npm version prerelease --preid alpha && npm publish --tag alpha && git push --tags","build":"tsc --project ./tsconfig.build.json","clean":"rm -rf dist *.tsbuildinfo","predev":"npm run dev:backend -- --until-success","prepare":"npm run build","release":"npm run clean && npm ci && run-p test lint typecheck && npm version patch && npm publish && git push --tags","version":"pbcopy <<<$npm_package_version; vim CHANGELOG.md && prettier -w CHANGELOG.md && git add CHANGELOG.md","dev:build":"chokidar 'tsconfig*.json' 'src/**/*.ts' -i '**/*.test.ts' -c 'convex codegen --component-dir ./src/component && npm run build' --initial","typecheck":"tsc --noEmit && tsc -p example && tsc -p example/convex","test:debug":"vitest --inspect-brk --no-file-parallelism","test:watch":"vitest --typecheck --clearScreen false","dev:backend":"convex dev --typecheck-components","dev:frontend":"cd example && vite --clearScreen false","test:coverage":"vitest run --coverage --coverage.reporter=text"},"_npmUser":{"name":"ianatconvex","email":"ian@convex.dev"},"repository":{"url":"git+https://github.com/get-convex/sharded-counter.git","type":"git"},"_npmVersion":"11.6.2","description":"A sharded counter component for Convex.","directories":{},"_nodeVersion":"20.19.5","_hasShrinkwrap":false,"devDependencies":{"vite":"^6.4.1","react":"^19.2.0","convex":"1.29.0","eslint":"^9.38.0","vitest":"^3.2.4","globals":"^16.4.0","prettier":"^3.6.2","react-dom":"^19.2.0","react-use":"^17.6.0","@eslint/js":"^9.38.0","typescript":"^5.9.3","@types/node":"20.19.24","convex-test":"^0.0.38","npm-run-all":"^4.1.5","@types/react":"^19.2.2","chokidar-cli":"3.0.0","npm-run-all2":"8.0.4","react-window":"1.8.11","convex-helpers":"^0.1.104","@edge-runtime/vm":"5.0.0","@eslint/eslintrc":"^3.3.1","@types/react-dom":"^19.2.2","typescript-eslint":"^8.46.2","@fast-check/vitest":"^0.2.2","@types/react-window":"1.8.8","@vitejs/plugin-react":"^5.1.0","@convex-dev/migrations":"0.3.0","eslint-plugin-react-hooks":"^7.0.1","eslint-plugin-react-refresh":"^0.4.24"},"peerDependencies":{"convex":"^1.24.8"},"_npmOperationalInternal":{"tmp":"tmp/sharded-counter_0.2.0_1763007911373_0.5533058639015134","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@convex-dev/sharded-counter","version":"0.2.1","keywords":["convex","count","component"],"license":"Apache-2.0","_id":"@convex-dev/sharded-counter@0.2.1","maintainers":[{"name":"cowling","email":"james@convex.dev"},{"name":"jordanhunt","email":"jordan@convex.dev"},{"name":"gautamg795","email":"gautam@convex.dev"},{"name":"emmaling27","email":"emma@convex.dev"},{"name":"nipunn","email":"nipunn1313@gmail.com"},{"name":"aritrakh","email":"aritrakh@gmail.com"},{"name":"ianatconvex","email":"ian@convex.dev"},{"name":"dowski-convex","email":"christian@convex.dev"},{"name":"reece-convex","email":"reece@convex.dev"},{"name":"erquhart","email":"shawn@erquh.art"},{"name":"sethconvex","email":"seth@convex.dev"},{"name":"jamwt","email":"jamwt@convex.dev"},{"name":"nicolapps","email":"nicolas@ettlin.dev"}],"homepage":"https://github.com/get-convex/sharded-counter#readme","bugs":{"url":"https://github.com/get-convex/sharded-counter/issues","email":"support@convex.dev"},"dist":{"shasum":"7205629437ccc7cb57f01037fb2994d7240323eb","tarball":"https://registry.npmjs.org/@convex-dev/sharded-counter/-/sharded-counter-0.2.1.tgz","fileCount":45,"integrity":"sha512-JbHBuULFftOBAWa1XPgqFglKlSXntuQ6XIQm6KUcVoh+l2+3s5nbngGDIXmzAeLdD1pkKz53ldGfeA+hdgQHeQ==","signatures":[{"sig":"MEUCIBO4Ig36K9KXtOaUsAsJPO3xLCa7WWG7RXDc2uPkDEXlAiEAj17POR/6uMnMXtMLL4SltVjw0oEtBTVWon5ilzNZdJ0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":105594},"type":"module","types":"./dist/client/index.d.ts","module":"./dist/client/index.js","exports":{".":{"types":"./dist/client/index.d.ts","default":"./dist/client/index.js"},"./test":"./src/test.ts","./package.json":"./package.json","./convex.config":{"types":"./dist/component/convex.config.d.ts","default":"./dist/component/convex.config.js"},"./convex.config.js":{"types":"./dist/component/convex.config.d.ts","default":"./dist/component/convex.config.js"},"./_generated/component.js":{"types":"./dist/component/_generated/component.d.ts"}},"gitHead":"aea1f161eeb8f5d3f5c0a5f99a6ab82ffed7233e","scripts":{"dev":"convex dev --start 'npm run dev:build'","lint":"eslint .","test":"vitest run --typecheck","alpha":"npm version prerelease --preid alpha && npm publish --tag alpha && git push --follow-tags","build":"tsc --project ./tsconfig.build.json","predev":"convex init && npm run build:codegen","release":"npm version patch && npm publish && git push --follow-tags","version":"(npm whoami || npm login) && vim -c 'normal o' -c 'normal o## '$npm_package_version CHANGELOG.md && prettier -w CHANGELOG.md && git add CHANGELOG.md","dev:build":"chokidar 'tsconfig*.json' 'src/**/*.ts' -i '**/*.test.ts' -c 'npm run build:codegen' --initial","typecheck":"tsc --noEmit && tsc -p example && tsc -p example/convex","preversion":"npm ci && npm run build:clean && npm run test && npm run lint && npm run typecheck","test:debug":"vitest --inspect-brk --no-file-parallelism","test:watch":"vitest --typecheck --clearScreen false","build:clean":"rm -rf dist *.tsbuildinfo && npm run build:codegen","dev:frontend":"cd example && vite --clearScreen false","build:codegen":"npx convex codegen --component-dir ./src/component && npm run build","test:coverage":"vitest run --coverage --coverage.reporter=text"},"_npmUser":{"name":"ianatconvex","email":"ian@convex.dev"},"repository":{"url":"git+https://github.com/get-convex/sharded-counter.git","type":"git"},"_npmVersion":"11.11.0","description":"A sharded counter component for Convex.","directories":{},"_nodeVersion":"22.22.2","_hasShrinkwrap":false,"devDependencies":{"vite":"8.0.16","react":"19.2.5","convex":"1.35.1","eslint":"9.39.4","vitest":"4.1.4","globals":"17.5.0","prettier":"3.8.3","react-dom":"19.2.5","react-use":"17.6.0","@eslint/js":"9.39.4","typescript":"5.9.3","@types/node":"24.12.2","convex-test":"0.0.48","@types/react":"19.2.14","chokidar-cli":"3.0.0","npm-run-all2":"9.0.0","react-window":"2.2.7","convex-helpers":"0.1.114","@edge-runtime/vm":"5.0.0","@eslint/eslintrc":"3.3.5","@types/react-dom":"19.2.3","typescript-eslint":"8.58.2","@fast-check/vitest":"0.4.0","@types/react-window":"2.0.0","@vitejs/plugin-react":"6.0.1","@convex-dev/migrations":"0.3.3","@convex-dev/eslint-plugin":"^2.0.0","eslint-plugin-react-hooks":"7.0.1","eslint-plugin-react-refresh":"0.5.2"},"peerDependencies":{"convex":"^1.24.8"},"_npmOperationalInternal":{"tmp":"tmp/sharded-counter_0.2.1_1782345076207_0.6051339516778431","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2024-10-16T22:14:25.563Z","modified":"2026-09-16T18:55:05.667Z","0.1.1":"2024-10-16T22:14:25.838Z","0.1.2":"2024-10-18T01:00:19.697Z","0.1.3":"2024-10-21T20:20:52.225Z","0.1.4":"2024-10-22T01:42:58.502Z","0.1.5":"2025-01-02T22:53:54.743Z","0.1.6":"2025-01-14T18:09:40.766Z","0.1.7":"2025-02-05T23:10:57.254Z","0.1.8":"2025-05-31T00:30:34.404Z","0.2.0":"2025-11-13T04:25:11.560Z","0.2.1":"2026-06-24T23:51:16.347Z"},"bugs":{"url":"https://github.com/get-convex/sharded-counter/issues","email":"support@convex.dev"},"license":"Apache-2.0","homepage":"https://github.com/get-convex/sharded-counter#readme","keywords":["convex","count","component"],"repository":{"url":"git+https://github.com/get-convex/sharded-counter.git","type":"git"},"description":"A sharded counter component for Convex.","maintainers":[{"email":"james@convex.dev","name":"cowling"},{"email":"jordan@convex.dev","name":"jordanhunt"},{"email":"gautam@convex.dev","name":"gautamg795"},{"email":"emma@convex.dev","name":"emmaling27"},{"email":"nipunn1313@gmail.com","name":"nipunn"},{"email":"aritrakh@gmail.com","name":"aritrakh"},{"email":"ian@convex.dev","name":"ianatconvex"},{"email":"christian@convex.dev","name":"dowski-convex"},{"email":"reece@convex.dev","name":"reece-convex"},{"email":"ayush@convex.dev","name":"ayushdewanconvex"},{"email":"shawn@erquh.art","name":"erquhart"},{"email":"seth@convex.dev","name":"sethconvex"},{"email":"andy@convex.dev","name":"andycai-convex"},{"email":"mike@wheaton.dev","name":"mikewheaton"},{"email":"jamwt@convex.dev","name":"jamwt"},{"email":"nicolas@ettlin.dev","name":"nicolapps"}],"readme":"# Convex Sharded Counter Component\n\n[![npm version](https://badge.fury.io/js/@convex-dev%2Fsharded-counter.svg)](https://badge.fury.io/js/@convex-dev%2Fsharded-counter)\n\n<!-- START: Include on https://convex.dev/components -->\n\nThis component adds counters to Convex. It acts as a key-value store from string\nto number, with sharding to increase throughput when updating values.\n\nSince it's built on Convex, everything is automatically consistent, reactive,\nand cached. Since it's built with [Components](https://convex.dev/components),\nthe operations are isolated and increment/decrement are atomic even if run in\nparallel.\n\nFor example, if you want to display\n[one million checkboxes](https://en.wikipedia.org/wiki/One_Million_Checkboxes)\n[on your Convex site](https://www.youtube.com/watch?v=LRUWplYoejQ), you want to\ncount the checkboxes in real-time while allowing a lot of the boxes to change in\nparallel.\n\nMore generally, whenever you have a counter that is changing frequently, you can\nuse this component to keep track of it efficiently.\n\n```ts\nexport const checkBox = mutation({\n  args: { i: v.number() },\n  handler: async (ctx, args) => {\n    const checkbox = await ctx.db\n      .query(\"checkboxes\")\n      .withIndex(\"i\", (q) => q.eq(\"i\", args.i))\n      .unique();\n    if (!checkbox.isChecked) {\n      await ctx.db.patch(checkbox._id, { isChecked: true });\n\n      // Here we increment the number of checkboxes.\n      await numCheckboxes.inc(ctx);\n    }\n  },\n});\nexport const getCount = query({\n  args: {},\n  handler: async (ctx, _args) => {\n    return await numCheckboxes.count(ctx);\n  },\n});\n```\n\nThis relies on the assumption that you need to frequently modify the counter,\nbut only need to read its value from a query, or infrequently in a mutation. If\nyou read the count every time you modify it, you lose the sharding benefit.\n\n## Pre-requisite: Convex\n\nYou'll need an existing Convex project to use the component. Convex is a hosted\nbackend platform, including a database, serverless functions, and a ton more you\ncan learn about [here](https://docs.convex.dev/get-started).\n\nRun `npm create convex` or follow any of the\n[quickstarts](https://docs.convex.dev/home) to set one up.\n\n## Installation\n\nFirst, install the component package:\n\n```ts\nnpm install @convex-dev/sharded-counter\n```\n\nThen, create a `convex.config.ts` file in your app's `convex/` folder and\ninstall the component by calling `use`:\n\n```ts\n// convex/convex.config.ts\nimport { defineApp } from \"convex/server\";\nimport shardedCounter from \"@convex-dev/sharded-counter/convex.config.js\";\n\nconst app = defineApp();\napp.use(shardedCounter);\n\nexport default app;\n```\n\nFinally, create a new `ShardedCounter` within your `convex/` folder, and point\nit to the installed component.\n\n```ts\nimport { components } from \"./_generated/api\";\nimport { ShardedCounter } from \"@convex-dev/sharded-counter\";\n\nconst counter = new ShardedCounter(components.shardedCounter);\n```\n\n## Updating and reading counters\n\nOnce you have a `ShardedCounter`, there are a few methods you can use to update\nthe counter for a key in a mutation or action.\n\n```ts\nawait counter.add(ctx, \"checkboxes\", 5); // increment by 5\nawait counter.inc(ctx, \"checkboxes\"); // increment by 1\nawait counter.subtract(ctx, \"checkboxes\", 5); // decrement by 5\nawait counter.dec(ctx, \"checkboxes\"); // decrement by 1\nawait counter.reset(ctx, \"checkboxes\"); // reset to 0\n\nconst numCheckboxes = counter.for(\"checkboxes\");\nawait numCheckboxes.inc(ctx); // increment\nawait numCheckboxes.dec(ctx); // decrement\nawait numCheckboxes.add(ctx, 5); // add 5\nawait numCheckboxes.subtract(ctx, 5); // subtract 5\nawait numCheckboxes.reset(ctx); // reset to 0\n```\n\nAnd you can read the counter's value in a query, mutation, or action.\n\n```ts\nawait counter.count(ctx, \"checkboxes\");\nawait numCheckboxes.count(ctx);\n```\n\nSee more example usage in [example.ts](./example/convex/example.ts).\n\n## Sharding the counter\n\nWhen a single document is modified by two mutations at the same time, the\nmutations slow down to achieve\n[serializable results](https://docs.convex.dev/database/advanced/occ).\n\nTo achieve high throughput, the ShardedCounter distributes counts across\nmultiple documents, called \"shards\". Increments and decrements update a random\nshard, while queries of the total count read from all shards.\n\n1. More shards => greater throughput when incrementing or decrementing.\n2. Fewer shards => better latency when querying the count.\n\nYou can set the number of shards when initializing the ShardedCounter, either\nsetting it specially for each key:\n\n```ts\nconst counter = new ShardedCounter(components.shardedCounter, {\n  shards: { checkboxes: 100 }, // 100 shards for the key \"checkboxes\"\n});\n```\n\nOr by setting a default that applies to all keys not specified in `shards`:\n\n```ts\nconst counter = new ShardedCounter(components.shardedCounter, {\n  shards: { checkboxes: 100 },\n  defaultShards: 8,\n});\n```\n\nThe default number of shards if none is specified is 16.\n\nNote your keys can be a subtype of string. e.g. if you want to store a count of\nfriends for each user, and you don't care about throughput for a single user,\nyou would declare ShardedCounter like so:\n\n```ts\nconst friendCounts = new ShardedCounter<Id<\"users\">>(\n  components.shardedCounter,\n  { defaultShards: 1 },\n);\n\n// Decrement a user's friend count by 1\nawait friendsCount.dec(ctx, userId);\n```\n\n## Reduce contention on reads\n\nReading the count with `counter.count(ctx, \"checkboxes\")` reads from all shards\nto get an accurate count. This takes a read dependency on all shard documents.\n\n- In a query subscription, that means any change to the counter causes the query\n  to rerun.\n- In a mutation, that means any modification to the counter causes an\n  [OCC](https://docs.convex.dev/error#1) conflict.\n\nYou can reduce contention by estimating the count: read from a smaller number of\nshards and extrapolate based on the total number of shards.\n\n```ts\nconst estimatedCheckboxCount = await counter.estimateCount(ctx, \"checkboxes\");\n```\n\nBy default, this reads from a single random shard and multiplies by the total\nnumber of shards to form an estimate. You can improve the estimate by reading\nfrom more shards, at the cost of more contention:\n\n```ts\nconst estimateFromThree = await counter.estimateCount(ctx, \"checkboxes\", 3);\n```\n\nIf the counter was accumulated from many small `counter.inc` and `counter.dec`\ncalls, then they should be uniformly distributed across the shards, so estimated\ncounts will be accurate.\n\nIn some cases the counter will not be evenly distributed:\n\n- If the counter was accumulated from few operations\n- If some operations were `counter.add`s or `counter.subtract`s with large\n  values, because each operation only changes a single shard\n- If the number of shards changed\n\nIn these cases, the count might not be evenly distributed across the shards. To\nrepair such cases, you can call:\n\n```ts\nawait counter.rebalance(ctx, \"checkboxes\");\n```\n\nWhich will even out the count across shards.\n\nYou may change the number of shards for a key, by changing the second argument\nto the `ShardedCounter` constructor. If you decrease the number of shards, you\nwill be left with extra shards that won't be written to but are still read when\ncomputing `count`. In this case, you should call `counter.rebalance` to delete\nthe extraneous shards.\n\nNOTE: `counter.rebalance` reads and writes all shards, so it could cause more\nOCCs, and it's recommended you call it sparingly, from the Convex dashboard or\nfrom an infrequent cron.\n\nNOTE: counts are floats, and floating point arithmetic isn't infinitely precise.\nEven if you always add and subtract integers, you may get a fractional counts,\nespecially if you use `estimateCount` or `rebalance`. Values distributed across\nshards may be added in different combinations, and\n[floating point arithmetic isn't associative](https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html).\nYou can use `Math.round` to ensure your final count is an integer, if desired.\n\n## Counting documents in a table\n\nOften you want to use a sharded counter to track how many documents are in a\ntable.\n\n> If you want more than just a count, take a look at the\n> [Aggregate component](https://www.npmjs.com/package/@convex-dev/aggregate).\n\nThere are three ways to go about keeping a count in sync with a table:\n\n1. Be careful to always update the aggregate in any mutation that inserts or\n   deletes from the table.\n2. \\[Recommended\\] Place all writes to a table in separate TypeScript functions,\n   and always call these functions from mutations instead of writing to the db\n   directly. This method is recommended, because it encapsulates the logic for\n   updating a table, while still keeping all operations explicit. For example,\n\n```ts\n// Example of a mutation that calls `insertUser`.\nexport const insertPair = mutation(async (ctx) => {\n  ...\n  await insertUser(ctx, user1);\n  await insertUser(ctx, user2);\n});\n\n// All inserts to the \"users\" table go through this function.\nasync function insertUser(ctx, user) {\n  await ctx.db.insert(\"users\", user);\n  await counter.inc(ctx, \"users\");\n}\n```\n\n3. Register a [Trigger](https://www.npmjs.com/package/convex-helpers#triggers),\n   which automatically runs code when a mutation changes the data in a table.\n\n```ts\n// Triggers hook up writes to the table to the ShardedCounter.\nconst triggers = new Triggers<DataModel>();\ntriggers.register(\"mytable\", counter.trigger(\"mycounter\"));\nexport const mutation = customMutation(rawMutation, customCtx(triggers.wrapDB));\n```\n\nThe [insertUserWithTrigger](example/convex/example.ts) mutation uses a trigger.\n\n## Backfilling an existing count\n\nIf you want to count items like documents in a table, you may already have\ndocuments before installing the ShardedCounter component, and these should be\naccounted for.\n\nThe easy version of this is to calculate the value once and add that value, if\nthere aren't active requests happening. You can also periodically re-calculate\nthe value and update the counter, if there aren't in-flight requests.\n\nThe tricky part is handling requests while doing the calculation: making sure to\nmerge active updates to counts with old values that you want to backfill.\n\n### Simple backfill: if table is append-only\n\nSee example code at the bottom of\n[example/convex/example.ts](example/convex/example.ts).\n\nWalkthrough of steps:\n\n1. Change live writes to update the counter. In the example, you would be\n   changing `insertUserBeforeBackfill` to be implemented as\n   `insertUserAfterBackfill`.\n2. Write a backfill that counts documents that were created before the code from\n   (1) deployed. In the example, this would be `backfillOldUsers`.\n3. Run `backfillOldUsers` from the dashboard.\n\n### Complex backfill: if documents may be deleted\n\nSee example code at the bottom of\n[example/convex/example.ts](example/convex/example.ts).\n\nWalkthrough of steps:\n\n1. Create `backfillCursor` table in schema.ts\n2. Create a new document in this table, with fields\n   `{ creationTime: 0, id: \"\", isDone: false }`\n3. Wherever you want to update a counter based on a document changing, wrap the\n   update in a conditional, so it only gets updated if the backfill has\n   processed that document. In the example, you would be changing\n   `insertUserBeforeBackfill` to be implemented as `insertUserDuringBackfill`.\n4. Define backfill functions similar to `backfillUsers` and `backfillUsersBatch`\n5. Call `backfillUsersBatch` from the dashboard.\n6. Remove the conditional when updating counters. In the example, you would be\n   changing `insertUserDuringBackfill` to be implemented as\n   `insertUserAfterBackfill`.\n7. Delete the `backfillCursor` table.\n\n<!-- END: Include on https://convex.dev/components -->\n","readmeFilename":"README.md"}