Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

491 B
Raw Blame
import { isNil } from '@activepieces/shared';

function resolveSelected({
  projectId,
  reachableProjectIds,
}: {
  projectId: string | null;
  reachableProjectIds: string[] | null;
}): string | null {
  if (isNil(reachableProjectIds) || reachableProjectIds.length === 0) {
    return projectId;
  }
  if (!isNil(projectId) && reachableProjectIds.includes(projectId)) {
    return projectId;
  }
  return reachableProjectIds[0];
}

export const reachableProjectUtils = { resolveSelected };