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
4 changes: 2 additions & 2 deletions components/linear/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/linear",
"version": "0.5.5",
"version": "0.5.6",
"description": "Pipedream Linear Components",
"main": "linear.app.mjs",
"keywords": [
Expand All @@ -15,6 +15,6 @@
},
"dependencies": {
"@linear/sdk": "^13.0.0",
"@pipedream/platform": "^1.3.0"
"@pipedream/platform": "^3.0.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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",
};
Original file line number Diff line number Diff line change
Expand Up @@ -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",
};
Original file line number Diff line number Diff line change
Expand Up @@ -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",
};
Original file line number Diff line number Diff line change
Expand Up @@ -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",
};
4 changes: 2 additions & 2 deletions 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.5.5",
"version": "0.5.6",
"description": "Pipedream Linear_app Components",
"main": "linear_app.app.mjs",
"keywords": [
Expand All @@ -15,6 +15,6 @@
},
"dependencies": {
"@linear/sdk": "^13.0.0",
"@pipedream/platform": "^1.3.0"
"@pipedream/platform": "^3.0.3"
}
}
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 docs [here](https://developers.linear.app/docs/graphql/webhooks)",
type: "source",
version: "0.1.5",
version: "0.1.6",
dedupe: "unique",
methods: {
...common.methods,
Expand Down
30 changes: 30 additions & 0 deletions components/linear_app/sources/common/webhook.mjs
Original file line number Diff line number Diff line change
@@ -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: {
Expand All @@ -12,6 +13,7 @@ export default {
linearApp,
"teamId",
],
reloadProps: true,
},
projectId: {
propDefinition: [
Expand All @@ -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);
Expand Down Expand Up @@ -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({
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 docs [here](https://developers.linear.app/docs/graphql/webhooks)",
type: "source",
version: "0.3.5",
version: "0.3.6",
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 docs [here](https://developers.linear.app/docs/graphql/webhooks)",
type: "source",
version: "0.3.5",
version: "0.3.6",
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 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,
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

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

Loading