Initial Commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user