@xemahq/entitlement-client
v0.1.2
Published
Layer-1 NestJS client for the Xema edition/entitlement primitive. EntitlementService resolves per-org entitlement against identity-api and applies the deployment ceiling (XEMA_EDITION) CLIENT-SIDE via @xemahq/entitlement-contracts, fail-closed to communit
Downloads
289
Readme
@xemahq/entitlement-client
NestJS client that resolves per-org entitlements.
Overview
A NestJS module and injectable service that resolves an organization's effective entitlement at runtime. It fetches the per-org entitlement, applies the deployment ceiling client-side so a stale upstream can never grant more than the build allows, and caches results with a short TTL and in-flight de-duplication. It is fail-closed: any error, timeout, or unknown state resolves to the most restrictive edition.
When to use it
- Use it inside a NestJS service that needs to gate a feature on an organization's effective entitlement.
- Reach for
@xemahq/entitlement-contractsinstead when you only need the pure types and resolvers without a NestJS client.
Installation
pnpm add @xemahq/entitlement-clientUsage
import { EntitlementService } from '@xemahq/entitlement-client';
constructor(private readonly entitlements: EntitlementService) {}
async canUse(orgId: string, key: EntitlementKey): Promise<boolean> {
return this.entitlements.isEntitled(orgId, key);
}Peer requirements
@nestjs/commonand@nestjs/core>= 10reflect-metadata>= 0.1.12
License
Apache-2.0 © Xema — xema.dev
