Skip to content

Commit

Permalink
Clean up issue and project search actions
Browse files Browse the repository at this point in the history
  • Loading branch information
leelasn committed Dec 18, 2024
1 parent fdd33e3 commit c4b93a2
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 107 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "linear-zapier",
"version": "4.4.5",
"version": "4.4.6",
"description": "Linear's Zapier integration",
"main": "index.js",
"license": "MIT",
Expand Down
82 changes: 36 additions & 46 deletions src/searches/issue.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
import { ZObject, Bundle } from "zapier-platform-core";
import { IssueCommon } from "../triggers/issueV2";

interface IssueResponse {
data: {
issue: {
id: string;
title: string;
description: string;
url: string;
assignee: {
id: string;
email: string;
name: string;
};
};
issue: IssueCommon;
};
}

Expand All @@ -33,39 +24,39 @@ const getIssue = async (z: ZObject, bundle: Bundle) => {
description
url
assignee {
id
email
name
url
isMe
displayName
active
id
email
name
url
isMe
displayName
active
}
archivedAt
canceledAt
cycle {
id
name
description
id
name
description
}
completedAt
createdAt
creator {
id
email
name
url
isMe
displayName
active
id
email
name
url
isMe
displayName
active
}
dueDate
estimate
number
parent {
id
url
title
id
url
title
}
priority
priorityLabel
Expand All @@ -75,12 +66,12 @@ const getIssue = async (z: ZObject, bundle: Bundle) => {
triagedAt
updatedAt
team {
id
name
organization {
id
name
}
id
name
organization {
id
name
}
}
}
}`,
Expand All @@ -98,20 +89,19 @@ export const findIssueByID = {
noun: "Issue",

display: {
label: "Find Issue by ID",
label: "Find issue by ID",
hidden: false,
description:
"Find an Issue by ID.",
description: "Find an issue by ID.",
},

operation: {
perform: getIssue,
inputFields: [
{
key: "id",
required: true,
label: "ID of Issue",
}
]
{
key: "id",
required: true,
label: "ID of issue",
},
],
},
};
94 changes: 36 additions & 58 deletions src/searches/project.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
import { ZObject, Bundle } from "zapier-platform-core";
import { ProjectApi } from "../triggers/newProject";

interface ProjectResponse {
data: {
project: {
id: string;
name: string;
url: string;
creator: {
id: string;
email: string;
name: string;
};
};
project: ProjectApi;
};
}

Expand All @@ -27,51 +19,38 @@ const getProject = async (z: ZObject, bundle: Bundle) => {
query: `
query Project {
project(id: ${bundle.inputData.id}) {
id
url
name
description
priority
createdAt
updatedAt
startDate
targetDate
status {
id
name
url
archivedAt
canceledAt
autoArchivedAt
completedAt
completedIssueCountHistory
content
createdAt
creator {
id
email
name
url
isMe
displayName
active
type
}
teams {
nodes {
id
name
}
currentProgress
description
health
healthUpdatedAt
lead {
id
email
name
url
isMe
displayName
active
}
initiatives {
nodes {
id
name
}
priority
prioritySortOrder
projectUpdateRemindersPausedUntilAt
slugId
startDate
startedAt
startDateResolution
status {
name
}
projectMilestones {
nodes {
id
name
}
targetDate
trashed
updatedAt
}
}
}`,
},
Expand All @@ -90,18 +69,17 @@ export const findProjectByID = {
display: {
label: "Find Project by ID",
hidden: false,
description:
"Find a Project by ID.",
description: "Find a Project by ID.",
},

operation: {
perform: getProject,
inputFields: [
{
key: "id",
required: true,
label: "Project ID or Slug ID",
}
]
{
key: "id",
required: true,
label: "Project ID or Slug ID",
},
],
},
};
2 changes: 1 addition & 1 deletion src/triggers/issueV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { unsubscribeHook } from "../handleWebhook";
import { jsonToGraphQLQuery, VariableType } from "json-to-graphql-query";
import { fetchFromLinear } from "../fetchFromLinear";

interface IssueCommon {
export interface IssueCommon {
id: string;
identifier: string;
url: string;
Expand Down
2 changes: 1 addition & 1 deletion src/triggers/newProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface ProjectCommon {
};
}

interface ProjectApi extends ProjectCommon {
export interface ProjectApi extends ProjectCommon {
teams: {
nodes: IdAndName[];
};
Expand Down

0 comments on commit c4b93a2

Please sign in to comment.