pr_01m47d24b0e6n91zwymwxg0vpx/apps/web/app/lib/compute.server.ts
| 1 | /** |
| 2 | * The note shown before someone starts compute their workspace's plan would |
| 3 | * refuse (`computeNote` in `@g1t/contracts` compute.ts). Members only: the |
| 4 | * routes that call it decide who sees it. |
| 5 | */ |
| 6 | import { type ComputeKind, computeNote, readEntitlements } from "@g1t/contracts"; |
| 7 | |
| 8 | import { billing } from "./services.server"; |
| 9 | |
| 10 | /** Null when the plan would let it start, or billing cannot say. */ |
| 11 | export async function computeNoteFor(workspace: string, kind: ComputeKind, isPublic = false): Promise<string | null> { |
| 12 | const ent = readEntitlements(await billing.entitlements(workspace.toLowerCase()).catch(() => null)); |
| 13 | return ent ? computeNote(ent, kind, isPublic, workspace) : null; |
| 14 | } |