28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import type { CapabilityId } from "@suaveplan/api-types/capabilities";
|
|
|
|
/**
|
|
* Literal token this package contributes to the global `CapabilityId` union.
|
|
*
|
|
* The `CapabilityId` union in `@suaveplan/api-types/capabilities` already
|
|
* lists `"auth.session"` directly; re-exporting it here as a literal makes the
|
|
* contribution legible at the consumption site and lets the conformance test
|
|
* `expectTypeOf<AuthSessionCapabilityId>().toMatchTypeOf<CapabilityId>()` pin
|
|
* the membership without depending on the order of identifiers inside the
|
|
* union.
|
|
*
|
|
* `AUTH_SESSION_CAPABILITY_ID` exports the runtime literal for places that
|
|
* declare `requires: [AUTH_SESSION_CAPABILITY_ID] as const`.
|
|
*/
|
|
export type AuthSessionCapabilityId = "auth.session";
|
|
|
|
export const AUTH_SESSION_CAPABILITY_ID: AuthSessionCapabilityId =
|
|
"auth.session";
|
|
|
|
/**
|
|
* Compile-time assertion that `"auth.session"` is assignable to
|
|
* `CapabilityId`. The assignment is the assertion; if `api-types` ever
|
|
* removed the token, this line would fail to type-check at build time.
|
|
*/
|
|
const _assignable: CapabilityId = AUTH_SESSION_CAPABILITY_ID;
|
|
void _assignable;
|