diff --git a/components/jira/package.json b/components/jira/package.json index e12af30ad40e6..a40a0d335e23c 100644 --- a/components/jira/package.json +++ b/components/jira/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/jira", - "version": "0.1.2", + "version": "0.1.3", "description": "Pipedream Jira Components", "main": "jira.app.mjs", "keywords": [ diff --git a/components/jira/sources/common/common.mjs b/components/jira/sources/common/common.mjs index 0532476f7f768..d25fc992239e4 100644 --- a/components/jira/sources/common/common.mjs +++ b/components/jira/sources/common/common.mjs @@ -21,6 +21,13 @@ export default { ], 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)", }, + overrideExistingWebhooks: { + type: "boolean", + label: "Override Existing Webhooks", + 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.", + default: false, + optional: true, + }, }, methods: { _getHookID() { @@ -91,9 +98,28 @@ export default { ts, }; }, + async deleteExistingWebhooks() { + const resourcesStream = await this.jira.getResourcesStream({ + cloudId: this.cloudId, + resourceFn: this.jira.getWebhook, + resourceFnArgs: { + params: {}, + }, + resourceFiltererFn: (resource) => resource.values, + }); + for await (const webhook of resourcesStream) { + await this.jira.deleteHook({ + hookId: webhook.id, + cloudId: this.cloudId, + }); + } + }, }, hooks: { async activate() { + if (this.overrideExistingWebhooks) { + await this.deleteExistingWebhooks(); + } const { hookId } = await this.jira.createHook({ url: this.http.endpoint, events: this.getEvents(), diff --git a/components/jira/sources/events/events.mjs b/components/jira/sources/events/events.mjs index 2331c35d109ed..1329faa50e701 100644 --- a/components/jira/sources/events/events.mjs +++ b/components/jira/sources/events/events.mjs @@ -5,7 +5,7 @@ export default { key: "jira-events", name: "New Event", 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)", - version: "0.0.9", + version: "0.0.10", type: "source", dedupe: "unique", ...common, diff --git a/components/jira/sources/issue-created/issue-created.mjs b/components/jira/sources/issue-created/issue-created.mjs index b696d3acd974a..1699d666fa308 100644 --- a/components/jira/sources/issue-created/issue-created.mjs +++ b/components/jira/sources/issue-created/issue-created.mjs @@ -2,9 +2,9 @@ import common from "../common/common.mjs"; export default { key: "jira-issue-created", - name: "New Issue Created Event", + name: "New Issue Created Event (Instant)", 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.", - version: "0.0.9", + version: "0.0.10", type: "source", dedupe: "unique", ...common, diff --git a/components/jira/sources/issue-deleted/issue-deleted.mjs b/components/jira/sources/issue-deleted/issue-deleted.mjs index b8e73b78554ae..90e34de11b911 100644 --- a/components/jira/sources/issue-deleted/issue-deleted.mjs +++ b/components/jira/sources/issue-deleted/issue-deleted.mjs @@ -2,9 +2,9 @@ import common from "../common/common.mjs"; export default { key: "jira-issue-deleted", - name: "New Issue Deleted Event", + name: "New Issue Deleted Event (Instant)", 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.", - version: "0.0.9", + version: "0.0.10", type: "source", dedupe: "unique", ...common, diff --git a/components/jira/sources/issue-updated/issue-updated.mjs b/components/jira/sources/issue-updated/issue-updated.mjs index 6ce2287dfafc8..71e7e82a74069 100644 --- a/components/jira/sources/issue-updated/issue-updated.mjs +++ b/components/jira/sources/issue-updated/issue-updated.mjs @@ -2,9 +2,9 @@ import common from "../common/common.mjs"; export default { key: "jira-issue-updated", - name: "New Issue Updated Event", + name: "New Issue Updated Event (Instant)", 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.", - version: "0.0.9", + version: "0.0.10", type: "source", dedupe: "unique", ...common,