Rebasely Beta: data may be purged

justintypescript-ultra-strict Public

TypeScript · 9 lines · 454 B · at 503e839

// The designated access-check module: the one place issuePermit may be imported.import type { Option, Permit } from "@tsus/v2";import { issuePermit } from "@tsus/v2/authority";export type RepoId = string & { readonly __brand: "RepoId" };export type ReadRepo = Permit<"repo.read", RepoId>;export const canRead = (role: "owner" | "reader" | "none", repo: RepoId): Option<ReadRepo> =>  role === "none" ? undefined : issuePermit("repo.read", repo);