createEntitlementsHook
function createEntitlementsHook<C>(engine, options?): Hook;Defined in: src/flags.ts:171
An OpenFeature hook that enriches every evaluation context with the customer’s entitlement attributes (attributes already in the context win).
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
C extends AnyCatalog |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
engine |
Entitlements<C> |
options? |
EntitlementsHookOptions |
Returns
Section titled “Returns”Hook
Example
Section titled “Example”import { OpenFeature } from "@openfeature/server-sdk";import { createEntitlementsHook } from "@xtandard/entitlements/flags";
OpenFeature.addHooks(createEntitlementsHook(ent, { customerKey: "orgId" }));// a flags rule can now target `entitlement.export_pdf == true` or `plan in ["pro"]`