Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

685 B
Raw Blame
import type { ImportConnectionInput } from "../schema";
import {
  importHttpError,
  openImportSource,
} from "../source/open-import-source";

const LIST_TIMEOUT_MS = 90_000;

async function listSourceProjects(connection: ImportConnectionInput) {
  const opened = await openImportSource(
    connection,
    AbortSignal.timeout(LIST_TIMEOUT_MS),
  );

  try {
    const projects = await opened.source.listProjects();
    return {
      projects: projects.map(({ id, name, detail }) => ({
        id,
        name,
        ...(detail ? { detail } : {}),
      })),
    };
  } catch (error) {
    throw importHttpError(opened.describe(error));
  }
}

export default listSourceProjects;