diff --git a/components/linear/package.json b/components/linear/package.json index 03b803ace5f26..e29596222b378 100644 --- a/components/linear/package.json +++ b/components/linear/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/linear", - "version": "0.5.5", + "version": "0.5.6", "description": "Pipedream Linear Components", "main": "linear.app.mjs", "keywords": [ @@ -15,6 +15,6 @@ }, "dependencies": { "@linear/sdk": "^13.0.0", - "@pipedream/platform": "^1.3.0" + "@pipedream/platform": "^3.0.3" } } diff --git a/components/linear/sources/comment-created-instant/comment-created-instant.mjs b/components/linear/sources/comment-created-instant/comment-created-instant.mjs index 801598f2ce034..d361edcf7eb5a 100644 --- a/components/linear/sources/comment-created-instant/comment-created-instant.mjs +++ b/components/linear/sources/comment-created-instant/comment-created-instant.mjs @@ -10,5 +10,5 @@ export default { ...utils.getAppProps(commentCreatedInstant), key: "linear-comment-created-instant", description: "Emit new event when a new comment is created (OAuth). See the docs [here](https://developers.linear.app/docs/graphql/webhooks)", - version: "0.1.5", + version: "0.1.6", }; diff --git a/components/linear/sources/issue-created-instant/issue-created-instant.mjs b/components/linear/sources/issue-created-instant/issue-created-instant.mjs index fa125ff7f88c5..3287572d70695 100644 --- a/components/linear/sources/issue-created-instant/issue-created-instant.mjs +++ b/components/linear/sources/issue-created-instant/issue-created-instant.mjs @@ -10,5 +10,5 @@ export default { ...utils.getAppProps(issueCreatedInstant), key: "linear-issue-created-instant", description: "Emit new event when a new issue is created (OAuth). See the docs [here](https://developers.linear.app/docs/graphql/webhooks)", - version: "0.3.5", + version: "0.3.6", }; diff --git a/components/linear/sources/issue-updated-instant/issue-updated-instant.mjs b/components/linear/sources/issue-updated-instant/issue-updated-instant.mjs index 8b23b84c84518..7ef63f97e301f 100644 --- a/components/linear/sources/issue-updated-instant/issue-updated-instant.mjs +++ b/components/linear/sources/issue-updated-instant/issue-updated-instant.mjs @@ -10,5 +10,5 @@ export default { ...utils.getAppProps(issueUpdatedInstant), key: "linear-issue-updated-instant", description: "Emit new event when an issue is updated (OAuth). See the docs [here](https://developers.linear.app/docs/graphql/webhooks)", - version: "0.3.5", + version: "0.3.6", }; diff --git a/components/linear/sources/new-issue-status-updated/new-issue-status-updated.mjs b/components/linear/sources/new-issue-status-updated/new-issue-status-updated.mjs index 7b365bd6a4551..c6da4f42d6283 100644 --- a/components/linear/sources/new-issue-status-updated/new-issue-status-updated.mjs +++ b/components/linear/sources/new-issue-status-updated/new-issue-status-updated.mjs @@ -10,5 +10,5 @@ export default { ...utils.getAppProps(newIssueStatusUpdated), key: "linear-new-issue-status-updated", description: "Emit new event when the status of an issue is updated (OAuth). See the docs [here](https://developers.linear.app/docs/graphql/webhooks)", - version: "0.1.5", + version: "0.1.6", }; diff --git a/components/linear_app/package.json b/components/linear_app/package.json index cd607b4a3f0bd..c8c3f683ebfb6 100644 --- a/components/linear_app/package.json +++ b/components/linear_app/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/linear_app", - "version": "0.5.5", + "version": "0.5.6", "description": "Pipedream Linear_app Components", "main": "linear_app.app.mjs", "keywords": [ @@ -15,6 +15,6 @@ }, "dependencies": { "@linear/sdk": "^13.0.0", - "@pipedream/platform": "^1.3.0" + "@pipedream/platform": "^3.0.3" } } 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 7f2fb33dd74c3..7af2125de05cf 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 docs [here](https://developers.linear.app/docs/graphql/webhooks)", type: "source", - version: "0.1.5", + version: "0.1.6", dedupe: "unique", methods: { ...common.methods, diff --git a/components/linear_app/sources/common/webhook.mjs b/components/linear_app/sources/common/webhook.mjs index 8f9e6da8fab82..67d31aca1c64d 100644 --- a/components/linear_app/sources/common/webhook.mjs +++ b/components/linear_app/sources/common/webhook.mjs @@ -1,6 +1,7 @@ import linearApp from "../../linear_app.app.mjs"; import constants from "../../common/constants.mjs"; import utils from "../../common/utils.mjs"; +import { ConfigurationError } from "@pipedream/platform"; export default { props: { @@ -12,6 +13,7 @@ export default { linearApp, "teamId", ], + reloadProps: true, }, projectId: { propDefinition: [ @@ -22,6 +24,17 @@ export default { http: "$.interface.http", db: "$.service.db", }, + async additionalProps() { + const props = {}; + if (!(await this.isAdmin())) { + props.alert = { + type: "alert", + alertType: "error", + content: "You must have an admin role to create or manage webhooks. See the Linear [documentation](https://linear.app/docs/api-and-webhooks#webhooks) for details.", + }; + } + return props; + }, methods: { setWebhookId(teamId, id) { this.db.set(`webhook-${teamId}`, id); @@ -59,9 +72,26 @@ export default { getLoadedProjectId() { throw new Error("Get loaded project ID not implemented"); }, + async isAdmin() { + const { data } = await this.linearApp.makeAxiosRequest({ + method: "POST", + data: { + "query": `{ + user(id: "me") { + admin + } + }`, + }, + }); + return data?.user?.admin; + }, }, hooks: { async deploy() { + if (!(await this.isAdmin())) { + throw new ConfigurationError("You must have an admin role to create or manage webhooks. See the Linear [documentation](https://linear.app/docs/api-and-webhooks#webhooks) for details."); + } + // Retrieve historical events console.log("Retrieving historical events..."); const stream = this.linearApp.paginateResources({ 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 aeb24af23591a..01dc46e253f7d 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 docs [here](https://developers.linear.app/docs/graphql/webhooks)", type: "source", - version: "0.3.5", + version: "0.3.6", 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 5bc302e9477d7..5f68aadbd1f79 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 docs [here](https://developers.linear.app/docs/graphql/webhooks)", type: "source", - version: "0.3.5", + version: "0.3.6", 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 7be699c344559..78fa6fb227c19 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 @@ -7,7 +7,7 @@ export default { name: "New Issue Status Updated (Instant)", description: "Emit new event when the status of an issue is updated. See the docs [here](https://developers.linear.app/docs/graphql/webhooks)", type: "source", - version: "0.1.5", + version: "0.1.6", dedupe: "unique", props: { linearApp: common.props.linearApp, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 13a7e4fa48af2..6f4ccba704081 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5705,8 +5705,8 @@ importers: specifier: ^13.0.0 version: 13.0.0 '@pipedream/platform': - specifier: ^1.3.0 - version: 1.6.6 + specifier: ^3.0.3 + version: 3.0.3 components/linear_app: dependencies: @@ -5714,8 +5714,8 @@ importers: specifier: ^13.0.0 version: 13.0.0 '@pipedream/platform': - specifier: ^1.3.0 - version: 1.6.6 + specifier: ^3.0.3 + version: 3.0.3 components/linearb: dependencies: @@ -40846,7 +40846,7 @@ snapshots: path-scurry@1.11.1: dependencies: lru-cache: 10.4.3 - minipass: 5.0.0 + minipass: 7.1.2 path-to-regexp@6.3.0: {}