Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "linear_app-create-issue",
name: "Create Issue",
description: "Create an issue (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api#creating-and-editing-issues)",
version: "0.4.6",
version: "0.4.7",
props: {
linearApp,
teamId: {
Expand Down
2 changes: 1 addition & 1 deletion components/linear_app/actions/get-issue/get-issue.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linear_app-get-issue",
name: "Get Issue",
description: "Get an issue by ID (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api)",
version: "0.1.6",
version: "0.1.7",
type: "action",
props: {
linearApp,
Expand Down
2 changes: 1 addition & 1 deletion components/linear_app/actions/get-teams/get-teams.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "linear_app-get-teams",
name: "Get Teams",
description: "Get all the teams (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api)",
version: "0.2.6",
version: "0.2.7",
type: "action",
props: {
linearApp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
name: "Search Issues",
description: "Search issues (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api)",
type: "action",
version: "0.2.6",
version: "0.2.7",
props: {
linearApp,
query: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
name: "Update Issue",
description: "Update an issue (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api#creating-and-editing-issues)",
type: "action",
version: "0.1.6",
version: "0.1.7",
props: {
linearApp,
teamId: {
Expand Down
1 change: 1 addition & 0 deletions components/linear_app/common/constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const RESOURCE_TYPE = {
ISSUE: "Issue",
ISSUE_LABEL: "IssueLabel",
PROJECT: "Project",
PROJECT_UPDATE: "ProjectUpdate",
CYCLE: "Cycle",
REACTION: "Reaction",
};
Expand Down
29 changes: 29 additions & 0 deletions components/linear_app/common/fragments.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,33 @@ export default {
url
}
`,
projectUpdate: `
fragment ProjectUpdate on ProjectUpdate {
id
body
health
project {
id
name
lead {
id
name
}
initiatives {
nodes {
name
}
}
}
user {
id
}
createdAt
updatedAt
bodyData
slugId
infoSnapshot
url
}
`,
};
28 changes: 28 additions & 0 deletions components/linear_app/common/queries.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,32 @@ export default {
${fragments.project}
${fragments.pageInfo}
`,
listProjectUpdates: `
query ListProjectUpdates(
$filter: ProjectUpdateFilter,
$before: String,
$after: String,
$first: Int,
$last: Int,
$orderBy: PaginationOrderBy
) {
projectUpdates(
filter: $filter,
before: $before,
after: $after,
first: $first,
last: $last,
orderBy: $orderBy
) {
pageInfo {
...PageInfo
}
nodes {
...ProjectUpdate
}
}
}
${fragments.projectUpdate}
${fragments.pageInfo}
`,
};
5 changes: 4 additions & 1 deletion components/linear_app/common/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ function buildVariables(endCursor, args) {
const issueLabels = args.filter.issueLabels
? `, labels: { name: { in: ${JSON.stringify(args.filter.issueLabels)} } }`
: "";
let filter = `${title}${teamId}${projectId}${team}${project}${state}${assigneeId}${issueLabels}`;
const createdAt = args.filter.createdAt
? `, createdAt: { gte: "${args.filter.createdAt.gte}" }`
: "";
let filter = `${title}${teamId}${projectId}${team}${project}${state}${assigneeId}${issueLabels}${createdAt}`;
if (filter[0] === ",") {
filter = filter.substring(2, filter.length);
}
Expand Down
12 changes: 12 additions & 0 deletions components/linear_app/linear_app.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ export default {
async getProject(id) {
return this.client().project(id);
},
async getProjectUpdate(id) {
return this.client().projectUpdate(id);
},
async getState(id) {
return this.client().workflowState(id);
},
Expand All @@ -266,6 +269,15 @@ export default {
});
return projects;
},
async listProjectUpdates(variables) {
const { data: { projectUpdates } } = await this.post({
data: {
query: queries.listProjectUpdates,
variables,
},
});
return projectUpdates;
},
async listUsers(variables = {}) {
return this.client().users(variables);
},
Expand Down
2 changes: 1 addition & 1 deletion components/linear_app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/linear_app",
"version": "0.6.0",
"version": "0.7.0",
"description": "Pipedream Linear_app Components",
"main": "linear_app.app.mjs",
"keywords": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New Created Comment (Instant)",
description: "Emit new event when a new comment is created. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
type: "source",
version: "0.1.8",
version: "0.1.9",
dedupe: "unique",
methods: {
...common.methods,
Expand Down
4 changes: 4 additions & 0 deletions components/linear_app/sources/common/webhook.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export default {
isRelevant() {
return true;
},
isRelevantPolling() {
return true;
},
useGraphQl() {
return true;
},
Expand Down Expand Up @@ -108,6 +111,7 @@ export default {

resources
.reverse()
.filter((resource) => this.isRelevantPolling(resource))
.forEach((resource) => {
this.$emit(resource, this.getMetadata(resource));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New Created Issue (Instant)",
description: "Emit new event when a new issue is created. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
type: "source",
version: "0.3.8",
version: "0.3.9",
dedupe: "unique",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
name: "New Updated Issue (Instant)",
description: "Emit new event when an issue is updated. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
type: "source",
version: "0.3.8",
version: "0.3.9",
dedupe: "unique",
methods: {
...common.methods,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
name: "New Issue Status Updated (Instant)",
description: "Emit new event when the status of an issue is updated. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
type: "source",
version: "0.1.8",
version: "0.1.9",
dedupe: "unique",
props: {
linearApp: common.props.linearApp,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import common from "../common/webhook.mjs";
import constants from "../../common/constants.mjs";
import linearApp from "../../linear_app.app.mjs";

export default {
...common,
key: "linear_app-new-projectupdate-created",
name: "New Project Update Written (Instant)",
description: "Project updates are short status reports on the health of your projects. Emit new event when a new Project Update is written. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",

Check warning on line 9 in components/linear_app/sources/new-projectupdate-created/new-projectupdate-created.mjs

View workflow job for this annotation

GitHub Actions / Lint Code Base

Source descriptions should start with "Emit new". See https://pipedream.com/docs/components/guidelines/#source-description
type: "source",
version: "0.0.1",
dedupe: "unique",
props: {
linearApp,
db: "$.service.db",
teamId: {
label: "Team ID",
type: "string",
propDefinition: [
common.props.linearApp,
"teamId",
],
description: "The identifier or key of the team associated with the project",
reloadProps: true,
},
projectId: {
propDefinition: [
common.props.linearApp,
"projectId",
(c) => ({
teamId: c.teamId,
}),
],
description: "Filter results by project",
},
},
methods: {
...common.methods,
getResourceTypes() {
return [
constants.RESOURCE_TYPE.PROJECT_UPDATE,
];
},
getWebhookLabel() {
return "Project Update created";
},
getResourcesFn() {
return this.linearApp.listProjectUpdates;
},
getResourcesFnArgs() {
return {
orderBy: "createdAt",
filter: {
createdAt: {
gte: "-P1W", // within the last week
},
},
};
},
getResource(projectUpdate) {
return this.linearApp.getProjectUpdate(projectUpdate.id);
},
isRelevant(body) {
const teamIds = body.data.infoSnapshot.teamsInfo.map(({ id }) => id);
return body?.action === "create" && teamIds.includes(this.teamId);
},
isRelevantPolling(resource) {
const teamIds = resource.infoSnapshot.teamsInfo.map(({ id }) => id);
const projectId = resource.project.id;
return (teamIds.includes(this.teamId)) && (!this.projectId || projectId === this.projectId);
},
getMetadata(resource) {
const {
data,
createdAt,
} = resource;
const ts = Date.parse(data?.createdAt || createdAt);
const id = data?.id || resource.id;
return {
id,
summary: `New Project Update: ${id}`,
ts,
};
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
name: "New Updated Project (Instant)",
description: "Emit new event when a project is updated. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
type: "source",
version: "0.0.1",
version: "0.0.2",
dedupe: "unique",
props: {
linearApp,
Expand All @@ -19,6 +19,7 @@ export default {
linearApp,
"teamId",
],
description: "The identifier or key of the team associated with the project",
reloadProps: true,
},
db: "$.service.db",
Expand Down
9 changes: 3 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading