/home/techb158/cosmic-risk.abdallabala.com/src/integrations/pm-clients
NameSizeModeActions
asana-client.js32490644editdlrm
http-client.js24180644editdlrm
index.js22710644editdlrm
jira-client.js43610644editdlrm
planner-client.js41170644editdlrm
trello-client.js87900644editdlrm
Edit: /home/techb158/cosmic-risk.abdallabala.com/src/integrations/pm-clients/index.js (2271B)
const { TrelloClient } = require("./trello-client"); const { JiraClient } = require("./jira-client"); const { AsanaClient } = require("./asana-client"); const { PlannerClient } = require("./planner-client"); function envCredentials(provider) { if (provider === "TRELLO") { return { apiKey: process.env.TRELLO_API_KEY, token: process.env.TRELLO_TOKEN, listId: process.env.TRELLO_LIST_ID }; } if (provider === "JIRA") { return { accessToken: process.env.JIRA_ACCESS_TOKEN, cloudId: process.env.JIRA_CLOUD_ID, apiEmail: process.env.JIRA_API_EMAIL, apiToken: process.env.JIRA_API_TOKEN, baseUrl: process.env.JIRA_BASE_URL, projectKey: process.env.JIRA_PROJECT_KEY }; } if (provider === "ASANA") { return { accessToken: process.env.ASANA_ACCESS_TOKEN, projectGid: process.env.ASANA_PROJECT_GID }; } if (provider === "MICROSOFT_PLANNER") { return { accessToken: process.env.MICROSOFT_GRAPH_ACCESS_TOKEN, planId: process.env.PLANNER_PLAN_ID, bucketId: process.env.PLANNER_BUCKET_ID }; } return {}; } function createPmClient(provider, credentials = {}, options = {}) { const merged = Object.assign({}, envCredentials(provider), credentials, options); if (provider === "TRELLO") return new TrelloClient(merged); if (provider === "JIRA") return new JiraClient(merged); if (provider === "ASANA") return new AsanaClient(merged); if (provider === "MICROSOFT_PLANNER") return new PlannerClient(merged); throw new Error(`Unsupported live integration provider: ${provider}`); } async function discoverIntegrationResources(provider, credentials = {}, options = {}) { const client = createPmClient(provider, credentials, options); if (typeof client.discoverResources !== "function") return []; return client.discoverResources(); } async function fetchIntegrationWorkItems(provider, credentials = {}, options = {}) { const client = createPmClient(provider, credentials, options); if (typeof client.fetchWorkItems !== "function") { throw new Error(`Provider ${provider} does not support fetchWorkItems.`); } return client.fetchWorkItems(options); } module.exports = { createPmClient, envCredentials, discoverIntegrationResources, fetchIntegrationWorkItems };