@activepieces/piece-jira-cloud 0.0.11 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,26 +1,27 @@
1
1
  {
2
2
  "name": "@activepieces/piece-jira-cloud",
3
- "version": "0.0.11",
3
+ "version": "0.1.0",
4
4
  "dependencies": {
5
- "@anthropic-ai/sdk": "0.27.3",
6
- "@sinclair/typebox": "0.33.18",
7
- "axios": "1.7.7",
5
+ "@anthropic-ai/sdk": "0.33.1",
6
+ "@sinclair/typebox": "0.34.11",
7
+ "axios": "1.7.8",
8
8
  "axios-retry": "4.4.1",
9
9
  "dayjs": "1.11.9",
10
- "deepmerge": "4.3.1",
10
+ "deepmerge-ts": "7.1.0",
11
11
  "form-data": "4.0.0",
12
12
  "mime-types": "2.1.35",
13
- "nanoid": "3.3.6",
13
+ "nanoid": "3.3.8",
14
14
  "openai": "4.67.1",
15
15
  "replicate": "0.34.1",
16
16
  "semver": "7.6.0",
17
17
  "zod": "3.23.8",
18
- "@activepieces/pieces-common": "0.2.32",
19
- "@activepieces/pieces-framework": "0.7.40",
20
- "@activepieces/shared": "0.10.126",
18
+ "@activepieces/pieces-common": "0.4.1",
19
+ "@activepieces/pieces-framework": "0.7.43",
20
+ "@activepieces/shared": "0.10.150",
21
21
  "tslib": "1.14.1"
22
22
  },
23
23
  "overrides": {
24
+ "cross-spawn": "7.0.6",
24
25
  "@tryfabric/martian": {
25
26
  "@notionhq/client": "$@notionhq/client"
26
27
  },
package/src/index.js CHANGED
@@ -17,6 +17,9 @@ const delete_issue_comment_1 = require("./lib/actions/delete-issue-comment");
17
17
  const update_issue_1 = require("./lib/actions/update-issue");
18
18
  const assign_issue_1 = require("./lib/actions/assign-issue");
19
19
  const list_issue_comments_1 = require("./lib/actions/list-issue-comments");
20
+ const find_user_1 = require("./lib/actions/find-user");
21
+ const add_watcher_to_issue_1 = require("./lib/actions/add-watcher-to-issue");
22
+ const link_issues_1 = require("./lib/actions/link-issues");
20
23
  exports.jiraCloud = (0, pieces_framework_1.createPiece)({
21
24
  displayName: 'Jira Cloud',
22
25
  description: 'Issue tracking and project management',
@@ -26,13 +29,16 @@ exports.jiraCloud = (0, pieces_framework_1.createPiece)({
26
29
  categories: [shared_1.PieceCategory.PRODUCTIVITY],
27
30
  authors: ['kishanprmr', 'MoShizzle', 'abuaboud'],
28
31
  actions: [
29
- create_issue_1.createIssue,
32
+ create_issue_1.createIssueAction,
30
33
  update_issue_1.updateIssueAction,
34
+ find_user_1.findUserAction,
31
35
  search_issues_1.searchIssues,
32
36
  assign_issue_1.assignIssueAction,
33
37
  add_attachment_to_issue_1.addAttachmentToIssueAction,
38
+ add_watcher_to_issue_1.addWatcherToIssueAction,
34
39
  add_comment_to_issue_1.addCommentToIssueAction,
35
40
  update_issue_comment_1.updateIssueCommentAction,
41
+ link_issues_1.linkIssuesAction,
36
42
  list_issue_comments_1.listIssueCommentsAction,
37
43
  delete_issue_comment_1.deleteIssueCommentAction,
38
44
  (0, pieces_common_1.createCustomApiCallAction)({
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/jira-cloud/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAE7D,+DAAwE;AACxE,iDAAqD;AACrD,iCAAiD;AACjD,6DAAyD;AACzD,+DAA2D;AAC3D,wDAAoD;AACpD,gEAA4D;AAC5D,6EAA6E;AAC7E,mFAAmF;AACnF,6EAA8E;AAC9E,6EAA8E;AAC9E,6DAA+D;AAC/D,6DAA+D;AAC/D,2EAA4E;AAE/D,QAAA,SAAS,GAAG,IAAA,8BAAW,EAAC;IACpC,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,uCAAuC;IAEpD,IAAI,EAAE,oBAAa;IACnB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,8CAA8C;IACvD,UAAU,EAAE,CAAC,sBAAa,CAAC,YAAY,CAAC;IACxC,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,UAAU,CAAC;IAChD,OAAO,EAAE;QACR,0BAAW;QACX,gCAAiB;QACjB,4BAAY;QACZ,gCAAiB;QACjB,oDAA0B;QAC1B,8CAAuB;QACvB,+CAAwB;QACxB,6CAAuB;QACvB,+CAAwB;QACxB,IAAA,yCAAyB,EAAC;YACzB,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;gBACjB,OAAO,GAAI,IAAiB,CAAC,WAAW,aAAa,CAAC;YACvD,CAAC;YACD,IAAI,EAAE,oBAAa;YACnB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC3B,MAAM,SAAS,GAAG,IAAgB,CAAC;gBACnC,OAAO;oBACN,aAAa,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CACvF,QAAQ,CACR,EAAE;iBACH,CAAC;YACH,CAAC,CAAA;SACD,CAAC;KACF;IACD,QAAQ,EAAE,CAAC,oBAAQ,EAAE,4BAAY,CAAC;CAClC,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/jira-cloud/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAE7D,+DAAwE;AACxE,iDAAqD;AACrD,iCAAiD;AACjD,6DAA+D;AAC/D,+DAA2D;AAC3D,wDAAoD;AACpD,gEAA4D;AAC5D,6EAA6E;AAC7E,mFAAmF;AACnF,6EAA8E;AAC9E,6EAA8E;AAC9E,6DAA+D;AAC/D,6DAA+D;AAC/D,2EAA4E;AAC5E,uDAAyD;AACzD,6EAA6E;AAC7E,2DAA6D;AAEhD,QAAA,SAAS,GAAG,IAAA,8BAAW,EAAC;IACpC,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,uCAAuC;IAEpD,IAAI,EAAE,oBAAa;IACnB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,8CAA8C;IACvD,UAAU,EAAE,CAAC,sBAAa,CAAC,YAAY,CAAC;IACxC,OAAO,EAAE,CAAC,YAAY,EAAE,WAAW,EAAE,UAAU,CAAC;IAChD,OAAO,EAAE;QACR,gCAAiB;QACjB,gCAAiB;QACjB,0BAAc;QACd,4BAAY;QACZ,gCAAiB;QACjB,oDAA0B;QAC1B,8CAAuB;QACvB,8CAAuB;QACvB,+CAAwB;QACxB,8BAAgB;QAChB,6CAAuB;QACvB,+CAAwB;QACxB,IAAA,yCAAyB,EAAC;YACzB,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;gBACjB,OAAO,GAAI,IAAiB,CAAC,WAAW,aAAa,CAAC;YACvD,CAAC;YACD,IAAI,EAAE,oBAAa;YACnB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC3B,MAAM,SAAS,GAAG,IAAgB,CAAC;gBACnC,OAAO;oBACN,aAAa,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,KAAK,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CACvF,QAAQ,CACR,EAAE;iBACH,CAAC;YACH,CAAC,CAAA;SACD,CAAC;KACF;IACD,QAAQ,EAAE,CAAC,oBAAQ,EAAE,4BAAY,CAAC;CAClC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const addWatcherToIssueAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ apiToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
+ }>, {
6
+ issueId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
7
+ userId: import("@activepieces/pieces-framework").DropdownProperty<any, false> | import("@activepieces/pieces-framework").DropdownProperty<any, true>;
8
+ }>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addWatcherToIssueAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../../auth");
7
+ const props_1 = require("../common/props");
8
+ const shared_1 = require("@activepieces/shared");
9
+ const common_1 = require("../common");
10
+ const pieces_common_1 = require("@activepieces/pieces-common");
11
+ exports.addWatcherToIssueAction = (0, pieces_framework_1.createAction)({
12
+ auth: auth_1.jiraCloudAuth,
13
+ name: 'add-watcher-to-issue',
14
+ displayName: 'Add Watcher to Issue',
15
+ description: 'Adds a new watcher to an issue.',
16
+ props: {
17
+ issueId: (0, props_1.issueIdOrKeyProp)('Issue ID or Key', true),
18
+ userId: (0, props_1.getUsersDropdown)({
19
+ displayName: 'User',
20
+ refreshers: [],
21
+ required: true,
22
+ }),
23
+ },
24
+ run(context) {
25
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
26
+ const { issueId, userId } = context.propsValue;
27
+ if ((0, shared_1.isNil)(issueId)) {
28
+ throw new Error('Issue ID is required');
29
+ }
30
+ if ((0, shared_1.isNil)(userId)) {
31
+ throw new Error('User ID is required');
32
+ }
33
+ try {
34
+ const response = yield (0, common_1.jiraApiCall)({
35
+ auth: context.auth,
36
+ method: pieces_common_1.HttpMethod.POST,
37
+ resourceUri: `/issue/${issueId}/watchers`,
38
+ body: `"${userId}"`,
39
+ });
40
+ return { success: true };
41
+ }
42
+ catch (e) {
43
+ return { success: false, error: e.message };
44
+ }
45
+ });
46
+ },
47
+ });
48
+ //# sourceMappingURL=add-watcher-to-issue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-watcher-to-issue.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/jira-cloud/src/lib/actions/add-watcher-to-issue.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,qCAA2C;AAC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@@
1
- export declare const createIssue: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
1
+ export declare const createIssueAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
2
  instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
3
  email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
4
  apiToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
5
  }>, {
6
6
  projectId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
7
- issueTypeId: import("@activepieces/pieces-framework").DropdownProperty<any, false> | import("@activepieces/pieces-framework").DropdownProperty<any, true>;
8
- summary: import("@activepieces/pieces-framework").ShortTextProperty<true>;
9
- description: import("@activepieces/pieces-framework").LongTextProperty<false>;
10
- assignee: import("@activepieces/pieces-framework").DropdownProperty<any, false> | import("@activepieces/pieces-framework").DropdownProperty<any, true>;
11
- priority: import("@activepieces/pieces-framework").DropdownProperty<any, false>;
12
- parentKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ issueTypeId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
8
+ issueFields: import("@activepieces/pieces-framework").DynamicProperties<true>;
13
9
  }>;
@@ -1,71 +1,93 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createIssue = void 0;
3
+ exports.createIssueAction = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const pieces_framework_1 = require("@activepieces/pieces-framework");
6
6
  const auth_1 = require("../../auth");
7
7
  const props_1 = require("../common/props");
8
8
  const common_1 = require("../common");
9
- exports.createIssue = (0, pieces_framework_1.createAction)({
9
+ const types_1 = require("../common/types");
10
+ const pieces_common_1 = require("@activepieces/pieces-common");
11
+ const shared_1 = require("@activepieces/shared");
12
+ exports.createIssueAction = (0, pieces_framework_1.createAction)({
10
13
  name: 'create_issue',
11
14
  displayName: 'Create Issue',
12
- description: 'Create a new issue in a project',
15
+ description: 'Creates a new issue in a project.',
13
16
  auth: auth_1.jiraCloudAuth,
14
17
  props: {
15
18
  projectId: (0, props_1.getProjectIdDropdown)(),
16
- issueTypeId: (0, props_1.getIssueTypeIdDropdown)({ refreshers: ['projectId'] }),
17
- summary: pieces_framework_1.Property.ShortText({
18
- displayName: 'Summary',
19
+ issueTypeId: (0, props_1.issueTypeIdProp)('Issue Type'),
20
+ issueFields: pieces_framework_1.Property.DynamicProperties({
21
+ displayName: 'Fields',
19
22
  required: true,
20
- }),
21
- description: pieces_framework_1.Property.LongText({
22
- displayName: 'Description',
23
- required: false,
24
- }),
25
- assignee: (0, props_1.getUsersDropdown)({
26
- displayName: 'Assignee',
27
- refreshers: ['projectId'],
28
- required: false,
29
- }),
30
- priority: pieces_framework_1.Property.Dropdown({
31
- displayName: 'Priority',
32
- required: false,
33
- refreshers: [],
34
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
35
- if (!auth) {
36
- return {
37
- options: [],
38
- };
23
+ refreshers: ['projectId', 'issueTypeId'],
24
+ props: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, projectId, issueTypeId }) {
25
+ if (!auth || !issueTypeId || !projectId) {
26
+ return {};
39
27
  }
40
- const priorities = yield (0, common_1.getPriorities)({ auth: auth });
41
- return {
42
- options: priorities.map((item) => {
43
- return {
44
- label: item.name,
45
- value: item.id,
46
- };
47
- }),
48
- };
28
+ const props = {};
29
+ const authValue = auth;
30
+ const fields = yield (0, common_1.jiraPaginatedApiCall)({
31
+ auth: authValue,
32
+ method: pieces_common_1.HttpMethod.GET,
33
+ resourceUri: `/issue/createmeta/${projectId}/issuetypes/${issueTypeId}`,
34
+ propertyName: 'fields',
35
+ });
36
+ if (!fields || !Array.isArray(fields))
37
+ return {};
38
+ for (const field of fields) {
39
+ // skip invalid custom fields
40
+ if (field.schema.custom) {
41
+ const customFieldType = field.schema.custom.split(':')[1];
42
+ if (!types_1.VALID_CUSTOM_FIELD_TYPES.includes(customFieldType)) {
43
+ continue;
44
+ }
45
+ }
46
+ if (['project', 'issuetype'].includes(field.key)) {
47
+ continue;
48
+ }
49
+ props[field.key] = yield (0, props_1.createPropertyDefinition)(authValue, field, field.required);
50
+ }
51
+ // Remove null props
52
+ return Object.fromEntries(Object.entries(props).filter(([_, prop]) => prop !== null));
49
53
  }),
50
54
  }),
51
- parentKey: pieces_framework_1.Property.ShortText({
52
- displayName: 'Parent Key',
53
- description: 'If you would like to attach the issue to a parent, insert the parent issue key',
54
- required: false,
55
- }),
56
55
  },
57
- run: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue }) {
58
- const { projectId, issueTypeId, assignee, summary, description, priority, parentKey, } = propsValue;
59
- return yield (0, common_1.createJiraIssue)({
60
- auth,
61
- projectId: projectId,
62
- summary,
63
- issueTypeId,
64
- assignee,
65
- description,
66
- priority,
67
- parentKey,
56
+ run(context) {
57
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
58
+ var _a;
59
+ const { projectId, issueTypeId } = context.propsValue;
60
+ const inputIssueFields = (_a = context.propsValue.issueFields) !== null && _a !== void 0 ? _a : {};
61
+ if ((0, shared_1.isNil)(projectId) || (0, shared_1.isNil)(issueTypeId)) {
62
+ throw new Error('Project ID and Issue Type ID are required');
63
+ }
64
+ const issueTypeFields = yield (0, common_1.jiraPaginatedApiCall)({
65
+ auth: context.auth,
66
+ method: pieces_common_1.HttpMethod.GET,
67
+ resourceUri: `/issue/createmeta/${projectId}/issuetypes/${issueTypeId}`,
68
+ propertyName: 'fields',
69
+ });
70
+ const formattedFields = (0, props_1.formatIssueFields)(issueTypeFields, inputIssueFields);
71
+ const response = yield (0, common_1.jiraApiCall)({
72
+ auth: context.auth,
73
+ method: pieces_common_1.HttpMethod.POST,
74
+ resourceUri: `/issue`,
75
+ body: {
76
+ fields: Object.assign({ issuetype: {
77
+ id: issueTypeId,
78
+ }, project: {
79
+ id: projectId,
80
+ } }, formattedFields),
81
+ },
82
+ });
83
+ const issue = yield (0, common_1.jiraApiCall)({
84
+ auth: context.auth,
85
+ method: pieces_common_1.HttpMethod.GET,
86
+ resourceUri: `/issue/${response.id}`,
87
+ });
88
+ const updatedIssueProperties = (0, props_1.transformCustomFields)(issueTypeFields, issue.fields);
89
+ return Object.assign(Object.assign({}, issue), { fields: updatedIssueProperties });
68
90
  });
69
- }),
91
+ },
70
92
  });
71
93
  //# sourceMappingURL=create-issue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-issue.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/jira-cloud/src/lib/actions/create-issue.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,qCAAqD;AACrD,2CAIyB;AACzB,sCAA2D;AAE9C,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,iCAAiC;IAC9C,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE;QACL,SAAS,EAAE,IAAA,4BAAoB,GAAE;QACjC,WAAW,EAAE,IAAA,8BAAsB,EAAC,EAAE,UAAU,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC;QAClE,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC7B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,QAAQ,EAAE,IAAA,wBAAgB,EAAC;YACzB,WAAW,EAAE,UAAU;YACvB,UAAU,EAAE,CAAC,WAAW,CAAC;YACzB,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC1B,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,EAAE;YACd,OAAO,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;gBACtB,IAAI,CAAC,IAAI,EAAE,CAAC;oBACV,OAAO;wBACL,OAAO,EAAE,EAAE;qBACZ,CAAC;gBACJ,CAAC;gBAED,MAAM,UAAU,GAAG,MAAM,IAAA,sBAAa,EAAC,EAAE,IAAI,EAAE,IAAgB,EAAE,CAAC,CAAC;gBACnE,OAAO;oBACL,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;wBAC/B,OAAO;4BACL,KAAK,EAAE,IAAI,CAAC,IAAI;4BAChB,KAAK,EAAE,IAAI,CAAC,EAAE;yBACf,CAAC;oBACJ,CAAC,CAAC;iBACH,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,gFAAgF;YAC7F,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACD,GAAG,EAAE,KAA6B,EAAE,oDAAxB,EAAE,IAAI,EAAE,UAAU,EAAE;QAC9B,MAAM,EACJ,SAAS,EACT,WAAW,EACX,QAAQ,EACR,OAAO,EACP,WAAW,EACX,QAAQ,EACR,SAAS,GACV,GAAG,UAAU,CAAC;QAEf,OAAO,MAAM,IAAA,wBAAe,EAAC;YAC3B,IAAI;YACJ,SAAS,EAAE,SAAmB;YAC9B,OAAO;YACP,WAAW;YACX,QAAQ;YACR,WAAW;YACX,QAAQ;YACR,SAAS;SACV,CAAC,CAAC;IACL,CAAC,CAAA;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"create-issue.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/jira-cloud/src/lib/actions/create-issue.ts"],"names":[],"mappings":";;;;AAAA,qEAA2F;AAC3F,qCAAqD;AACrD,2CAMyB;AACzB,sCAA8D;AAC9D,2CAA+E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E,gBAAgB,CAAC,CAAC;YAE7E,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAA8B;gBAC/D,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,WAAW,EAAE,QAAQ;gBACrB,IAAI,EAAE;oBACL,MAAM,kBACL,SAAS,EAAE;4BACV,EAAE,EAAE,WAAW;yBACf,EACD,OAAO,EAAE;4BACR,EAAE,EAAE,SAAS;yBACb,IACE,eAAe,CAClB;iBACD;aACD,CAAC,CAAC;YAEH,MAAM,KAAK,GAAG,MAAM,IAAA,oBAAW,EAK5B;gBACF,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,WAAW,EAAE,UAAU,QAAQ,CAAC,EAAE,EAAE;aACpC,CAAC,CAAC;YAEH,MAAM,sBAAsB,GAAG,IAAA,6BAAqB,EAAC,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;YAEpF,uCACI,KAAK,KACR,MAAM,EAAE,sBAAsB,IAC7B;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare const findUserAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ apiToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
+ }>, {
6
+ keyword: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ }>;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findUserAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../../auth");
7
+ const common_1 = require("../common");
8
+ const pieces_common_1 = require("@activepieces/pieces-common");
9
+ exports.findUserAction = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.jiraCloudAuth,
11
+ name: 'find-user',
12
+ displayName: 'Find User',
13
+ description: 'Finds an existing user.',
14
+ props: {
15
+ keyword: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Keyword',
17
+ required: true,
18
+ })
19
+ },
20
+ run(context) {
21
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+ const response = yield (0, common_1.jiraApiCall)({
23
+ auth: context.auth,
24
+ method: pieces_common_1.HttpMethod.GET,
25
+ resourceUri: '/user/search',
26
+ query: {
27
+ query: context.propsValue.keyword
28
+ }
29
+ });
30
+ return {
31
+ found: response.length > 0,
32
+ data: response
33
+ };
34
+ });
35
+ }
36
+ });
37
+ //# sourceMappingURL=find-user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-user.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/jira-cloud/src/lib/actions/find-user.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,qCAA2C;AAC3C,sCAAwC;AACxC,+DAAyD;AAE5C,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAC,oBAAa;IAClB,IAAI,EAAC,WAAW;IAChB,WAAW,EAAC,WAAW;IACvB,WAAW,EAAC,yBAAyB;IACrC,KAAK,EAAC;QACF,OAAO,EAAC,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAC,SAAS;YACrB,QAAQ,EAAC,IAAI;SAChB,CAAC;KACL;IACK,GAAG,CAAC,OAAO;;YACb,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAA4B;gBAC1D,IAAI,EAAC,OAAO,CAAC,IAAI;gBACjB,MAAM,EAAC,0BAAU,CAAC,GAAG;gBACrB,WAAW,EAAC,cAAc;gBAC1B,KAAK,EAAC;oBACF,KAAK,EAAC,OAAO,CAAC,UAAU,CAAC,OAAO;iBACnC;aACJ,CAAC,CAAA;YAEF,OAAM;gBACF,KAAK,EAAC,QAAQ,CAAC,MAAM,GAAC,CAAC;gBACvB,IAAI,EAAC,QAAQ;aAChB,CAAA;QACL,CAAC;KAAA;CACJ,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ export declare const linkIssuesAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ apiToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
+ }>, {
6
+ firstIssueId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
7
+ issueLinkTypeId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
8
+ secondIssueId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
9
+ }>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.linkIssuesAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../../auth");
7
+ const props_1 = require("../common/props");
8
+ const shared_1 = require("@activepieces/shared");
9
+ const pieces_common_1 = require("@activepieces/pieces-common");
10
+ const common_1 = require("../common");
11
+ exports.linkIssuesAction = (0, pieces_framework_1.createAction)({
12
+ auth: auth_1.jiraCloudAuth,
13
+ name: 'link-issues',
14
+ displayName: 'Link Issues',
15
+ description: 'Creates a link between two issues.',
16
+ props: {
17
+ firstIssueId: (0, props_1.issueIdOrKeyProp)('First Issue', true),
18
+ issueLinkTypeId: (0, props_1.issueLinkTypeIdProp)('Link Type', true),
19
+ secondIssueId: (0, props_1.issueIdOrKeyProp)('Second Issue', true),
20
+ },
21
+ run(context) {
22
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
+ const { firstIssueId, issueLinkTypeId, secondIssueId } = context.propsValue;
24
+ if ((0, shared_1.isNil)(firstIssueId) || (0, shared_1.isNil)(issueLinkTypeId) || (0, shared_1.isNil)(secondIssueId)) {
25
+ throw new Error('First Issue, Link Type, and Second Issue are required');
26
+ }
27
+ try {
28
+ const response = yield (0, common_1.jiraApiCall)({
29
+ method: pieces_common_1.HttpMethod.POST,
30
+ resourceUri: '/issueLink',
31
+ auth: context.auth,
32
+ body: {
33
+ type: {
34
+ id: issueLinkTypeId,
35
+ },
36
+ inwardIssue: {
37
+ id: secondIssueId,
38
+ },
39
+ outwardIssue: {
40
+ id: firstIssueId,
41
+ },
42
+ },
43
+ });
44
+ return { success: true };
45
+ }
46
+ catch (e) {
47
+ return { success: false, error: e.message };
48
+ }
49
+ });
50
+ },
51
+ });
52
+ //# sourceMappingURL=link-issues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link-issues.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/jira-cloud/src/lib/actions/link-issues.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,qCAA2C;AAC3C,2CAAwE;AACxE,iDAA6C;AAC7C,+DAAoE;AACpE,sCAAwC;AAE3B,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,oBAAa;IACnB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,oCAAoC;IACjD,KAAK,EAAE;QACN,YAAY,EAAE,IAAA,wBAAgB,EAAC,aAAa,EAAE,IAAI,CAAC;QACnD,eAAe,EAAE,IAAA,2BAAmB,EAAC,WAAW,EAAE,IAAI,CAAC;QACvD,aAAa,EAAE,IAAA,wBAAgB,EAAC,cAAc,EAAE,IAAI,CAAC;KACrD;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE5E,IAAI,IAAA,cAAK,EAAC,YAAY,CAAC,IAAI,IAAA,cAAK,EAAC,eAAe,CAAC,IAAI,IAAA,cAAK,EAAC,aAAa,CAAC,EAAE,CAAC;gBAC3E,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;YAC1E,CAAC;YACD,IAAI,CAAC;gBACJ,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAAC;oBAClC,MAAM,EAAE,0BAAU,CAAC,IAAI;oBACvB,WAAW,EAAE,YAAY;oBACzB,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,IAAI,EAAE;wBACL,IAAI,EAAE;4BACL,EAAE,EAAE,eAAe;yBACnB;wBACD,WAAW,EAAE;4BACZ,EAAE,EAAE,aAAa;yBACjB;wBACD,YAAY,EAAE;4BACb,EAAE,EAAE,YAAY;yBAChB;qBACD;iBACD,CAAC,CAAC;gBAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YAC1B,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACZ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAG,CAAe,CAAC,OAAO,EAAE,CAAC;YAC5D,CAAC;QACF,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -3,12 +3,7 @@ export declare const updateIssueAction: import("@activepieces/pieces-framework")
3
3
  email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
4
  apiToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
5
5
  }>, {
6
- projectId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
7
6
  issueId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
8
- issueTypeId: import("@activepieces/pieces-framework").DropdownProperty<any, false> | import("@activepieces/pieces-framework").DropdownProperty<any, true>;
9
- summary: import("@activepieces/pieces-framework").ShortTextProperty<false>;
10
- description: import("@activepieces/pieces-framework").LongTextProperty<false>;
11
- assignee: import("@activepieces/pieces-framework").DropdownProperty<any, false> | import("@activepieces/pieces-framework").DropdownProperty<any, true>;
12
- priority: import("@activepieces/pieces-framework").DropdownProperty<any, false>;
13
- parentKey: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ statusId: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
8
+ issueFields: import("@activepieces/pieces-framework").DynamicProperties<true>;
14
9
  }>;
@@ -6,67 +6,111 @@ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
6
  const auth_1 = require("../../auth");
7
7
  const props_1 = require("../common/props");
8
8
  const common_1 = require("../common");
9
+ const types_1 = require("../common/types");
10
+ const pieces_common_1 = require("@activepieces/pieces-common");
11
+ const shared_1 = require("@activepieces/shared");
9
12
  exports.updateIssueAction = (0, pieces_framework_1.createAction)({
10
13
  name: 'update_issue',
11
14
  displayName: 'Update Issue',
12
- description: 'Updates a existing issue in a project.',
15
+ description: 'Updates an existing issue.',
13
16
  auth: auth_1.jiraCloudAuth,
14
17
  props: {
15
- projectId: (0, props_1.getProjectIdDropdown)(),
16
- issueId: (0, props_1.getIssueIdDropdown)({ refreshers: ['projectId'] }),
17
- issueTypeId: (0, props_1.getIssueTypeIdDropdown)({ refreshers: ['projectId'], required: false }),
18
- summary: pieces_framework_1.Property.ShortText({
19
- displayName: 'Summary',
20
- required: false,
21
- }),
22
- description: pieces_framework_1.Property.LongText({
23
- displayName: 'Description',
24
- required: false,
25
- }),
26
- assignee: (0, props_1.getUsersDropdown)({
27
- displayName: 'Assignee',
28
- refreshers: ['projectId'],
29
- required: false,
30
- }),
31
- priority: pieces_framework_1.Property.Dropdown({
32
- displayName: 'Priority',
33
- required: false,
34
- refreshers: [],
35
- options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
36
- if (!auth) {
37
- return {
38
- options: [],
39
- };
18
+ issueId: (0, props_1.issueIdOrKeyProp)('Issue ID or Key', true),
19
+ statusId: (0, props_1.issueStatusIdProp)('Status', false),
20
+ issueFields: pieces_framework_1.Property.DynamicProperties({
21
+ displayName: 'Fields',
22
+ required: true,
23
+ refreshers: ['issueId'],
24
+ props: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, issueId }) {
25
+ if (!auth || !issueId) {
26
+ return {};
40
27
  }
41
- const priorities = yield (0, common_1.getPriorities)({ auth: auth });
42
- return {
43
- options: priorities.map((item) => {
44
- return {
45
- label: item.name,
46
- value: item.id,
47
- };
48
- }),
49
- };
28
+ const props = {};
29
+ const authValue = auth;
30
+ const response = yield (0, common_1.jiraApiCall)({
31
+ auth: authValue,
32
+ method: pieces_common_1.HttpMethod.GET,
33
+ resourceUri: `/issue/${issueId}/editmeta`,
34
+ });
35
+ if (!response.fields)
36
+ return {};
37
+ for (const key in response.fields) {
38
+ const field = response.fields[key];
39
+ // skip invalid custom fields
40
+ if (field.schema.custom) {
41
+ const customFieldType = field.schema.custom.split(':')[1];
42
+ if (!types_1.VALID_CUSTOM_FIELD_TYPES.includes(customFieldType)) {
43
+ continue;
44
+ }
45
+ }
46
+ if (field.key === 'issuetype') {
47
+ props[field.key] = pieces_framework_1.Property.StaticDropdown({
48
+ displayName: field.name,
49
+ required: false,
50
+ options: {
51
+ disabled: false,
52
+ options: field.allowedValues
53
+ ? field.allowedValues.map((option) => ({
54
+ label: option.name,
55
+ value: option.id,
56
+ }))
57
+ : [],
58
+ },
59
+ });
60
+ }
61
+ else {
62
+ props[field.key] = yield (0, props_1.createPropertyDefinition)(authValue, field, false);
63
+ }
64
+ }
65
+ // Remove null props
66
+ return Object.fromEntries(Object.entries(props).filter(([_, prop]) => prop !== null));
50
67
  }),
51
68
  }),
52
- parentKey: pieces_framework_1.Property.ShortText({
53
- displayName: 'Parent Key',
54
- description: 'If you would like to attach the issue to a parent, insert the parent issue key',
55
- required: false,
56
- }),
57
69
  },
58
- run: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue }) {
59
- const { issueId, issueTypeId, assignee, summary, description, priority, parentKey } = propsValue;
60
- return yield (0, common_1.updateJiraIssue)({
61
- auth,
62
- issueId,
63
- summary,
64
- issueTypeId,
65
- assignee,
66
- description,
67
- priority,
68
- parentKey,
70
+ run(context) {
71
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
72
+ var _a;
73
+ const { issueId, statusId } = context.propsValue;
74
+ const inputIssueFields = (_a = context.propsValue.issueFields) !== null && _a !== void 0 ? _a : {};
75
+ if ((0, shared_1.isNil)(issueId)) {
76
+ throw new Error('Isue ID is required');
77
+ }
78
+ if (!(0, shared_1.isNil)(statusId) && statusId !== '') {
79
+ yield (0, common_1.jiraApiCall)({
80
+ auth: context.auth,
81
+ method: pieces_common_1.HttpMethod.POST,
82
+ resourceUri: `/issue/${issueId}/transitions`,
83
+ body: {
84
+ transition: {
85
+ id: statusId,
86
+ },
87
+ },
88
+ });
89
+ }
90
+ const issueTypeFields = yield (0, common_1.jiraApiCall)({
91
+ auth: context.auth,
92
+ method: pieces_common_1.HttpMethod.GET,
93
+ resourceUri: `/issue/${issueId}/editmeta`,
94
+ });
95
+ const flattenedFields = Object.values(issueTypeFields.fields);
96
+ const formattedFields = (0, props_1.formatIssueFields)(flattenedFields, inputIssueFields);
97
+ const response = yield (0, common_1.jiraApiCall)({
98
+ auth: context.auth,
99
+ method: pieces_common_1.HttpMethod.PUT,
100
+ resourceUri: `/issue/${issueId}`,
101
+ body: {
102
+ fields: formattedFields,
103
+ },
104
+ query: { returnIssue: 'true' },
105
+ });
106
+ const issue = yield (0, common_1.jiraApiCall)({
107
+ auth: context.auth,
108
+ method: pieces_common_1.HttpMethod.GET,
109
+ resourceUri: `/issue/${issueId}`,
110
+ });
111
+ const updatedIssueProperties = (0, props_1.transformCustomFields)(flattenedFields, issue.fields);
112
+ return Object.assign(Object.assign({}, issue), { fields: updatedIssueProperties });
69
113
  });
70
- }),
114
+ },
71
115
  });
72
116
  //# sourceMappingURL=update-issue.js.map