{"_id":"@aethex.os/registry","_rev":"4-b25dd3e5f522dbcd225a21d51ac3224f","name":"@aethex.os/registry","dist-tags":{"latest":"2.0.2"},"versions":{"1.0.0":{"name":"@aethex.os/registry","version":"1.0.0","keywords":["aethex","registry","rbac","capability","realm","app","access-control","metaverse"],"author":{"name":"AeThex Corporation"},"license":"MIT","_id":"@aethex.os/registry@1.0.0","maintainers":[{"name":"mrpiglr","email":"mrpiglr@aethex.dev"}],"homepage":"https://aethex.dev","bugs":{"url":"https://github.com/AeThex-Corporation/AeThex-OS/issues"},"dist":{"shasum":"2fef03c71eb17e0f89c3ab18866b6335c6819c36","tarball":"https://registry.npmjs.org/@aethex.os/registry/-/registry-1.0.0.tgz","fileCount":5,"integrity":"sha512-gihhdAodEtL2kLMjNNp+AAjLXRDToVkaj7fpIW0/qd+njd03BoK0CFdp5DsRLb+FOclRG+1R30MKMcatwVum4A==","signatures":[{"sig":"MEUCIQDZTSfzwHzIBoTlLaSUqh23SGEL5ICvKhmzZrB0QW2dRwIgcaJFVMaKBO0DQ6Niya4WDr+2O0DC0PBzoBllGP9MVyI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":8618},"main":"lib/index.js","types":"lib/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"b094d5c032765a30612c2348ce0356d3a50d9feb","scripts":{"dev":"tsc --watch","build":"tsc"},"_npmUser":{"name":"mrpiglr","email":"mrpiglr@aethex.dev"},"repository":{"url":"git+https://github.com/AeThex-Corporation/AeThex-OS.git","type":"git","directory":"packages/aethex-registry"},"_npmVersion":"11.12.1","description":"AeThex app registry — Realm/Capability/Mode framework for multi-mode app access control","directories":{},"_nodeVersion":"22.22.0","dependencies":{"zod":"^3.22.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.3.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/registry_1.0.0_1777930946039_0.26323053389554363","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@aethex.os/registry","version":"2.0.0","keywords":["feature-flags","feature-gating","saas","plans","tiers","rbac","access-control","react","hooks","gate","subscription","permissions","aethex"],"author":{"name":"AeThex Corporation"},"license":"MIT","_id":"@aethex.os/registry@2.0.0","maintainers":[{"name":"mrpiglr","email":"mrpiglr@aethex.dev"}],"homepage":"https://aethex.dev","bugs":{"url":"https://github.com/AeThex-Corporation/AeThex-OS/issues"},"dist":{"shasum":"59922076ef108e5e211d06f011375bcfe98f3865","tarball":"https://registry.npmjs.org/@aethex.os/registry/-/registry-2.0.0.tgz","fileCount":13,"integrity":"sha512-NTFWTq1TfknjOtOKjj3IfldU7vlMfC23h12N3nYmDeDshGVXqCi/M9oljpyiyndbJxS/oVgHiL5uMSL2Yi8igw==","signatures":[{"sig":"MEYCIQCTG2K0AMCLMprHekaqfdvUUNZx/CNcSCKRSxOM2vwq9QIhAJ0a8IVA5GRalK50cuAh2/Afv+G7gQIIYyr6CV8hXp7G","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20667},"main":"lib/index.js","types":"lib/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"b094d5c032765a30612c2348ce0356d3a50d9feb","scripts":{"dev":"tsc --watch","build":"tsc"},"_npmUser":{"name":"mrpiglr","email":"mrpiglr@aethex.dev"},"repository":{"url":"git+https://github.com/AeThex-Corporation/AeThex-OS.git","type":"git","directory":"packages/aethex-registry"},"_npmVersion":"11.12.1","description":"Plan-based feature gating for SaaS apps — define which features each plan unlocks once, then gate routes, UI, and API endpoints with a single source of truth","directories":{},"_nodeVersion":"22.22.0","dependencies":{"zod":"^3.22.0"},"_hasShrinkwrap":false,"devDependencies":{"react":"^18.0.0","typescript":"^5.3.0","@types/node":"^20.0.0","@types/react":"^18.0.0"},"peerDependencies":{"react":">=17.0.0"},"peerDependenciesMeta":{"react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/registry_2.0.0_1777931413432_0.7751602735021872","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@aethex.os/registry","version":"2.0.1","keywords":["feature-flags","feature-gating","saas","plans","tiers","rbac","access-control","react","hooks","gate","subscription","permissions","aethex"],"author":{"name":"AeThex Corporation"},"license":"MIT","_id":"@aethex.os/registry@2.0.1","maintainers":[{"name":"mrpiglr","email":"mrpiglr@aethex.dev"}],"homepage":"https://aethex.dev","bugs":{"url":"https://github.com/AeThex-Corporation/AeThex-OS/issues"},"dist":{"shasum":"978fbb497a83f30cfb3aadf7101aa125763f0711","tarball":"https://registry.npmjs.org/@aethex.os/registry/-/registry-2.0.1.tgz","fileCount":14,"integrity":"sha512-FSOskJOQRGdJ1rL+BuqKioALraDPf+5ihBvaDU43CRcjYEIbRIZd4saaXzzDojjXqAjRw6aA44nX41VhKaNlPA==","signatures":[{"sig":"MEQCIH8w/xa4KTQd3rf77m+xuXWZH2HNl6VhNgTF/qmAayIiAiAmEU6Mcg/BZ5ANIHsPKRMDAtDo5v0NgXvS6Zd8VL6/og==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23293},"main":"lib/index.js","types":"lib/index.d.ts","engines":{"node":">=18.0.0"},"gitHead":"b094d5c032765a30612c2348ce0356d3a50d9feb","scripts":{"dev":"tsc --watch","build":"tsc"},"_npmUser":{"name":"mrpiglr","email":"mrpiglr@aethex.dev"},"repository":{"url":"git+https://github.com/AeThex-Corporation/AeThex-OS.git","type":"git","directory":"packages/aethex-registry"},"_npmVersion":"11.12.1","description":"Plan-based feature gating for SaaS apps — define which features each plan unlocks once, then gate routes, UI, and API endpoints with a single source of truth","directories":{},"_nodeVersion":"22.22.0","dependencies":{"zod":"^3.22.0"},"_hasShrinkwrap":false,"devDependencies":{"react":"^18.0.0","typescript":"^5.3.0","@types/node":"^20.0.0","@types/react":"^18.0.0"},"peerDependencies":{"react":">=17.0.0"},"peerDependenciesMeta":{"react":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/registry_2.0.1_1777932481841_0.794779172398308","host":"s3://npm-registry-packages-npm-production"}},"2.0.2":{"name":"@aethex.os/registry","version":"2.0.2","description":"Plan-based feature gating for SaaS apps — define which features each plan unlocks once, then gate routes, UI, and API endpoints with a single source of truth","main":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"tsc","dev":"tsc --watch"},"keywords":["feature-flags","feature-gating","saas","plans","tiers","rbac","access-control","react","hooks","gate","subscription","permissions","aethex"],"author":{"name":"AeThex Corporation"},"license":"MIT","homepage":"https://aethex.dev/docs","repository":{"type":"git","url":"git+https://git.aethex.tech/Labs/os.git","directory":"packages/aethex-registry"},"peerDependencies":{"react":">=17.0.0"},"peerDependenciesMeta":{"react":{"optional":true}},"dependencies":{"zod":"^3.22.0"},"devDependencies":{"@types/node":"^20.0.0","@types/react":"^18.0.0","react":"^18.0.0","typescript":"^5.3.0"},"engines":{"node":">=18.0.0"},"bugs":{"url":"https://git.aethex.tech/Labs/os/issues"},"_id":"@aethex.os/registry@2.0.2","gitHead":"6c77abd6440deb925777f64998d4c67a398236e0","_nodeVersion":"22.22.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-FGOsx/vkCd2UL/VUgKuuAR1XvTBDqBG1EvV+2bY0+MsdlYdkjWKAIQ1HUma+iMzAas3/kSgS6Z6yI+9l2F5KLw==","shasum":"8d1aabe527da6cc0ff94a551a5f4594b952ec822","tarball":"https://registry.npmjs.org/@aethex.os/registry/-/registry-2.0.2.tgz","fileCount":14,"unpackedSize":23355,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQD7OBJkBKc4l40sepzByvOPK8BI4pMzlg+KSwA9LMc08gIhAMIGV44ALM/gkGIcLa8dlX3LpXtMO/rBI+eVSg054XCH"}]},"_npmUser":{"name":"mrpiglr","email":"mrpiglr@aethex.dev"},"directories":{},"maintainers":[{"name":"mrpiglr","email":"mrpiglr@aethex.dev"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/registry_2.0.2_1783400211710_0.45222281395266717"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-04T21:42:25.588Z","modified":"2026-07-07T04:56:51.950Z","1.0.0":"2026-05-04T21:42:26.230Z","2.0.0":"2026-05-04T21:50:13.569Z","2.0.1":"2026-05-04T22:08:01.985Z","2.0.2":"2026-07-07T04:56:51.824Z"},"bugs":{"url":"https://git.aethex.tech/Labs/os/issues"},"author":{"name":"AeThex Corporation"},"license":"MIT","homepage":"https://aethex.dev/docs","keywords":["feature-flags","feature-gating","saas","plans","tiers","rbac","access-control","react","hooks","gate","subscription","permissions","aethex"],"repository":{"type":"git","url":"git+https://git.aethex.tech/Labs/os.git","directory":"packages/aethex-registry"},"description":"Plan-based feature gating for SaaS apps — define which features each plan unlocks once, then gate routes, UI, and API endpoints with a single source of truth","maintainers":[{"name":"mrpiglr","email":"mrpiglr@aethex.dev"}],"readme":"# @aethex.os/registry\n\nPlan-based feature gating for SaaS apps. Define which features each plan unlocks once — then enforce it everywhere: React UI, Express routes, page guards.\n\n## Install\n\n```bash\nnpm install @aethex.os/registry\n```\n\n## The problem\n\nFeature checks scattered across your codebase:\n\n```ts\n// ❌ This is everywhere\nif (user.plan === 'pro' || user.plan === 'enterprise') { ... }\nif (user.plan !== 'free') { ... }\n```\n\nWhen you add a new plan, you hunt down every check. When a feature moves tiers, you miss one.\n\n## The fix\n\n```ts\nimport { createRegistry } from '@aethex.os/registry';\n\n// ✅ Define once\nexport const registry = createRegistry({\n  plans: {\n    free:       ['analytics'],\n    pro:        ['analytics', 'exports', 'api_access', 'team_members'],\n    enterprise: ['analytics', 'exports', 'api_access', 'team_members', 'sso', 'audit_logs'],\n  },\n});\n```\n\n## Query from anywhere\n\n```ts\nregistry.can('pro', 'exports')           // true\nregistry.can('free', 'sso')              // false\nregistry.canAll('pro', 'exports', 'sso') // false — needs all\nregistry.canAny('free', 'exports', 'sso')// false — needs any\n\nregistry.features('pro')                 // ['analytics', 'exports', ...]\nregistry.plansWith('sso')                // ['enterprise']\nregistry.isAtLeast('pro', 'free')        // true\n```\n\n## React\n\n```tsx\nimport { RegistryProvider, Gate, useFeature, withFeature } from '@aethex.os/registry';\n\n// Wrap your app\n<RegistryProvider registry={registry} plan={user.plan}>\n  <App />\n</RegistryProvider>\n\n// Gate a component\n<Gate feature=\"exports\" fallback={<UpgradeBanner />}>\n  <ExportButton />\n</Gate>\n\n// Hook\nfunction Toolbar() {\n  const canExport = useFeature('exports');\n  return <button disabled={!canExport}>Export</button>;\n}\n\n// HOC\nconst ExportButton = withFeature('exports', UpgradeBanner)(BaseExportButton);\n```\n\n## Route protection\n\n```ts\nconst registry = createRegistry({\n  plans: { ... },\n  routes: {\n    '/api/export':   { features: ['exports'] },\n    '/api/admin':    { plans: ['enterprise'] },\n  },\n});\n\nregistry.canAccessRoute('/api/export', 'free')       // false\nregistry.canAccessRoute('/api/export', 'pro')        // true\n```\n\n## Express (with @aethex.os/middleware)\n\n```ts\nimport { createCapabilityGuard } from '@aethex.os/middleware';\n\napp.use(createCapabilityGuard({\n  realmCapabilities: registry.config.plans,\n  policies: {\n    '/api/export': { features: ['exports'] },\n  },\n  realmHeader: 'x-user-plan',\n}));\n```\n\n## Part of the @aethex.os ecosystem\n\nSee [@aethex.os/core](https://npmjs.com/package/@aethex.os/core) for the full package list.\n","readmeFilename":"README.md"}