requireEntitlement
function requireEntitlement<C>( engine, feature, options): (handler) => (request) => Promise<Response>;Defined in: src/adapters/bun.ts:55
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.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
C extends AnyCatalog |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
engine |
Entitlements<C> |
feature |
FeatureKey<C> |
options |
RequireEntitlementOptions<Request> |
Returns
Section titled “Returns”(handler) => (request) => Promise<Response>