# CapabilityRegistry Class

Expands a LicenseEntitlement's capability tokens against a table of CapabilityGrants into the concrete functions and features they grant, and answers which token, if any, covers a given function id.

# Constructors

# constructor

+ new CapabilityRegistry(table?: ReadonlyMap‹string, CapabilityGrant›): CapabilityRegistry

Defined in src/license/CapabilityRegistry.ts:28 (opens new window)

Parameters:

Name Type
table? ReadonlyMap‹string, CapabilityGrant

Returns: CapabilityRegistry

# Methods

# capabilityOf

capabilityOf(functionId: string): string | undefined

Defined in src/license/CapabilityRegistry.ts:106 (opens new window)

Returns the capability token a function id is covered by, or undefined if this registry's table does not cover it. The completeness invariant in unit/license/capability-registry.spec.ts guarantees every built-in registered in the static function registry is covered by the table, the core token, or the protected list — so undefined for a function known to the current instance's function registry means it is a custom, instance-registered function rather than an unlisted built-in.

Parameters:

Name Type
functionId string

Returns: string | undefined


# resolve

resolve(entitlement: LicenseEntitlement): ResolvedCapabilities

Defined in src/license/CapabilityRegistry.ts:69 (opens new window)

Expands an entitlement's capability tokens into the concrete functions and features they grant. An unrestricted entitlement short-circuits to an unrestricted result without consulting the table at all. Expansion through implies is transitive and cycle-safe (a visited set guards against a token implying itself, directly or through others); an unrecognized token is skipped without an error.

Parameters:

Name Type Description
entitlement LicenseEntitlement the entitlement to resolve, e.g. one built by hand in a test or produced by PR 3's license-key payload adapter

Returns: ResolvedCapabilities