Team Ai
Apppublic

admin08077/Githubgemini

sourceHugging Faceotherupdated 11mo agoView on Hugging Face
0likes
workspaceConnectorService-KhhKdOYD.js3 linesDownload Raw Back to assets
1import{a9 as i,l as u,e as s}from"./index-CX7Qxd1D.js";const n=new Map;n.set("jira_create_ticket",{id:"jira_create_ticket",service:"Jira",description:"Creates a new issue in a Jira project.",getParameters:()=>({projectKey:{type:"string",required:!0},summary:{type:"string",required:!0},description:{type:"string",required:!1},issueType:{type:"string",required:!0,default:"Task"}}),execute:async e=>{const o=await s("jira_domain"),t=await s("jira_pat"),r=await s("jira_email");if(!o||!t||!r)throw new Error("Jira credentials not found in vault. Please connect Jira in the Workspace Connector Hub.");const c={type:"doc",version:1,content:[{type:"paragraph",content:[{text:e.description||"",type:"text"}]}]},a=await fetch(`https://${o}/rest/api/3/issue`,{method:"POST",headers:{Authorization:`Basic ${btoa(`${r}:${t}`)}`,Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({fields:{project:{key:e.projectKey},summary:e.summary,description:c,issuetype:{name:e.issueType||"Task"}}})});if(!a.ok){const p=await a.text();throw new Error(`Jira API Error (${a.status}): ${p}`)}return a.json()}});n.set("slack_post_message",{id:"slack_post_message",service:"Slack",description:"Posts a message to a Slack channel.",getParameters:()=>({channel:{type:"string",required:!0},text:{type:"string",required:!0}}),execute:async e=>{const o=await s("slack_bot_token");if(!o)throw new Error("Slack credentials not found in vault. Please connect Slack in the Workspace Connector Hub.");const t=await fetch("https://slack.com/api/chat.postMessage",{method:"POST",headers:{Authorization:`Bearer ${o}`,"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify({channel:e.channel,text:e.text})});if(!t.ok){const r=await t.json();throw new Error(`Slack API Error: ${r.error}`)}return t.json()}});async function y(e,o){const t=n.get(e);if(!t)throw new Error(`Action "${e}" not found.`);i("workspace_action_execute",{actionId:e});try{const r=await t.execute(o);return i("workspace_action_success",{actionId:e}),r}catch(r){throw u(r,{context:"executeWorkspaceAction",actionId:e}),r}}export{n as A,y as e};2//# sourceMappingURL=workspaceConnectorService-KhhKdOYD.js.map3