# CapabilityRegistry

Expands a [LicenseEntitlement](../interfaces/licenseentitlement.md)'s capability tokens against a table of
[CapabilityGrant](../interfaces/capabilitygrant.md)s 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](../interfaces/capabilitygrant.md)›): *[CapabilityRegistry](capabilityregistry.md)*

*Defined in [src/license/CapabilityRegistry.ts:28](https://github.com/handsontable/hyperformula/blob/dcf9354/src/license/CapabilityRegistry.ts#L28)*

**Parameters:**

Name | Type |
------ | ------ |
`table?` | ReadonlyMap‹string, [CapabilityGrant](../interfaces/capabilitygrant.md)› |

**Returns:** *[CapabilityRegistry](capabilityregistry.md)*

## Methods

### capabilityOf 

▸ **capabilityOf**(`functionId`: string): *string | undefined*

*Defined in [src/license/CapabilityRegistry.ts:114](https://github.com/handsontable/hyperformula/blob/dcf9354/src/license/CapabilityRegistry.ts#L114)*

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](../interfaces/licenseentitlement.md)): *[ResolvedCapabilities](../interfaces/resolvedcapabilities.md)*

*Defined in [src/license/CapabilityRegistry.ts:70](https://github.com/handsontable/hyperformula/blob/dcf9354/src/license/CapabilityRegistry.ts#L70)*

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. Tokens are matched case-insensitively (the table is keyed by
the normalized spelling — see [normalizeCapabilityToken](../globals.md#normalizecapabilitytoken)). 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](../interfaces/licenseentitlement.md) | the entitlement to resolve, e.g. one built by hand in a test or produced by the license-key payload adapter  |

**Returns:** *[ResolvedCapabilities](../interfaces/resolvedcapabilities.md)*