Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "jira-add-attachment-to-issue",
name: "Add Attachment To Issue",
description: "Adds an attachment to an issue. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-issue-issueidorkey-attachments-post)",
version: "1.0.6",
version: "1.0.7",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "jira-add-comment-to-issue",
name: "Add Comment To Issue",
description: "Adds a new comment to an issue. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-post)",
version: "0.1.14",
version: "0.1.15",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "jira-add-multiple-attachments-to-issue",
name: "Add Multiple Attachments To Issue",
description: "Adds multiple attachments to an issue. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments/#api-rest-api-3-issue-issueidorkey-attachments-post)",
version: "1.0.6",
version: "1.0.7",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import jira from "../../jira.app.mjs";
export default {
key: "jira-add-watcher-to-issue",
name: "Add Watcher To Issue",
version: "0.0.13",
version: "0.0.14",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/jira/actions/assign-issue/assign-issue.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import jira from "../../jira.app.mjs";
export default {
key: "jira-assign-issue",
name: "Assign Issue",
version: "0.0.13",
version: "0.0.14",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "jira-create-custom-field-options-context",
name: "Create Custom Field Options (Context)",
description: "Create a context for custom field options. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-custom-field-options/#api-rest-api-3-field-fieldid-context-contextid-option-post).",
version: "0.0.6",
version: "0.0.7",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
70 changes: 44 additions & 26 deletions components/jira/actions/create-issue/create-issue.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import constants from "../../common/constants.mjs";
import utils from "../../common/utils.mjs";
import common from "../common/issue.mjs";
import { ConfigurationError } from "@pipedream/platform";

export default {
...common,
key: "jira-create-issue",
name: "Create Issue",
description: "Creates an issue or, where the option to create subtasks is enabled in Jira, a subtask. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-issue-post)",
version: "0.1.25",
description: "Creates an issue or, where the option to create subtasks is enabled in Jira, a subtask. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post)",
version: "0.1.26",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down Expand Up @@ -45,39 +46,50 @@ export default {
],
},
},
async additionalProps() {
async additionalProps(existingProps) {
const {
cloudId,
projectId,
issueTypeId,
} = this;

const {
projects: [
{
issuetypes: [
{ fields = {} } = {},
],
if (isNaN(projectId) || !cloudId || !isNaN(issueTypeId)) {
existingProps.additionalProperties.optional = false;
return {};
}

try {
const {
projects: [
{
issuetypes: [
{ fields = {} } = {},
],
},
],
} = await this.app.getCreateIssueMetadata({
cloudId,
params: {
projectIds: projectId,
issuetypeIds: issueTypeId,
expand: "projects.issuetypes.fields",
},
],
} = await this.app.getCreateIssueMetadata({
cloudId,
params: {
projectIds: projectId,
issuetypeIds: issueTypeId,
expand: "projects.issuetypes.fields",
},
});
});

const keys = [
constants.FIELD_KEY.ISSUETYPE,
constants.FIELD_KEY.PROJECT,
];
const keys = [
constants.FIELD_KEY.ISSUETYPE,
constants.FIELD_KEY.PROJECT,
];

return this.getDynamicFields({
fields,
predicate: ({ key }) => !keys.includes(key),
});
existingProps.additionalProperties.optional = true;
return this.getDynamicFields({
fields,
predicate: ({ key }) => !keys.includes(key),
});
} catch {
existingProps.additionalProperties.optional = false;
return {};
}
},
async run({ $ }) {
const {
Expand All @@ -94,6 +106,12 @@ export default {
...dynamicFields
} = this;

if ((!dynamicFields || Object.keys(dynamicFields).length === 0)
&& (!additionalProperties || Object.keys(additionalProperties).length === 0)
) {
throw new ConfigurationError("Please provide at least one additional property");
}

const fields = utils.reduceProperties({
initialProps: {
project: {
Expand Down
2 changes: 1 addition & 1 deletion components/jira/actions/create-version/create-version.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "jira-create-version",
name: "Create Jira Version in Project",
description: "Creates a project version. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-versions/#api-rest-api-3-version-post)",
version: "0.1.14",
version: "0.1.15",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/jira/actions/delete-project/delete-project.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "jira-delete-project",
name: "Delete Project",
description: "Deletes a project. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects/#api-rest-api-3-project-projectidorkey-delete)",
version: "0.1.14",
version: "0.1.15",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "jira-get-all-projects",
name: "Get All Projects",
description: "Gets metadata on all projects. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-project-get)",
version: "0.1.15",
version: "0.1.16",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/jira/actions/get-issue/get-issue.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "jira-get-issue",
name: "Get Issue",
description: "Gets the details for an issue. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-get)",
version: "0.1.16",
version: "0.1.17",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/jira/actions/get-task/get-task.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "jira-get-task",
name: "Get Task",
description: "Gets the status of a long-running asynchronous task. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-tasks/#api-rest-api-3-task-taskid-get)",
version: "0.1.14",
version: "0.1.15",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "jira-get-transitions",
name: "Get Transitions",
description: "Gets either all transitions or a transition that can be performed by the user on an issue, based on the issue's status. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-transitions-get)",
version: "0.1.14",
version: "0.1.15",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/jira/actions/get-user/get-user.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "jira-get-user",
name: "Get User",
description: "Gets details of user. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/#api-rest-api-3-user-get)",
version: "0.1.14",
version: "0.1.15",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/jira/actions/get-users/get-users.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "jira-get-users",
name: "Get Users",
description: "Gets the details for a list of users. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-user-search/#api-rest-api-3-user-search-get)",
version: "0.0.9",
version: "0.0.10",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "jira-list-issue-comments",
name: "List Issue Comments",
description: "Lists all comments for an issue. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-get)",
version: "0.1.14",
version: "0.1.15",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
name: "Search Issues with JQL",
description: "Search for issues using JQL (Jira Query Language). [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-jql-get)",
key: "jira-search-issues-with-jql",
version: "0.1.2",
version: "0.1.3",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "jira-transition-issue",
name: "Transition Issue",
description: "Performs an issue transition and, if the transition has a screen, updates the fields from the transition screen. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-transitions-post)",
version: "0.1.16",
version: "0.1.17",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/jira/actions/update-comment/update-comment.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "jira-update-comment",
name: "Update Comment",
description: "Updates a comment. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-issue-issueidorkey-comment-id-put)",
version: "0.1.14",
version: "0.1.15",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/jira/actions/update-issue/update-issue.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
key: "jira-update-issue",
name: "Update Issue",
description: "Updates an issue. A transition may be applied and issue properties updated as part of the edit. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-put)",
version: "0.2.18",
version: "0.2.19",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
26 changes: 18 additions & 8 deletions components/jira/jira.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default {
cloudId: {
type: "string",
label: "Cloud ID",
description: "The cloud ID.",
description: "The cloud ID",
useQuery: true,
async options() {
const clouds = await this.getClouds();
Expand All @@ -24,7 +24,7 @@ export default {
projectID: {
type: "string",
label: "Project ID",
description: "The project ID.",
description: "The project ID",
useQuery: true,
async options({
prevContext, query, cloudId,
Expand Down Expand Up @@ -60,12 +60,16 @@ export default {
async options({
cloudId, projectId,
}) {
const issueTypes = await this.getProjectIssueTypes({
cloudId,
params: {
projectId,
},
});
const issueTypes = isNaN(projectId)
? await this.getUserIssueTypes({
cloudId,
})
: await this.getProjectIssueTypes({
cloudId,
params: {
projectId,
},
});
return issueTypes.map(({
name: label, id: value,
}) => ({
Expand Down Expand Up @@ -597,6 +601,12 @@ export default {
...args,
});
},
getUserIssueTypes(args = {}) {
return this._makeRequest({
path: "/issuetype",
...args,
});
},
getWebhook(args = {}) {
return this._makeRequest({
path: "/webhook",
Expand Down
2 changes: 1 addition & 1 deletion components/jira/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/jira",
"version": "1.1.2",
"version": "1.1.3",
"description": "Pipedream Jira Components",
"main": "jira.app.mjs",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion components/jira/sources/events/events.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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 documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-webhooks/#api-rest-api-3-webhook-post)",
version: "0.0.14",
version: "0.0.15",
type: "source",
dedupe: "unique",
...common,
Expand Down
2 changes: 1 addition & 1 deletion components/jira/sources/issue-created/issue-created.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "jira-issue-created",
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.14",
version: "0.0.15",
type: "source",
dedupe: "unique",
...common,
Expand Down
2 changes: 1 addition & 1 deletion components/jira/sources/issue-deleted/issue-deleted.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "jira-issue-deleted",
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.14",
version: "0.0.15",
type: "source",
dedupe: "unique",
...common,
Expand Down
2 changes: 1 addition & 1 deletion components/jira/sources/issue-updated/issue-updated.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "jira-issue-updated",
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.14",
version: "0.0.15",
type: "source",
dedupe: "unique",
...common,
Expand Down
Loading