{"_id":"korvath","name":"korvath","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"korvath","version":"1.0.0","description":"Goal/hydration streak analytics. Pure browser-safe core, plus an optional Node-only cached server entry.","type":"module","license":"MIT","exports":{".":{"types":"./index.d.ts","default":"./index.mjs"},"./server":{"types":"./server.d.ts","default":"./server.mjs"}},"dependencies":{"korvica":"^1.0.0"},"keywords":["streak","hydration","goal","analytics"],"types":"./index.d.ts","_id":"korvath@1.0.0","_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-3GhfSZ3NTSSjIe7XWJLhJyvhF2n0l/+CtT7pIX3ilv3Ndew6odOM3tsoGD/YRNLrM+4n00p8irn/PN5qtt86Xw==","shasum":"67395540ae273b826f32cca4102851303373237f","tarball":"https://registry.npmjs.org/korvath/-/korvath-1.0.0.tgz","fileCount":6,"unpackedSize":6164,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFibggZ4l3cAwZ0EATX/CdEePjXlg+NjKE0P/5am7ZLdAiEAlmb82OZ/kC1dpwclvDTIriTVIsJTpIvjLJyGopN3mTA="}]},"_npmUser":{"name":"kilomev","email":"kilomev@protonmail.com"},"directories":{},"maintainers":[{"name":"kilomev","email":"kilomev@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/korvath_1.0.0_1784644549606_0.25825922258440137"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-21T14:35:49.515Z","1.0.0":"2026-07-21T14:35:49.720Z","modified":"2026-07-21T14:35:49.976Z"},"maintainers":[{"name":"kilomev","email":"kilomev@protonmail.com"}],"description":"Goal/hydration streak analytics. Pure browser-safe core, plus an optional Node-only cached server entry.","keywords":["streak","hydration","goal","analytics"],"license":"MIT","readme":"# korvath\n\nGoal/hydration streak analytics. Depends on its helper package,\n[`korvica`](../korvica), for the calendar-day math.\n\nTwo entry points — the boundary matters:\n\n| import | environment | side effects |\n| --- | --- | --- |\n| `korvath` | anywhere — pure, browser-safe | none |\n| `korvath/server` | server-only files (`hooks.server.ts`, `+*.server.ts`) | boots `korvica/store` (creates an OS-temp cache dir) |\n\nImporting `korvath/server` from a `.svelte` component pulls `node:fs` into the\nbrowser bundle and breaks the build. Keep it on the server.\n\n## `korvath`\n\n```js\nimport { computeStreaks } from 'korvath';\n\nconst streaks = computeStreaks(\n\t[{ date: '2026-07-20T09:00:00Z', value: 2000 }],\n\t{ goal: 2000, timeZone: 'UTC', now: new Date('2026-07-20T20:00:00Z') }\n);\n// { current, best, qualifyingDays, activeDays, lastQualified }\n```\n\n## `korvath/server`\n\n```js\nimport { streaksCached, store } from 'korvath/server';\n\nstore.dir; // <os-tmp>/korvica-store, created on import\nstreaksCached(entries, options); // computes once, then serves from disk\n```\n\n## When does it run?\n\nNothing runs at `pnpm install` (no lifecycle scripts by design). Execution\nhappens on import:\n\n- `korvath` runs whenever the app or tests import it — i.e. during `vite`\n  build/dev and during `pnpm test`.\n- `korvath/server` runs when a server file imports it (e.g. `hooks.server.ts`\n  at `vite dev` boot), which in turn boots the `korvica` helper.\n","readmeFilename":"README.md","_rev":"1-a389aca7a945e8e40b3a3ddf524181d2"}