{"_id":"@0xhq/relay","name":"@0xhq/relay","dist-tags":{"latest":"0.0.0"},"versions":{"0.0.0":{"name":"@0xhq/relay","version":"0.0.0","type":"module","main":"dist/index.mjs","types":"dist/index.d.mts","dependencies":{"zustand":"^5.0.11"},"devDependencies":{"@types/node":"^25.5.0","tsd":"^0.33.0","tsdown":"^0.21.1","typescript":"^5.9.3","vitest":"^4.1.0"},"scripts":{"dev":"tsdown --watch","build":"tsdown","test":"npx vitest","test:watch":"npx vitest --watch"},"_id":"@0xhq/relay@0.0.0","description":"<p align=\"center\">   <a href=\"https://vocs.dev\">     <picture>       <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/0xhq/relay/blob/main/.github/logo-dark.svg\">       <img alt=\"Relay logo\" src=\"https://github.com/0xhq/relay/blob/m","_integrity":"sha512-CDv6xfkUi+r7+9+NVTQ0luTMj+zJpMZJsoyKyYGmyO198d8lRYfwHOmT13/ur0ccSTjMbIX8UW4UuWdnQyekiw==","_resolved":"/private/var/folders/rl/p_6fvxrd52l2mcjf_h6bz40r0000gn/T/e228a25a5adcf6050ffab60e90770b4d/0xhq-relay-0.0.0.tgz","_from":"file:0xhq-relay-0.0.0.tgz","_nodeVersion":"24.9.0","_npmVersion":"11.6.0","dist":{"integrity":"sha512-CDv6xfkUi+r7+9+NVTQ0luTMj+zJpMZJsoyKyYGmyO198d8lRYfwHOmT13/ur0ccSTjMbIX8UW4UuWdnQyekiw==","shasum":"511aec9362468a3cc12d0ee39226d3fa566df96d","tarball":"https://registry.npmjs.org/@0xhq/relay/-/relay-0.0.0.tgz","fileCount":10,"unpackedSize":37439,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCU0pRhKQ604A+wXUe0d1RjuuI7+z47zwdIxcXpyeKfMwIgIqil+dOyPZwESWaaN3yPy+31Cs6OS2UBMHTd6jrhtE0="}]},"_npmUser":{"name":"0xbuidlerguy","email":"0xbuidlerguy@gmail.com"},"directories":{},"maintainers":[{"name":"0xbuidlerguy","email":"0xbuidlerguy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/relay_0.0.0_1774964237231_0.5499330227758656"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-31T13:37:17.136Z","0.0.0":"2026-03-31T13:37:17.379Z","modified":"2026-03-31T13:37:17.620Z"},"maintainers":[{"name":"0xbuidlerguy","email":"0xbuidlerguy@gmail.com"}],"description":"<p align=\"center\">   <a href=\"https://vocs.dev\">     <picture>       <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/0xhq/relay/blob/main/.github/logo-dark.svg\">       <img alt=\"Relay logo\" src=\"https://github.com/0xhq/relay/blob/m","readme":"<p align=\"center\">\n  <a href=\"https://vocs.dev\">\n    <picture>\n      <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://github.com/0xhq/relay/blob/main/.github/logo-dark.svg\">\n      <img alt=\"Relay logo\" src=\"https://github.com/0xhq/relay/blob/main/.github/logo-light.svg\" width=\"auto\" height=\"200\">\n    </picture>\n  </a>\n</p>\n\n# 🏃 Relay\n\nRelay is a tiny, focused helper for orchestrating sequential async flows inside React. Each \"step\" is a typed function that runs once, can report success or failure, and automatically updates a centralized Zustand store. Relay then exposes helpers to:\n\n- Execute/retry individual steps (`start`, `next`, etc.)\n- Guard state transitions (`canStart`, `canNext`, etc.)\n- Reset without letting stale promises overwrite the next run\n\nThis makes Relay ideal for multi-stage flows (blockchain transactions, onboarding UIs, setup wizards) where you want deterministic execution, retry points, and state that stays consistent even if users reset the flow mid-flight.\n\n## Key Concepts\n\n1. **Steps** – small async tasks registered via `RelayStepBase`. Each receives a relay-controlled `AbortSignal`, letting it stop early when the flow resets or restarts.\n2. **State Store** – Zustand tracks the array of step states plus derived capabilities. Components simply consume `useRelay()` to drive the UI without managing `useEffect` chains.\n3. **Control Actions** – `start`, `next`, `retry`, `reset`, etc., update the store and automatically enforce guards so you never run steps out of order or while another run is in progress.\n\n## Installation\n\n```bash\npnpm add @0xhqy\n```\n\n## Learn More\n\nBrowse the docs and examples at [https://relay.0xhq.com](https://relay.0xhq.com)\n","readmeFilename":"README.md","_rev":"1-504228f15d0289b5ffc457eb5d89f38b"}