function createCapabilityToken
Since 0.1.0
createCapabilityToken(name: string): CapabilityToken

Creates a custom capability token for third-party plugins.

Tokens must be lowercase kebab-case (my-capability). Namespacing by vendor is recommended for community plugins to avoid collisions with standard tokens (acme.payment-gateway).

Examples

Example 1

const PAYMENTS = createCapabilityToken('acme.payment-gateway');
ctx.services.register(PAYMENTS, new StripeGateway());

Parameters

name: string

The token name; lowercase kebab-case segments, optionally separated by dots for namespacing

Return Type

The validated capability token

Throws

TypeError

If the name is not lowercase kebab-case

Usage

import { createCapabilityToken } from "common/src/index.ts";