diff --git a/components/linear_app/actions/create-issue/create-issue.mjs b/components/linear_app/actions/create-issue/create-issue.mjs index b9bef8a3a2582..dce521454c01c 100644 --- a/components/linear_app/actions/create-issue/create-issue.mjs +++ b/components/linear_app/actions/create-issue/create-issue.mjs @@ -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: { diff --git a/components/linear_app/actions/get-issue/get-issue.mjs b/components/linear_app/actions/get-issue/get-issue.mjs index 921f1d793df48..0dd7e2b3de2b0 100644 --- a/components/linear_app/actions/get-issue/get-issue.mjs +++ b/components/linear_app/actions/get-issue/get-issue.mjs @@ -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, diff --git a/components/linear_app/actions/get-teams/get-teams.mjs b/components/linear_app/actions/get-teams/get-teams.mjs index 0333b3ffe1555..f1bbf6efbfd47 100644 --- a/components/linear_app/actions/get-teams/get-teams.mjs +++ b/components/linear_app/actions/get-teams/get-teams.mjs @@ -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, diff --git a/components/linear_app/actions/search-issues/search-issues.mjs b/components/linear_app/actions/search-issues/search-issues.mjs index bad7afb67ac46..b0227f121ca96 100644 --- a/components/linear_app/actions/search-issues/search-issues.mjs +++ b/components/linear_app/actions/search-issues/search-issues.mjs @@ -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: { diff --git a/components/linear_app/actions/update-issue/update-issue.mjs b/components/linear_app/actions/update-issue/update-issue.mjs index e2a189d4290c5..1b4d1e6a517ad 100644 --- a/components/linear_app/actions/update-issue/update-issue.mjs +++ b/components/linear_app/actions/update-issue/update-issue.mjs @@ -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: { diff --git a/components/linear_app/common/constants.mjs b/components/linear_app/common/constants.mjs index f7a555c872fde..30c487543a70a 100644 --- a/components/linear_app/common/constants.mjs +++ b/components/linear_app/common/constants.mjs @@ -13,6 +13,7 @@ const RESOURCE_TYPE = { ISSUE: "Issue", ISSUE_LABEL: "IssueLabel", PROJECT: "Project", + PROJECT_UPDATE: "ProjectUpdate", CYCLE: "Cycle", REACTION: "Reaction", }; diff --git a/components/linear_app/common/fragments.mjs b/components/linear_app/common/fragments.mjs index f0d3dc21890fc..a823d0fc97f70 100644 --- a/components/linear_app/common/fragments.mjs +++ b/components/linear_app/common/fragments.mjs @@ -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 + } + `, }; diff --git a/components/linear_app/common/queries.mjs b/components/linear_app/common/queries.mjs index a8ebf50f6e752..086484d1a891c 100644 --- a/components/linear_app/common/queries.mjs +++ b/components/linear_app/common/queries.mjs @@ -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} + `, }; diff --git a/components/linear_app/common/utils.mjs b/components/linear_app/common/utils.mjs index 3c5d57853155d..c5d9c214c8463 100644 --- a/components/linear_app/common/utils.mjs +++ b/components/linear_app/common/utils.mjs @@ -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); } diff --git a/components/linear_app/linear_app.app.mjs b/components/linear_app/linear_app.app.mjs index 2b446a0f0070f..c6c0986e06f51 100644 --- a/components/linear_app/linear_app.app.mjs +++ b/components/linear_app/linear_app.app.mjs @@ -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); }, @@ -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); }, diff --git a/components/linear_app/package.json b/components/linear_app/package.json index a35d5e3f301f2..48a839d2c50b9 100644 --- a/components/linear_app/package.json +++ b/components/linear_app/package.json @@ -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": [ diff --git a/components/linear_app/sources/comment-created-instant/comment-created-instant.mjs b/components/linear_app/sources/comment-created-instant/comment-created-instant.mjs index 27a3b0d075a1c..5d0af9f2e99c3 100644 --- a/components/linear_app/sources/comment-created-instant/comment-created-instant.mjs +++ b/components/linear_app/sources/comment-created-instant/comment-created-instant.mjs @@ -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, diff --git a/components/linear_app/sources/common/webhook.mjs b/components/linear_app/sources/common/webhook.mjs index 155b7baf0f211..0b7fb23767c77 100644 --- a/components/linear_app/sources/common/webhook.mjs +++ b/components/linear_app/sources/common/webhook.mjs @@ -61,6 +61,9 @@ export default { isRelevant() { return true; }, + isRelevantPolling() { + return true; + }, useGraphQl() { return true; }, @@ -108,6 +111,7 @@ export default { resources .reverse() + .filter((resource) => this.isRelevantPolling(resource)) .forEach((resource) => { this.$emit(resource, this.getMetadata(resource)); }); diff --git a/components/linear_app/sources/issue-created-instant/issue-created-instant.mjs b/components/linear_app/sources/issue-created-instant/issue-created-instant.mjs index 226c32bbf0daa..4a92022348116 100644 --- a/components/linear_app/sources/issue-created-instant/issue-created-instant.mjs +++ b/components/linear_app/sources/issue-created-instant/issue-created-instant.mjs @@ -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, diff --git a/components/linear_app/sources/issue-updated-instant/issue-updated-instant.mjs b/components/linear_app/sources/issue-updated-instant/issue-updated-instant.mjs index a4739a35c1375..40d1faefbd43b 100644 --- a/components/linear_app/sources/issue-updated-instant/issue-updated-instant.mjs +++ b/components/linear_app/sources/issue-updated-instant/issue-updated-instant.mjs @@ -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, diff --git a/components/linear_app/sources/new-issue-status-updated/new-issue-status-updated.mjs b/components/linear_app/sources/new-issue-status-updated/new-issue-status-updated.mjs index d0a721258ac99..0583e546a0fea 100644 --- a/components/linear_app/sources/new-issue-status-updated/new-issue-status-updated.mjs +++ b/components/linear_app/sources/new-issue-status-updated/new-issue-status-updated.mjs @@ -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, diff --git a/components/linear_app/sources/new-projectupdate-created/new-projectupdate-created.mjs b/components/linear_app/sources/new-projectupdate-created/new-projectupdate-created.mjs new file mode 100644 index 0000000000000..2f6963dba9110 --- /dev/null +++ b/components/linear_app/sources/new-projectupdate-created/new-projectupdate-created.mjs @@ -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)", + 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, + }; + }, + }, +}; diff --git a/components/linear_app/sources/project-updated-instant/project-updated-instant.mjs b/components/linear_app/sources/project-updated-instant/project-updated-instant.mjs index 66ed456f84298..fa890ec44efa7 100644 --- a/components/linear_app/sources/project-updated-instant/project-updated-instant.mjs +++ b/components/linear_app/sources/project-updated-instant/project-updated-instant.mjs @@ -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, @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 238fbc657204a..a772a641b3697 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1554,8 +1554,7 @@ importers: components/calllerapi: {} - components/callminer: - specifiers: {} + components/callminer: {} components/callpage: dependencies: @@ -3283,8 +3282,7 @@ importers: components/eodhd_apis: {} - components/epic_games: - specifiers: {} + components/epic_games: {} components/epsy: dependencies: @@ -6030,8 +6028,7 @@ importers: components/logistia_route_planner: {} - components/logo_dev: - specifiers: {} + components/logo_dev: {} components/logoraisr: {}