Skip to content

Commit 3d4ee1f

Browse files
authored
Jira - create-issue improvements (#18962)
* create-issue updates * versions * update
1 parent cc3eb3c commit 3d4ee1f

File tree

26 files changed

+86
-58
lines changed

26 files changed

+86
-58
lines changed

components/jira/actions/add-attachment-to-issue/add-attachment-to-issue.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "jira-add-attachment-to-issue",
77
name: "Add Attachment To Issue",
88
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)",
9-
version: "1.0.6",
9+
version: "1.0.7",
1010
annotations: {
1111
destructiveHint: false,
1212
openWorldHint: true,

components/jira/actions/add-comment-to-issue/add-comment-to-issue.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default {
77
key: "jira-add-comment-to-issue",
88
name: "Add Comment To Issue",
99
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)",
10-
version: "0.1.14",
10+
version: "0.1.15",
1111
annotations: {
1212
destructiveHint: false,
1313
openWorldHint: true,

components/jira/actions/add-multiple-attachments-to-issue/add-multiple-attachments-to-issue.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "jira-add-multiple-attachments-to-issue",
77
name: "Add Multiple Attachments To Issue",
88
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)",
9-
version: "1.0.6",
9+
version: "1.0.7",
1010
annotations: {
1111
destructiveHint: false,
1212
openWorldHint: true,

components/jira/actions/add-watcher-to-issue/add-watcher-to-issue.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import jira from "../../jira.app.mjs";
33
export default {
44
key: "jira-add-watcher-to-issue",
55
name: "Add Watcher To Issue",
6-
version: "0.0.13",
6+
version: "0.0.14",
77
annotations: {
88
destructiveHint: false,
99
openWorldHint: true,

components/jira/actions/assign-issue/assign-issue.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import jira from "../../jira.app.mjs";
33
export default {
44
key: "jira-assign-issue",
55
name: "Assign Issue",
6-
version: "0.0.13",
6+
version: "0.0.14",
77
annotations: {
88
destructiveHint: true,
99
openWorldHint: true,

components/jira/actions/create-custom-field-options-context/create-custom-field-options-context.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "jira-create-custom-field-options-context",
66
name: "Create Custom Field Options (Context)",
77
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).",
8-
version: "0.0.6",
8+
version: "0.0.7",
99
annotations: {
1010
destructiveHint: false,
1111
openWorldHint: true,

components/jira/actions/create-issue/create-issue.mjs

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import constants from "../../common/constants.mjs";
22
import utils from "../../common/utils.mjs";
33
import common from "../common/issue.mjs";
4+
import { ConfigurationError } from "@pipedream/platform";
45

56
export default {
67
...common,
78
key: "jira-create-issue",
89
name: "Create Issue",
9-
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)",
10-
version: "0.1.25",
10+
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)",
11+
version: "0.1.26",
1112
annotations: {
1213
destructiveHint: false,
1314
openWorldHint: true,
@@ -45,39 +46,50 @@ export default {
4546
],
4647
},
4748
},
48-
async additionalProps() {
49+
async additionalProps(existingProps) {
4950
const {
5051
cloudId,
5152
projectId,
5253
issueTypeId,
5354
} = this;
5455

55-
const {
56-
projects: [
57-
{
58-
issuetypes: [
59-
{ fields = {} } = {},
60-
],
56+
if (isNaN(projectId) || !cloudId || isNaN(issueTypeId)) {
57+
existingProps.additionalProperties.optional = false;
58+
return {};
59+
}
60+
61+
try {
62+
const {
63+
projects: [
64+
{
65+
issuetypes: [
66+
{ fields = {} } = {},
67+
],
68+
},
69+
],
70+
} = await this.app.getCreateIssueMetadata({
71+
cloudId,
72+
params: {
73+
projectIds: projectId,
74+
issuetypeIds: issueTypeId,
75+
expand: "projects.issuetypes.fields",
6176
},
62-
],
63-
} = await this.app.getCreateIssueMetadata({
64-
cloudId,
65-
params: {
66-
projectIds: projectId,
67-
issuetypeIds: issueTypeId,
68-
expand: "projects.issuetypes.fields",
69-
},
70-
});
77+
});
7178

72-
const keys = [
73-
constants.FIELD_KEY.ISSUETYPE,
74-
constants.FIELD_KEY.PROJECT,
75-
];
79+
const keys = [
80+
constants.FIELD_KEY.ISSUETYPE,
81+
constants.FIELD_KEY.PROJECT,
82+
];
7683

77-
return this.getDynamicFields({
78-
fields,
79-
predicate: ({ key }) => !keys.includes(key),
80-
});
84+
existingProps.additionalProperties.optional = true;
85+
return this.getDynamicFields({
86+
fields,
87+
predicate: ({ key }) => !keys.includes(key),
88+
});
89+
} catch {
90+
existingProps.additionalProperties.optional = false;
91+
return {};
92+
}
8193
},
8294
async run({ $ }) {
8395
const {
@@ -94,6 +106,12 @@ export default {
94106
...dynamicFields
95107
} = this;
96108

109+
if ((!dynamicFields || Object.keys(dynamicFields).length === 0)
110+
&& (!additionalProperties || Object.keys(additionalProperties).length === 0)
111+
) {
112+
throw new ConfigurationError("Please provide at least one additional property");
113+
}
114+
97115
const fields = utils.reduceProperties({
98116
initialProps: {
99117
project: {

components/jira/actions/create-version/create-version.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "jira-create-version",
55
name: "Create Jira Version in Project",
66
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)",
7-
version: "0.1.14",
7+
version: "0.1.15",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

components/jira/actions/delete-project/delete-project.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "jira-delete-project",
55
name: "Delete Project",
66
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)",
7-
version: "0.1.14",
7+
version: "0.1.15",
88
annotations: {
99
destructiveHint: true,
1010
openWorldHint: true,

components/jira/actions/get-all-projects/get-all-projects.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "jira-get-all-projects",
55
name: "Get All Projects",
66
description: "Gets metadata on all projects. [See the documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-project-get)",
7-
version: "0.1.15",
7+
version: "0.1.16",
88
annotations: {
99
destructiveHint: false,
1010
openWorldHint: true,

0 commit comments

Comments
 (0)