Skip to content

@xtandard/entitlements/bun

Bun adapter: entitlementsPanel() returns the web-standard panel handler to hand to Bun.serve({ fetch }), and requireEntitlement() guards a route handler (402 / 403 JSON for denials).

import { … } from "@xtandard/entitlements/bun";
Name Summary
entitlementsPanel Create a Bun-ready panel handler (fetch + engine + openapi).
requireEntitlement Guard a Bun route: resolve the customer from the Request, check (or consume) feature, answer 402 / 403 JSON when denied (401 when no customer), otherwise call the handler with the decision. Returns a wrapper to apply to handlers.
Name Summary
GuardedBunHandler A Bun route handler that also receives the allowing decision.
Name Documented on
CreateFetchHandlerResult @xtandard/entitlements
EntitlementsPanelOptions @xtandard/entitlements
RequireEntitlementOptions @xtandard/entitlements