(workspaceId: string)
| 19 | * is not a fork (or has been archived). |
| 20 | */ |
| 21 | export async function getForkParentId(workspaceId: string): Promise<string | null> { |
| 22 | const [row] = await db |
| 23 | .select({ parentId: workspace.forkedFromWorkspaceId }) |
| 24 | .from(workspace) |
| 25 | .where(and(eq(workspace.id, workspaceId), isNull(workspace.archivedAt))) |
| 26 | .limit(1) |
| 27 | return row?.parentId ?? null |
| 28 | } |
| 29 | |
| 30 | /** The parent lineage node for a fork, or null when it has no live parent. */ |
| 31 | export async function getForkParent(workspaceId: string): Promise<ForkLineageNode | null> { |
no test coverage detected