Skip to content

@xtandard/entitlements/elysia

Elysia 1.x adapter: entitlementsPanel() to mount the panel as a plain handler, entitlementsElysia(), a typed plugin whose routes Eden treaty can see, and the requireEntitlement() beforeHandle guard.

import { … } from "@xtandard/entitlements/elysia";
Name Summary
entitlementsElysia Typed Elysia plugin exposing the whole HTTP API so the Eden client can call it with full path / method / param / body typing. Every handler delegates to the shared fetch pipeline; a catch-all serves the bundled UI. The engine is decorated onto the context as entitlements, so the host’s own handlers can meter in-process: ({ entitlements }) => entitlements.consume(…).
entitlementsPanel Create a panel handler suitable for Elysia.mount(path, handler).
requireEntitlement An Elysia beforeHandle guard (works on 1.x and 2.x): answers 402 / 403 JSON for denials, 401 without a customer; for an allowed request it sets ctx.entitlement and lets the handler run.
Name Summary
ElysiaEntitlementsHandler A web-standard fetch handler with engine + openapi() attached.
ElysiaGuardContext The minimal Elysia context the guard reads / writes (both majors).
EntitlementsElysiaOptions Options for entitlementsElysia.
Name Summary
EntitlementsElysiaPlugin The typed plugin entitlementsElysia returns: an Elysia instance whose route table (every route with its params and body schema) is what Eden treaty infers from typeof app.
Name Documented on
EntitlementsPanelOptions @xtandard/entitlements
RequireEntitlementOptions @xtandard/entitlements