Skip to content

Commit d42b323

Browse files
michelle0927lcaresia
authored andcommitted
Jira - Add Override existing webhooks optional prop to all sources (#14471)
* updates * add (Instant) to source names
1 parent e531d79 commit d42b323

File tree

6 files changed

+34
-8
lines changed

6 files changed

+34
-8
lines changed

components/jira/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/jira",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "Pipedream Jira Components",
55
"main": "jira.app.mjs",
66
"keywords": [

components/jira/sources/common/common.mjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ export default {
2121
],
2222
description: "The JQL filter that specifies which issues the webhook is sent for, only a subset of JQL can be used, e.g. `project = P1` [See supported JQL filters](https://developer.atlassian.com/cloud/jira/service-desk/webhooks/#supported-jql-queries)",
2323
},
24+
overrideExistingWebhooks: {
25+
type: "boolean",
26+
label: "Override Existing Webhooks",
27+
description: "Override existing webhooks with this new Pipedream source's webhook. Recommend to set this to `true` if you have an existing Jira webhook that you no longer use and want to override with the new Pipedream source.",
28+
default: false,
29+
optional: true,
30+
},
2431
},
2532
methods: {
2633
_getHookID() {
@@ -91,9 +98,28 @@ export default {
9198
ts,
9299
};
93100
},
101+
async deleteExistingWebhooks() {
102+
const resourcesStream = await this.jira.getResourcesStream({
103+
cloudId: this.cloudId,
104+
resourceFn: this.jira.getWebhook,
105+
resourceFnArgs: {
106+
params: {},
107+
},
108+
resourceFiltererFn: (resource) => resource.values,
109+
});
110+
for await (const webhook of resourcesStream) {
111+
await this.jira.deleteHook({
112+
hookId: webhook.id,
113+
cloudId: this.cloudId,
114+
});
115+
}
116+
},
94117
},
95118
hooks: {
96119
async activate() {
120+
if (this.overrideExistingWebhooks) {
121+
await this.deleteExistingWebhooks();
122+
}
97123
const { hookId } = await this.jira.createHook({
98124
url: this.http.endpoint,
99125
events: this.getEvents(),

components/jira/sources/events/events.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "jira-events",
66
name: "New Event",
77
description: "Emit new event when an event with subscribed event source triggered, [See the docs](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-webhooks/#api-rest-api-3-webhook-post)",
8-
version: "0.0.9",
8+
version: "0.0.10",
99
type: "source",
1010
dedupe: "unique",
1111
...common,

components/jira/sources/issue-created/issue-created.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import common from "../common/common.mjs";
22

33
export default {
44
key: "jira-issue-created",
5-
name: "New Issue Created Event",
5+
name: "New Issue Created Event (Instant)",
66
description: "Emit new event when an issue is created. Note that Jira supports only one webhook, if more sources are needed please use `New Event` source and select multiple events.",
7-
version: "0.0.9",
7+
version: "0.0.10",
88
type: "source",
99
dedupe: "unique",
1010
...common,

components/jira/sources/issue-deleted/issue-deleted.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import common from "../common/common.mjs";
22

33
export default {
44
key: "jira-issue-deleted",
5-
name: "New Issue Deleted Event",
5+
name: "New Issue Deleted Event (Instant)",
66
description: "Emit new event when an issue is deleted. Note that Jira supports only one webhook, if more sources are needed please use `New Event` source and select multiple events.",
7-
version: "0.0.9",
7+
version: "0.0.10",
88
type: "source",
99
dedupe: "unique",
1010
...common,

components/jira/sources/issue-updated/issue-updated.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import common from "../common/common.mjs";
22

33
export default {
44
key: "jira-issue-updated",
5-
name: "New Issue Updated Event",
5+
name: "New Issue Updated Event (Instant)",
66
description: "Emit new event when an issue is updated. Note that Jira supports only one webhook, if more sources are needed please use `New Event` source and select multiple events.",
7-
version: "0.0.9",
7+
version: "0.0.10",
88
type: "source",
99
dedupe: "unique",
1010
...common,

0 commit comments

Comments
 (0)