Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Integrations are a directory of connectors, for a workspace and for each person | 1 | import type { ProviderKind } from "@g1t/contracts"; |
| 2 | ||
| 3 | /** | |
| 4 | * The workspace's integration setup pages, under `-/integrations/<section>`: | |
| 5 | * one for each kind of provider connection. The directory at | |
| 6 | * `-/integrations` links into them. | |
| 7 | */ | |
| 8 | export type IntegrationsSection = "models" | "alerts" | "trackers"; | |
| 9 | ||
| 10 | const SECTIONS: Record<ProviderKind, IntegrationsSection> = { | |
| 11 | models: "models", | |
| 12 | alerts: "alerts", | |
| 13 | tracker: "trackers", | |
| 14 | }; | |
| 15 | ||
| 16 | /** The page a kind of provider is set up on. */ | |
| 17 | export function integrationsSection(kind: ProviderKind): IntegrationsSection { | |
| 18 | return SECTIONS[kind]; | |
| 19 | } | |
| 20 | ||
| 21 | /** The kind of provider a section's page is for, or null when it is no section. */ | |
| 22 | export function sectionKind(section: string | undefined): ProviderKind | null { | |
| 23 | const found = (Object.keys(SECTIONS) as ProviderKind[]).find((kind) => SECTIONS[kind] === section); | |
| 24 | return found ?? null; | |
| 25 | } |