raycast / extensions

Everything you need to extend Raycast.
https://developers.raycast.com
MIT License
5.37k stars 3.07k forks source link

Something went wrong #4176

Closed torish14 closed 1 year ago

torish14 commented 1 year ago

Extension

https://www.raycast.com/raycast/github

Description

Error:

SyntaxError: Unexpected end of JSON input

xZe:search-repositories.js:1298:10864

---
1295: 
1296: ${n.body}`);let p=H4(n),m=Q4(n);return(0,Ma.jsx)(Ca.Detail,{isLoading:i,markdown:l,navigationTitle:`#${n.number}`,metadata:(0,Ma.jsxs)(Ca.Detail.Metadata,{children:[(0,Ma.jsx)(Ca.Detail.Metadata.Label,{title:"Repository",text:n.repository.nameWithOwner}),(0,Ma.jsx)(Ca.Detail.Metadata.TagList,{title:"Status",children:(0,Ma.jsx)(Ca.Detail.Metadata.TagList.Item,{...p})}),n.updatedAt?(0,Ma.jsx)(Ca.Detail.Metadata.Label,{title:"Updated",text:(0,jne.format)(new Date(n.updatedAt),"dd MMM")}):null,(0,Ma.jsx)(Ca.Detail.Metadata.Label,{title:"Author",...m}),n.assignees&&n.assignees.totalCount>0?(0,Ma.jsx)(Ca.Detail.Metadata.TagList,{title:hs(n.assignees.totalCount,"Assignee"),children:n.assignees.nodes?.map(y=>{if(!y)return null;let h=Mr(y);return(0,Ma.jsx)(Ca.Detail.Metadata.TagList.Item,{...h},y.id)})}):null,n.labels&&n.labels.totalCount>0?(0,Ma.jsx)(Ca.Detail.Metadata.TagList,{title:hs(n.labels.totalCount,"Label"),children:n.labels.nodes?.map(y=>y?(0,Ma.jsx)(Ca.Detail.Metadata.TagList.Item,{text:y.name,color:y.color},y.id):null)}):null,n.projectsV2&&n.projectsV2.totalCount>0?(0,Ma.jsx)(Ca.Detail.Metadata.TagList,{title:hs(n.projectsV2.totalCount,"Project"),children:n.projectsV2.nodes?.map(y=>y?(0,Ma.jsx)(Ca.Detail.Metadata.TagList.Item,{text:y.title},y.id):null)}):null,n.milestone?(0,Ma.jsx)(Ca.Detail.Metadata.Label,{title:"Milestone",text:n.milestone.title}):null]}),actions:(0,Ma.jsx)(Sy,{issue:n,viewer:a,mutateList:t,mutateDetail:s})})}var Z4=require("react/jsx-runtime");function YP({issue:e,viewer:t,mutateList:r}){let a=new Date(e.updatedAt),n=Q4(e),i=H4(e),s=[{date:a,tooltip:`Updated: ${(0,Fne.format)(a,"EEEE d MMMM yyyy 'at' HH:mm")}`},{icon:n.icon,tooltip:`Author: ${n.text}`}];e.comments.totalCount>0&&s.unshift({text:`${e.comments.totalCount}`,icon:Xl.Icon.Bubble});let l=[`${e.number}`];return e.author?.login&&l.push(e.author.login),(0,Z4.jsx)(Xl.List.Item,{title:e.title,subtitle:{value:`#${e.number}`,tooltip:`Repository: ${e.repository.nameWithOwner}`},icon:{value:i.icon,tooltip:`Status: ${i.text}`},keywords:l,accessories:s,actions:(0,Z4.jsx)(Sy,{issue:e,mutateList:r,viewer:t,children:(0,Z4.jsx)(Xl.Action.Push,{title:"Show Details",icon:Xl.Icon.Sidebar,target:(0,Z4.jsx)(KP,{initialIssue:e,viewer:t,mutateList:r})})})},e.id)}var JP=require("react/jsx-runtime");function Gne(e){let{github:t}=Rt(),[r,a]=(0,Vne.useState)(""),n=e.repo&&e.repo.length>0?`repo:${e.repo}`:"",{data:i,isLoading:s,mutate:l}=(0,Bne.usePromise)(async p=>(await t.searchIssues({query:`is:issue ${n} ${p}`,numberOfItems:20})).search.nodes?.map(y=>y),[r]);return(0,JP.jsx)(XP.List,{isLoading:s,onSearchTextChange:a,navigationTitle:e.repo,throttle:!0,children:(0,JP.jsx)(XP.List.Section,{title:"Issues",subtitle:`${i?.length}`,children:i?.map(p=>(0,JP.jsx)(YP,{issue:p,mutateList:l},p.id))})})}var nA=require("@raycast/api"),Yne=ft(Pa()),Jne=require("react");var Zl=require("@raycast/api"),Qne=ft(Xo()),Kne=require("react");var ae=require("@raycast/api"),My=ft(Pa()),Ey=require("react");var or=require("@raycast/api"),e3=ft(Pa());var vs=require("react/jsx-runtime");function ZP({pullRequest:e,mutate:t}){let{github:r}=Rt(),{pop:a}=(0,or.useNavigation)(),{handleSubmit:n,itemProps:i}=(0,e3.useForm)({async onSubmit(s){try{await(0,or.showToast)({style:or.Toast.Style.Animated,title:"Adding Review"}),await r.addPullRequestReview({nodeId:e.id,body:s.comment,event:s.event}),await t(),a(),await(0,or.showToast)({style:or.Toast.Style.Success,title:"Review added"})}catch(l){await(0,or.showToast)({style:or.Toast.Style.Failure,title:"Failed to add review",message:Jt(l)})}},validation:{comment:e3.FormValidation.Required}});return(0,vs.jsxs)(or.Form,{actions:(0,vs.jsx)(or.ActionPanel,{children:(0,vs.jsx)(or.Action.SubmitForm,{title:"Submit",icon:or.Icon.Plus,onSubmit:n})}),children:[(0,vs.jsx)(or.Form.TextArea,{...i.comment,title:"Comment",placeholder:"Add your comments here (markdown is supported)",enableMarkdown:!0}),(0,vs.jsxs)(or.Form.Dropdown,{...i.event,title:"Review Type",children:[(0,vs.jsx)(or.Form.Dropdown.Item,{title:"Comment",value:"COMMENT"}),(0,vs.jsx)(or.Form.Dropdown.Item,{title:"Approve",value:"APPROVE"}),(0,vs.jsx)(or.Form.Dropdown.Item,{title:"Request changes",value:"REQUEST_CHANGES"})]})]})}var qa=require("@raycast/api"),zne=ft(Pa()),t3=ft(Xo()),$ne=require("react");var vi=require("react/jsx-runtime");function eA({pullRequest:e}){let{github:t}=Rt(),{data:r,isLoading:a}=(0,zne.useCachedPromise)(async i=>(await t.pullRequestCommits({nodeId:i.id})).node,[e]),n=(0,$ne.useMemo)(()=>{let i=r?.commits?.nodes;return i&&i.sort((s,l)=>{let p=s?.commit?.authoredDate,m=l?.commit?.authoredDate;return p&&m?(0,t3.compareDesc)(new Date(p),new Date(m)):0}),i},[r]);return(0,vi.jsx)(qa.List,{navigationTitle:`#${e.number} Commits`,isLoading:a,children:n?.map(i=>{if(!i)return null;let s=i.commit,l=new Date(s.authoredDate),p=[{date:l,tooltip:(0,t3.format)(l,"EEEE d MMMM yyyy 'at' HH:mm")}];if(s.statusCheckRollup?.state){let y=X4(s.statusCheckRollup.state);y&&p.unshift(y)}let m;if(s.author){let y={source:s.author.avatarUrl,mask:qa.Image.Mask.Circle};m=s.author.name?{value:y,tooltip:s.author.name}:y}return(0,vi.jsx)(qa.List.Item,{title:s.message,subtitle:{value:s.abbreviatedOid,tooltip:s.oid},accessories:p,...m?{icon:m}:{},actions:(0,vi.jsxs)(qa.ActionPanel,{children:[(0,vi.jsx)(qa.Action.OpenInBrowser,{title:"Open Commit in Browser",url:s.url}),(0,vi.jsx)(qa.Action.OpenInBrowser,{title:"Open Commit Tree in Browser",url:s.treeUrl}),(0,vi.jsxs)(qa.ActionPanel.Section,{children:[(0,vi.jsx)(qa.Action.CopyToClipboard,{content:s.message,title:"Copy Commit URL",shortcut:{modifiers:["cmd","shift"],key:","}}),(0,vi.jsx)(qa.Action.CopyToClipboard,{content:s.message,title:"Copy Commit Hash",shortcut:{modifiers:["cmd","shift"],key:"."}}),(0,vi.jsx)(qa.Action.CopyToClipboard,{content:e.title,title:"Copy Commit Tree URL",shortcut:{modifiers:["ctrl","shift"],key:","}}),(0,vi.jsx)(qa.Action.CopyToClipboard,{content:s.message,title:"Copy Commit Message",shortcut:{modifiers:["ctrl","shift"],key:"."}})]})]})},s.id)})})}var Ge=require("react/jsx-runtime");function Ry({pullRequest:e,viewer:t,mutateList:r,mutateDetail:a,children:n}){let{github:i}=Rt();async function s(){r&&await r(),a&&await a()}async function l(){try{await(0,ae.showToast)({style:ae.Toast.Style.Animated,title:`Reopening pull request #${e.number}`}),await i.reopenPullRequest({nodeId:e.id}),await s(),await(0,ae.showToast)({style:ae.Toast.Style.Success,title:`Pull request #${e.number} is now open`})}catch(O){await(0,ae.showToast)({style:ae.Toast.Style.Failure,title:"Failed reopening pull request",message:Jt(O)})}}async function p(){try{await(0,ae.showToast)({style:ae.Toast.Style.Animated,title:`Closing pull request #${e.number}`}),await i.closePullRequest({nodeId:e.id}),await s(),await(0,ae.showToast)({style:ae.Toast.Style.Success,title:`Pull request #${e.number} closed`})}catch(O){await(0,ae.showToast)({style:ae.Toast.Style.Failure,title:"Failed closing pull request",message:Jt(O)})}}async function m(O){try{await(0,ae.showToast)({style:ae.Toast.Style.Animated,title:`Merging pull request #${e.number}`}),await i.mergePullRequest({nodeId:e.id,method:O}),await s(),await(0,ae.showToast)({style:ae.Toast.Style.Success,title:`Pull request #${e.number} merged`})}catch(C){await(0,ae.showToast)({style:ae.Toast.Style.Failure,title:"Failed merging pull request",message:Jt(C)})}}async function y(O){try{await(0,ae.showToast)({style:ae.Toast.Style.Animated,title:"Assigning to me"});let C=e.assignees.nodes?.filter(N=>!!N).map(N=>N?.id)??[];await i.changePullRequestAssignees({pullRequestId:e.id,assigneeIds:[...C,O]}),await s(),await(0,ae.showToast)({style:ae.Toast.Style.Success,title:"Assigned to me"})}catch(C){await(0,ae.showToast)({style:ae.Toast.Style.Failure,title:"Failed assigning to me",message:Jt(C)})}}async function h(O){try{await(0,ae.showToast)({style:ae.Toast.Style.Animated,title:"Un-assigning from me"});let C=e.assignees.nodes?.filter(N=>!!N).map(N=>N?.id)??[];await i.changePullRequestAssignees({pullRequestId:e.id,assigneeIds:C?.filter(N=>N!==O)}),await s(),await(0,ae.showToast)({style:ae.Toast.Style.Success,title:"Un-assigned from me"})}catch(C){await(0,ae.showToast)({style:ae.Toast.Style.Failure,title:"Failed un-assigning from me",message:Jt(C)})}}let v=!e.closed&&!e.isDraft&&e.mergeable==="MERGEABLE",_=Mr(t),M=e.assignees.nodes?.some(O=>O?.isViewer);return(0,Ge.jsxs)(ae.ActionPanel,{title:`#${e.number} in ${e.repository.nameWithOwner}`,children:[n,(0,Ge.jsx)(ae.Action.OpenInBrowser,{url:e.permalink}),(0,Ge.jsx)(ae.Action.Push,{icon:ae.Icon.Document,title:"Add Review",shortcut:{modifiers:["cmd","shift"],key:"r"},target:(0,Ge.jsx)(ZP,{pullRequest:e,mutate:s})}),(0,Ge.jsx)(ae.Action.Push,{icon:{source:"commit.svg",tintColor:ae.Color.PrimaryText},title:"See Commits",shortcut:{modifiers:["cmd","shift"],key:"c"},target:(0,Ge.jsx)(eA,{pullRequest:e})}),v?(0,Ge.jsxs)(ae.ActionPanel.Section,{children:[e.repository.mergeCommitAllowed?(0,Ge.jsx)(ae.Action,{title:"Create Merge Commit",icon:{source:"merge.svg",tintColor:ae.Color.PrimaryText},shortcut:{modifiers:["cmd","shift"],key:"enter"},onAction:()=>m("MERGE")}):null,e.repository.squashMergeAllowed?(0,Ge.jsx)(ae.Action,{title:"Squash and Merge",icon:{source:"merge.svg",tintColor:ae.Color.PrimaryText},shortcut:{modifiers:["ctrl","shift"],key:"enter"},onAction:()=>m("SQUASH")}):null,e.repository.rebaseMergeAllowed?(0,Ge.jsx)(ae.Action,{title:"Rebase and Merge",icon:{source:"merge.svg",tintColor:ae.Color.PrimaryText},shortcut:{modifiers:["opt","shift"],key:"enter"},onAction:()=>m("REBASE")}):null]}):null,(0,Ge.jsxs)(ae.ActionPanel.Section,{children:[(0,Ge.jsx)(IZe,{pullRequest:e,mutate:s}),t?(0,Ge.jsx)(ae.Action,{title:M?"Un-assign from Me":"Assign to Me",icon:_.icon,shortcut:{modifiers:["cmd","shift"],key:"i"},onAction:()=>M?h(t.id):y(t.id)}):null,(0,Ge.jsx)(MZe,{pullRequest:e,mutate:s}),(0,Ge.jsx)(EZe,{pullRequest:e,mutate:s}),(0,Ge.jsx)(RZe,{pullRequest:e,mutate:s})]}),(0,Ge.jsxs)(ae.ActionPanel.Section,{children:[e.closed&&!e.merged?(0,Ge.jsx)(ae.Action,{title:"Reopen Pull Request",icon:{source:"pull-request.svg",tintColor:ae.Color.PrimaryText},onAction:()=>l()}):null,e.closed?null:(0,Ge.jsx)(ae.Action,{title:"Close Pull Request",style:ae.Action.Style.Destructive,icon:ae.Icon.XMarkCircle,onAction:()=>p()})]}),(0,Ge.jsxs)(ae.ActionPanel.Section,{children:[(0,Ge.jsx)(ae.Action.CopyToClipboard,{content:e.number,title:"Copy Pull Request Number",shortcut:{modifiers:["cmd","shift"],key:"."}}),e.headRef?(0,Ge.jsx)(ae.Action.CopyToClipboard,{content:e.headRef.name,title:"Copy Branch Name",shortcut:{modifiers:["ctrl","shift"],key:"."}}):null,(0,Ge.jsx)(ae.Action.CopyToClipboard,{content:e.permalink,title:"Copy Pull Request URL",shortcut:{modifiers:["cmd","shift"],key:","}}),(0,Ge.jsx)(ae.Action.CopyToClipboard,{content:e.title,title:"Copy Pull Request Title",shortcut:{modifiers:["ctrl","shift"],key:","}}),(0,Ge.jsx)(ae.Action.CopyToClipboard,{content:`[${e.title}](${e.permalink})`,title:"Copy Markdown URL",shortcut:{modifiers:["cmd","shift"],key:";"}})]}),(0,Ge.jsx)(ae.ActionPanel.Section,{children:(0,Ge.jsx)(ae.Action,{icon:ae.Icon.ArrowClockwise,title:"Refresh",onAction:s,shortcut:{modifiers:["cmd"],key:"r"}})})]})}function IZe({pullRequest:e,mutate:t}){let{github:r}=Rt(),[a,n]=(0,Ey.useState)(!1),{data:i,isLoading:s}=(0,My.useCachedPromise)(async p=>r.repositoryCollaboratorsForPullRequests({owner:p.repository.owner.login,name:p.repository.name,pullRequestNumber:p.number}),[e],{execute:a});async function l({id:p,text:m}){try{await(0,ae.showToast)({style:ae.Toast.Style.Animated,title:"Requesting review",message:m}),await r.requestReview({pullRequestId:e.id,collaboratorId:p}),await t(),await(0,ae.showToast)({style:ae.Toast.Style.Success,title:"Requested review",message:m})}catch(y){await(0,ae.showToast)({style:ae.Toast.Style.Failure,title:"Failed requesting review",message:Jt(y)})}}return(0,Ge.jsx)(ae.ActionPanel.Submenu,{title:"Request Review",icon:ae.Icon.AddPerson,shortcut:{modifiers:["ctrl","shift"],key:"r"},onOpen:()=>n(!0),children:s?(0,Ge.jsx)(ae.Action,{title:"Loading..."}):i?.repository?.collaborators?.nodes?.filter(p=>!p?.isViewer).map(p=>{if(!p)return null;let m=Mr(p);return(0,Ge.jsx)(ae.Action,{title:m.text,icon:m.icon,onAction:()=>l({id:p.id,text:m.text})},p.id)})})}function MZe({pullRequest:e,mutate:t}){let{github:r}=Rt(),[a,n]=(0,Ey.useState)(!1),{data:i,isLoading:s}=(0,My.useCachedPromise)(async p=>r.repositoryCollaboratorsForPullRequests({owner:p.repository.owner.login,name:p.repository.name,pullRequestNumber:p.number}),[e],{execute:a});async function l({id:p,text:m}){try{await(0,ae.showToast)({style:ae.Toast.Style.Animated,title:"Adding assignee",message:m});let y=i?.repository?.pullRequest?.assignees.nodes?.filter(h=>!!h).map(h=>h?.id)??[];await r.changePullRequestAssignees({pullRequestId:e.id,assigneeIds:[...y,p]}),await t(),await(0,ae.showToast)({style:ae.Toast.Style.Success,title:"Added assignee",message:m})}catch(y){await(0,ae.showToast)({style:ae.Toast.Style.Failure,title:"Failed adding assignee",message:Jt(y)})}}return(0,Ge.jsx)(ae.ActionPanel.Submenu,{title:"Add Assignee",icon:ae.Icon.AddPerson,shortcut:{modifiers:["cmd","shift"],key:"a"},onOpen:()=>n(!0),children:s?(0,Ge.jsx)(ae.Action,{title:"Loading..."}):i?.repository?.collaborators?.nodes?.map(p=>{if(!p)return null;let m=Mr(p);return(0,Ge.jsx)(ae.Action,{title:m.text,icon:m.icon,onAction:()=>l({id:p.id,text:m.text})},p.id)})})}function EZe({pullRequest:e,mutate:t}){let{github:r}=Rt(),[a,n]=(0,Ey.useState)(!1),{data:i,isLoading:s}=(0,My.useCachedPromise)(async p=>r.repositoryProjectsForPullRequests({owner:p.repository.owner.login,name:p.repository.name,pullRequestNumber:p.number}),[e],{execute:a});async function l({id:p,text:m}){try{await(0,ae.showToast)({style:ae.Toast.Style.Animated,title:"Adding to project",message:m}),await r.addPullRequestToProject({pullRequestId:e.id,projectId:p}),await t(),await(0,ae.showToast)({style:ae.Toast.Style.Success,title:"Added to project",message:m})}catch(y){await(0,ae.showToast)({style:ae.Toast.Style.Failure,title:"Failed adding to project",message:Jt(y)})}}return(0,Ge.jsx)(ae.ActionPanel.Submenu,{title:"Add to Project",icon:{source:"project.svg",tintColor:ae.Color.PrimaryText},shortcut:{modifiers:["cmd","shift"],key:"p"},onOpen:()=>n(!0),children:s?(0,Ge.jsx)(ae.Action,{title:"Loading..."}):i?.repository?.projectsV2.nodes?.map(p=>p?(0,Ge.jsx)(ae.Action,{title:p.title,onAction:()=>l({id:p.id,text:p.title})},p.id):null)})}function RZe({pullRequest:e,mutate:t}){let{github:r}=Rt(),[a,n]=(0,Ey.useState)(!1),{data:i,isLoading:s}=(0,My.useCachedPromise)(async m=>r.milestonesForRepository({owner:m.repository.owner.login,name:m.repository.name}),[e],{execute:a});async function l(){try{await(0,ae.showToast)({style:ae.Toast.Style.Animated,title:"Removing milestone"}),await r.changePullRequestMilestone({pullRequestId:e.id,milestoneId:null}),await t(),await(0,ae.showToast)({style:ae.Toast.Style.Success,title:"Removed milestone"})}catch(m){await(0,ae.showToast)({style:ae.Toast.Style.Failure,title:"Failed removing milestone",message:Jt(m)})}}async function p({id:m,text:y}){try{await(0,ae.showToast)({style:ae.Toast.Style.Animated,title:"Setting milestone",message:y}),await r.changePullRequestMilestone({pullRequestId:e.id,milestoneId:m}),await t(),await(0,ae.showToast)({style:ae.Toast.Style.Success,title:"Milestone set",message:y})}catch(h){await(0,ae.showToast)({style:ae.Toast.Style.Failure,title:"Failed setting milestone",message:Jt(h)})}}return(0,Ge.jsx)(ae.ActionPanel.Submenu,{title:"Set Milestone",icon:{source:"milestone.svg",tintColor:ae.Color.PrimaryText},shortcut:{modifiers:["cmd","shift"],key:"m"},onOpen:()=>n(!0),children:s?(0,Ge.jsx)(ae.Action,{title:"Loading..."}):(0,Ge.jsxs)(Ge.Fragment,{children:[(0,Ge.jsx)(ae.Action,{title:"No Milestone",onAction:()=>l()}),i?.repository?.milestones?.nodes?.map(m=>m?(0,Ge.jsx)(ae.Action,{title:m.title,onAction:()=>p({id:m.id,text:m.title}),autoFocus:e.milestone?.id===m.id},m.id):null)]})})}var Dr=require("@raycast/api"),Wne=ft(Pa()),Hne=ft(Xo());var xr=require("react/jsx-runtime");function tA({initialPullRequest:e,mutateList:t}){let{github:r}=Rt(),a=bs(),{data:n,isLoading:i,mutate:s}=(0,Wne.useCachedPromise)(async h=>(await r.pullRequestDetails({nodeId:h})).node,[e.id],{initialData:e}),l=`# ${n.title}`;n?.body&&(l+=`
1297: 
1298: ${n.body}`);let p=Iy(n),m=J4(n),y=Une(n);return(0,xr.jsx)(Dr.Detail,{isLoading:i,markdown:l,navigationTitle:`#${n.number}`,metadata:(0,xr.jsxs)(Dr.Detail.Metadata,{children:[(0,xr.jsx)(Dr.Detail.Metadata.Label,{title:"Repository",text:n.repository.nameWithOwner}),(0,xr.jsx)(Dr.Detail.Metadata.TagList,{title:"Status",children:(0,xr.jsx)(Dr.Detail.Metadata.TagList.Item,{...p})}),(0,xr.jsx)(Dr.Detail.Metadata.Label,{title:"From",text:n.headRef?.name??n.headRefName}),n.baseRef?(0,xr.jsx)(Dr.Detail.Metadata.Label,{title:"Into",text:n.baseRef?.name??n.baseRefName}):null,n.additions&&n.deletions?(0,xr.jsx)(Dr.Detail.Metadata.Label,{title:"Code Changes",text:`+${n.additions}  -${n.deletions}`}):null,n.createdAt?(0,xr.jsx)(Dr.Detail.Metadata.Label,{title:"Created",text:(0,Hne.format)(new Date(n.createdAt),"dd MMM")}):null,(0,xr.jsx)(Dr.Detail.Metadata.Label,{title:"Author",...m}),y.length>0?(0,xr.jsx)(Dr.Detail.Metadata.TagList,{title:hs(y.length,"Reviewer"),children:y.map(h=>h?(0,xr.jsx)(Dr.Detail.Metadata.TagList.Item,{...h},h.id):null)}):null,n.assignees&&n.assignees.totalCount>0?(0,xr.jsx)(Dr.Detail.Metadata.TagList,{title:hs(n.assignees.totalCount,"Assignee"),children:n.assignees.nodes?.map(h=>{if(!h)return null;let v=Mr(h);return(0,xr.jsx)(Dr.Detail.Metadata.TagList.Item,{...v},h.id)})}):null,n.labels&&n.labels.totalCount>0?(0,xr.jsx)(Dr.Detail.Metadata.TagList,{title:hs(n.labels.totalCount,"Label"),children:n.labels.nodes?.map(h=>h?(0,xr.jsx)(Dr.Detail.Metadata.TagList.Item,{text:h.name,color:h.color},h.id):null)}):null,n.projectsV2&&n.projectsV2.totalCount>0?(0,xr.jsx)(Dr.Detail.Metadata.TagList,{title:hs(n.projectsV2.totalCount,"Project"),children:n.projectsV2.nodes?.map(h=>h?(0,xr.jsx)(Dr.Detail.Metadata.TagList.Item,{text:h.title},h.id):null)}):null,n.milestone?(0,xr.jsx)(Dr.Detail.Metadata.Label,{title:"Milestone",text:n.milestone.title}):null]}),actions:(0,xr.jsx)(Ry,{pullRequest:n,viewer:a,mutateList:t,mutateDetail:s})})}var r3=require("react/jsx-runtime");function rA({pullRequest:e,viewer:t,mutateList:r}){let a=new Date(e.updatedAt),n=(0,Kne.useMemo)(()=>Nne(e),[]),i=J4(e),s=Iy(e),l=kne(e.reviewDecision),p=[{date:a,tooltip:`Updated: ${(0,Qne.format)(a,"EEEE d MMMM yyyy 'at' HH:mm")}`},{icon:i.icon,tooltip:`Author: ${i.text}`}];if(l&&p.unshift(l),n>0&&p.unshift({text:`${n}`,icon:Zl.Icon.Bubble}),e.commits.nodes){let y=e.commits.nodes[0]?.commit.statusCheckRollup?.state,h=y?X4(y):null;h&&p.unshift(h)}let m=[`${e.number}`];return e.author?.login&&m.push(e.author.login),(0,r3.jsx)(Zl.List.Item,{title:e.title,subtitle:{value:`#${e.number}`,tooltip:`Repository: ${e.repository.nameWithOwner}`},icon:{value:s.icon,tooltip:`Status: ${s.text}`},keywords:m,accessories:p,actions:(0,r3.jsx)(Ry,{pullRequest:e,viewer:t,mutateList:r,children:(0,r3.jsx)(Zl.Action.Push,{title:"Show Details",icon:Zl.Icon.Sidebar,target:(0,r3.jsx)(tA,{initialPullRequest:e,viewer:t,mutateList:r})})})},e.id)}var aA=require("react/jsx-runtime");function Xne(e){let{github:t}=Rt(),[r,a]=(0,Jne.useState)(""),n=r,i=e.repo&&e.repo.length>0?`repo:${e.repo}`:"",{data:s,isLoading:l,mutate:p}=(0,Yne.usePromise)(async m=>(await t.searchPullRequests({query:`is:pr ${i} archived:false ${m}`,numberOfItems:20})).search.edges?.map(h=>h?.node),[n]);return(0,aA.jsx)(nA.List,{isLoading:l,onSearchTextChange:a,navigationTitle:e.repo,throttle:!0,children:(0,aA.jsx)(nA.List.Section,{title:"Pull Requests",subtitle:`${s?.length}`,children:s?.map(m=>(0,aA.jsx)(rA,{pullRequest:m,mutateList:p},m.id))})})}var en=require("@raycast/api");var Zne=ft(Pa());function eie(e){let{github:t}=Rt(),[r,a]=e.nameWithOwner.split("/");return(0,Zne.useCachedPromise)((n,i)=>t.repositoryReleases({owner:n,name:i}),[r,a])}var fo=require("react/jsx-runtime");function iA(e){let{data:t,isLoading:r}=eie(e.repository);return(0,fo.jsx)(en.List,{isLoading:r,children:t?.repository?.releases.nodes?.map(a=>a?(0,fo.jsx)(en.List.Item,{title:a.name||a.tagName,subtitle:a.tagName,actions:(0,fo.jsxs)(en.ActionPanel,{title:a.tagName,children:[a.description&&(0,fo.jsx)(en.Action.Push,{icon:en.Icon.Eye,title:"View Release Detail",target:(0,fo.jsx)(wZe,{release:a})}),(0,fo.jsx)(en.Action.OpenInBrowser,{url:a.url})]}),accessories:[{date:new Date(a.publishedAt),tooltip:`Published at: ${new Date(a.publishedAt).toLocaleString()}`}]},a.id):null)})}function wZe(e){return(0,fo.jsx)(en.Detail,{markdown:e.release.description,actions:(0,fo.jsx)(en.ActionPanel,{title:e.release.tagName,children:(0,fo.jsx)(en.Action.OpenInBrowser,{url:e.release.url})})})}var Bt=require("react/jsx-runtime");function oA({repository:e,mutateList:t,onVisit:r}){let{github:a}=Rt(),n=new Date(e.updatedAt);async function i(){await(0,Te.showToast)({style:Te.Toast.Style.Animated,title:"Starring repository",message:e.name});try{await a.addStar({repositoryId:e.id}),await t(),await(0,Te.showToast)({style:Te.Toast.Style.Success,title:"Starred repository",message:e.name})}catch(p){await(0,Te.showToast)({style:Te.Toast.Style.Failure,title:"Failed starring repository",message:Jt(p)})}}async function s(){await(0,Te.showToast)({style:Te.Toast.Style.Animated,title:"Removing star from repository",message:e.name});try{await a.removeStar({repositoryId:e.id}),await t(),await(0,Te.showToast)({style:Te.Toast.Style.Success,title:"Removed star from repository",message:e.name})}catch(p){await(0,Te.showToast)({style:Te.Toast.Style.Failure,title:"Failed removing star from repository",message:Jt(p)})}}let l=[{date:n,tooltip:`Updated: ${(0,rie.format)(n,"EEEE d MMMM yyyy 'at' HH:mm")}`}];return e.primaryLanguage&&l.unshift({text:e.primaryLanguage.name,tooltip:`Language: ${e.primaryLanguage.name}`}),e.viewerHasStarred&&l.unshift({icon:{source:Te.Icon.Star,tintColor:Te.Color.Yellow},tooltip:"You have starred this repository"}),(0,Bt.jsxs)(Te.ActionPanel,{title:e.nameWithOwner,children:[(0,Bt.jsxs)(Te.ActionPanel.Section,{children:[(0,Bt.jsx)(Te.Action.OpenInBrowser,{url:e.url,onOpen:()=>r(e)}),(0,Bt.jsx)(Te.ActionPanel.Submenu,{icon:Te.Icon.Globe,title:"Open in Web IDE",children:CH.map(p=>(0,Bt.jsx)(Te.Action.OpenInBrowser,{title:p.title,icon:p.icon||(0,tie.getFavicon)(p.baseUrl),url:p.baseUrl+e.nameWithOwner,onOpen:()=>r(e)},p.title))}),(0,Bt.jsx)(Te.Action.OpenInBrowser,{icon:"vscode.svg",title:"Clone in VSCode",url:`vscode://vscode.git/clone?url=${e.url}`,shortcut:{modifiers:["cmd","shift"],key:"c"}}),e.viewerHasStarred?(0,Bt.jsx)(Te.Action,{title:"Remove Star from Repository",icon:Te.Icon.StarDisabled,onAction:s,shortcut:{modifiers:["cmd","shift"],key:"f"}}):(0,Bt.jsx)(Te.Action,{title:"Star",icon:Te.Icon.Star,onAction:i,shortcut:{modifiers:["cmd","shift"],key:"f"}})]}),(0,Bt.jsxs)(Te.ActionPanel.Section,{title:"Open in Raycast",children:[(0,Bt.jsx)(Te.Action.Push,{title:"Show Issues",icon:{source:"issue-opened.svg",tintColor:Te.Color.PrimaryText},shortcut:{modifiers:["cmd","opt"],key:"i"},target:(0,Bt.jsx)(Gne,{repo:e.nameWithOwner}),onPush:()=>r(e)}),(0,Bt.jsx)(Te.Action.Push,{title:"Show Pull Requests",icon:{source:"pull-request.svg",tintColor:Te.Color.PrimaryText},shortcut:{modifiers:["cmd","opt"],key:"p"},target:(0,Bt.jsx)(Xne,{repo:e.nameWithOwner}),onPush:()=>r(e)}),e.releases?.totalCount>0&&(0,Bt.jsx)(Te.Action.Push,{icon:Te.Icon.List,title:"Show Releases",shortcut:{modifiers:["cmd","shift"],key:"r"},target:(0,Bt.jsx)(iA,{repository:e})}),e.hasDiscussionsEnabled&&(0,Bt.jsx)(Te.Action.Push,{icon:Te.Icon.SpeechBubble,title:"Show Discussions",shortcut:{modifiers:["cmd","ctrl","opt"],key:"d"},target:(0,Bt.jsx)(One,{repository:e.nameWithOwner}),onPush:()=>r(e)})]}),(0,Bt.jsxs)(Te.ActionPanel.Section,{title:"Open in Browser",children:[(0,Bt.jsx)(Te.Action.OpenInBrowser,{icon:{source:"pull-request.svg",tintColor:Te.Color.PrimaryText},title:"Open Pull Requests",url:`${e.url}/pulls`,shortcut:{modifiers:["cmd","shift"],key:"p"},onOpen:()=>r(e)}),e.hasIssuesEnabled?(0,Bt.jsx)(Te.Action.OpenInBrowser,{icon:{source:"issue-opened.svg",tintColor:Te.Color.PrimaryText},title:"Open Issues",url:`${e.url}/issues`,shortcut:{modifiers:["cmd","shift"],key:"i"},onOpen:()=>r(e)}):null,e.hasWikiEnabled?(0,Bt.jsx)(Te.Action.OpenInBrowser,{icon:{source:"book.svg",tintColor:Te.Color.PrimaryText},title:"Open Wiki",url:`${e.url}/wiki`,shortcut:{modifiers:["cmd","shift"],key:"w"},onOpen:()=>r(e)}):null,e.hasProjectsEnabled&&(0,Bt.jsx)(Te.Action.OpenInBrowser,{icon:{source:"project.svg",tintColor:Te.Color.PrimaryText},title:"Open Projects",url:`${e.url}/projects`,shortcut:{modifiers:["cmd","shift","opt"],key:"p"},onOpen:()=>r(e)})]}),(0,Bt.jsxs)(Te.ActionPanel.Section,{children:[(0,Bt.jsx)(Te.Action.CopyToClipboard,{content:e.url,title:"Copy Repositoy URL",shortcut:{modifiers:["cmd","shift"],key:","}}),(0,Bt.jsx)(Te.Action.CopyToClipboard,{content:`git clone ${e.url}`,title:"Copy Clone Command",shortcut:{modifiers:["cmd","shift"],key:"."}}),(0,Bt.jsx)(Te.Action.CopyToClipboard,{content:e.nameWithOwner,title:"Copy Name with Owner",shortcut:{modifiers:["ctrl","shift"],key:","}}),(0,Bt.jsx)(Te.Action.CopyToClipboard,{content:e.name,title:"Copy Repository Name"}),(0,Bt.jsx)(Te.Action.CopyToClipboard,{content:e.owner.login,title:"Copy Repository Owner"})]})]})}var aie=require("react/jsx-runtime");function a3({repository:e,mutateList:t,onVisit:r}){let a=Mr(e.owner),n=e.stargazerCount,i=new Date(e.updatedAt),s=[{date:i,tooltip:`Updated: ${(0,nie.format)(i,"EEEE d MMMM yyyy 'at' HH:mm")}`}];return e.primaryLanguage&&s.unshift({tag:e.primaryLanguage.name,tooltip:`Language: ${e.primaryLanguage.name}`}),e.viewerHasStarred&&s.unshift({icon:{source:od.Icon.Star,tintColor:od.Color.Yellow},tooltip:"You have starred this repository"}),(0,aie.jsx)(od.List.Item,{icon:a.icon,title:e.name,...n>0?{subtitle:{value:`${n}`,tooltip:`Number of Stars: ${n}`}}:{},accessories:s,actions:(0,aie.jsx)(oA,{repository:e,mutateList:t,onVisit:r})})}var tn=require("@raycast/api");var wu=require("react/jsx-runtime");function sA(e){let t=bs();return(0,wu.jsxs)(tn.List.Dropdown,{tooltip:"Filter Repositories",onChange:e.onFilterChange,storeValue:!0,children:[(0,wu.jsxs)(tn.List.Dropdown.Section,{children:[(0,wu.jsx)(tn.List.Dropdown.Item,{title:"All Repositories",value:""}),t?(0,wu.jsx)(tn.List.Dropdown.Item,{title:"My Repositories",value:`user:${t.login} ${t.organizations?.nodes?.map(r=>`org:${r?.login}`).join(" ")}`}):null]}),(0,wu.jsxs)(tn.List.Dropdown.Section,{children:[t?(0,wu.jsx)(tn.List.Dropdown.Item,{icon:{source:t.avatarUrl??tn.Icon.PersonCircle,mask:tn.Image.Mask.Circle},title:t.login,value:`user:${t.login}`}):null,t?.organizations?.nodes?.map(r=>r?(0,wu.jsx)(tn.List.Dropdown.Item,{icon:{source:r.avatarUrl??tn.Icon.PersonCircle,mask:tn.Image.Mask.Circle},title:r.login,value:`org:${r.login}`},r.login):null)]})]})}function uA({children:e}){return Tne(e)}var yo=require("react/jsx-runtime");function xZe(){let{github:e}=Rt(),t=(0,sd.getPreferenceValues)(),[r,a]=(0,ud.useState)(""),[n,i]=(0,ud.useState)(null),{data:s,visitRepository:l}=NH(r,n),p=(0,ud.useMemo)(()=>`${n} ${r} fork:${t.includeForks}`,[r,n]),{data:m,isLoading:y,mutate:h}=(0,iie.useCachedPromise)(async _=>(await e.searchRepositories({query:_,numberOfItems:20})).search.nodes?.map(O=>O),[p],{keepPreviousData:!0}),v=(0,ud.useMemo)(()=>m?.filter(_=>!s.find(M=>M.id===_.id)),[m]);return(0,yo.jsxs)(sd.List,{isLoading:y,searchBarPlaceholder:"Search in public and private repositories",onSearchTextChange:a,searchBarAccessory:(0,yo.jsx)(sA,{onFilterChange:i}),throttle:!0,children:[(0,yo.jsx)(sd.List.Section,{title:"Visited Repositories",subtitle:s?String(s.length):void 0,children:s.map(_=>(0,yo.jsx)(a3,{repository:_,onVisit:l,mutateList:h},_.id))}),v?(0,yo.jsx)(sd.List.Section,{title:r?"Search Results":"Found Repositories",subtitle:`${v.length}`,children:v.map(_=>(0,yo.jsx)(a3,{repository:_,mutateList:h,onVisit:l},_.id))}):null,(0,yo.jsx)(i9,{searchText:r,isLoading:y})]})}function oie(){return(0,yo.jsx)(uA,{children:(0,yo.jsx)(xZe,{})})}0&&(module.exports={});
1299: /*!
1300:  * content-type
1301:  * Copyright(c) 2015 Douglas Christopher Wilson
---

uA:search-repositories.js:1298:10724
    at oie
wr:index.js:5:2490

Steps To Reproduce

No response

Current Behaviour

No response

Expected Behaviour

No response

raycastbot commented 1 year ago

Thank you for opening this issue!

🔔 @thomaslombart @unnamedd @tonka3000 you might want to have a look.

PS: You can close this issue once resolved by posting @raycastbot close this issue.

thomaslombart commented 1 year ago

Could you indicate the steps to reproduce the issue?