@activepieces/piece-jira-data-center 0.0.1

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.
Files changed (89) hide show
  1. package/package.json +19 -0
  2. package/src/auth.d.ts +7 -0
  3. package/src/auth.d.ts.map +1 -0
  4. package/src/auth.js +59 -0
  5. package/src/auth.js.map +1 -0
  6. package/src/index.d.ts +5 -0
  7. package/src/index.d.ts.map +1 -0
  8. package/src/index.js +64 -0
  9. package/src/index.js.map +1 -0
  10. package/src/lib/actions/add-attachment-to-issue.d.ts +21 -0
  11. package/src/lib/actions/add-attachment-to-issue.d.ts.map +1 -0
  12. package/src/lib/actions/add-attachment-to-issue.js +41 -0
  13. package/src/lib/actions/add-attachment-to-issue.js.map +1 -0
  14. package/src/lib/actions/add-comment-to-issue.d.ts +21 -0
  15. package/src/lib/actions/add-comment-to-issue.d.ts.map +1 -0
  16. package/src/lib/actions/add-comment-to-issue.js +38 -0
  17. package/src/lib/actions/add-comment-to-issue.js.map +1 -0
  18. package/src/lib/actions/add-watcher-to-issue.d.ts +20 -0
  19. package/src/lib/actions/add-watcher-to-issue.d.ts.map +1 -0
  20. package/src/lib/actions/add-watcher-to-issue.js +48 -0
  21. package/src/lib/actions/add-watcher-to-issue.js.map +1 -0
  22. package/src/lib/actions/assign-issue.d.ts +27 -0
  23. package/src/lib/actions/assign-issue.d.ts.map +1 -0
  24. package/src/lib/actions/assign-issue.js +39 -0
  25. package/src/lib/actions/assign-issue.js.map +1 -0
  26. package/src/lib/actions/create-issue.d.ts +24 -0
  27. package/src/lib/actions/create-issue.d.ts.map +1 -0
  28. package/src/lib/actions/create-issue.js +110 -0
  29. package/src/lib/actions/create-issue.js.map +1 -0
  30. package/src/lib/actions/delete-issue-comment.d.ts +24 -0
  31. package/src/lib/actions/delete-issue-comment.d.ts.map +1 -0
  32. package/src/lib/actions/delete-issue-comment.js +64 -0
  33. package/src/lib/actions/delete-issue-comment.js.map +1 -0
  34. package/src/lib/actions/find-user.d.ts +7 -0
  35. package/src/lib/actions/find-user.d.ts.map +1 -0
  36. package/src/lib/actions/find-user.js +37 -0
  37. package/src/lib/actions/find-user.js.map +1 -0
  38. package/src/lib/actions/get-issue-attachment.d.ts +7 -0
  39. package/src/lib/actions/get-issue-attachment.d.ts.map +1 -0
  40. package/src/lib/actions/get-issue-attachment.js +46 -0
  41. package/src/lib/actions/get-issue-attachment.js.map +1 -0
  42. package/src/lib/actions/get-issue.d.ts +23 -0
  43. package/src/lib/actions/get-issue.d.ts.map +1 -0
  44. package/src/lib/actions/get-issue.js +136 -0
  45. package/src/lib/actions/get-issue.js.map +1 -0
  46. package/src/lib/actions/link-issues.d.ts +27 -0
  47. package/src/lib/actions/link-issues.d.ts.map +1 -0
  48. package/src/lib/actions/link-issues.js +52 -0
  49. package/src/lib/actions/link-issues.js.map +1 -0
  50. package/src/lib/actions/list-issue-comments.d.ts +22 -0
  51. package/src/lib/actions/list-issue-comments.d.ts.map +1 -0
  52. package/src/lib/actions/list-issue-comments.js +59 -0
  53. package/src/lib/actions/list-issue-comments.js.map +1 -0
  54. package/src/lib/actions/search-issues.d.ts +8 -0
  55. package/src/lib/actions/search-issues.d.ts.map +1 -0
  56. package/src/lib/actions/search-issues.js +40 -0
  57. package/src/lib/actions/search-issues.js.map +1 -0
  58. package/src/lib/actions/update-issue-comment.d.ts +25 -0
  59. package/src/lib/actions/update-issue-comment.d.ts.map +1 -0
  60. package/src/lib/actions/update-issue-comment.js +71 -0
  61. package/src/lib/actions/update-issue-comment.js.map +1 -0
  62. package/src/lib/actions/update-issue.d.ts +24 -0
  63. package/src/lib/actions/update-issue.d.ts.map +1 -0
  64. package/src/lib/actions/update-issue.js +122 -0
  65. package/src/lib/actions/update-issue.js.map +1 -0
  66. package/src/lib/common/index.d.ts +74 -0
  67. package/src/lib/common/index.d.ts.map +1 -0
  68. package/src/lib/common/index.js +197 -0
  69. package/src/lib/common/index.js.map +1 -0
  70. package/src/lib/common/props.d.ts +80 -0
  71. package/src/lib/common/props.d.ts.map +1 -0
  72. package/src/lib/common/props.js +572 -0
  73. package/src/lib/common/props.js.map +1 -0
  74. package/src/lib/common/types.d.ts +23 -0
  75. package/src/lib/common/types.d.ts.map +1 -0
  76. package/src/lib/common/types.js +25 -0
  77. package/src/lib/common/types.js.map +1 -0
  78. package/src/lib/triggers/new-issue.d.ts +23 -0
  79. package/src/lib/triggers/new-issue.d.ts.map +1 -0
  80. package/src/lib/triggers/new-issue.js +61 -0
  81. package/src/lib/triggers/new-issue.js.map +1 -0
  82. package/src/lib/triggers/updated-issue-status.d.ts +23 -0
  83. package/src/lib/triggers/updated-issue-status.d.ts.map +1 -0
  84. package/src/lib/triggers/updated-issue-status.js +61 -0
  85. package/src/lib/triggers/updated-issue-status.js.map +1 -0
  86. package/src/lib/triggers/updated-issue.d.ts +23 -0
  87. package/src/lib/triggers/updated-issue.d.ts.map +1 -0
  88. package/src/lib/triggers/updated-issue.js +61 -0
  89. package/src/lib/triggers/updated-issue.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-issues.js","sourceRoot":"","sources":["../../../../src/lib/actions/search-issues.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,qCAAgD;AAChD,sCAA8C;AAC9C,6BAAwB;AACxB,+DAA8D;AAEjD,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,4BAA4B;IACzC,IAAI,EAAE,yBAAkB;IACxB,KAAK,EAAE;QACN,GAAG,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACtB,WAAW,EAAE,KAAK;YAClB,WAAW,EAAE,oCAAoC;YACjD,YAAY,EAAE,+CAA+C;YAC7D,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC3B,WAAW,EAAE,aAAa;YAC1B,YAAY,EAAE,EAAE;YAChB,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACD,GAAG,EAAE,KAA6B,EAAE,oDAAxB,EAAE,IAAI,EAAE,UAAU,EAAE;QAC/B,MAAM,+BAAe,CAAC,WAAW,CAAC,UAAU,EAAE;YAC7C,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;SACtC,CAAC,CAAC;QACH,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC;QACvC,OAAO,MAAM,IAAA,0BAAiB,EAAC;YAC9B,IAAI;YACJ,GAAG;YACH,UAAU,EAAE,UAAU;SACtB,CAAC,CAAC;IACJ,CAAC,CAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ export declare const updateIssueCommentAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ projectId: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
6
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
8
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
9
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
11
+ }>>;
12
+ issueId: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
13
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
14
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
15
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
16
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
17
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
18
+ }>>;
19
+ commentId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
20
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
21
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
22
+ }>>;
23
+ comment: import("@activepieces/pieces-framework").LongTextProperty<true>;
24
+ }>;
25
+ //# sourceMappingURL=update-issue-comment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-issue-comment.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/update-issue-comment.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;EA6DnC,CAAC"}
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateIssueCommentAction = 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 pieces_common_1 = require("@activepieces/pieces-common");
8
+ const common_1 = require("../common");
9
+ const props_1 = require("../common/props");
10
+ exports.updateIssueCommentAction = (0, pieces_framework_1.createAction)({
11
+ auth: auth_1.jiraDataCenterAuth,
12
+ name: 'update_issue_comment',
13
+ displayName: 'Update Issue Comment',
14
+ description: 'Updates a comment to a specific issue.',
15
+ props: {
16
+ projectId: (0, props_1.getProjectIdDropdown)(),
17
+ issueId: (0, props_1.getIssueIdDropdown)({ refreshers: ['projectId'] }),
18
+ commentId: pieces_framework_1.Property.Dropdown({
19
+ auth: auth_1.jiraDataCenterAuth,
20
+ displayName: 'Comment ID',
21
+ refreshers: ['issueId'],
22
+ required: true,
23
+ options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, issueId }) {
24
+ if (!auth || !issueId) {
25
+ return {
26
+ disabled: true,
27
+ placeholder: 'Please connect your account and select issue.',
28
+ options: [],
29
+ };
30
+ }
31
+ const response = yield (0, common_1.sendJiraRequest)({
32
+ method: pieces_common_1.HttpMethod.GET,
33
+ url: `issue/${issueId}/comment`,
34
+ auth: auth,
35
+ queryParams: {
36
+ orderBy: '-created',
37
+ },
38
+ });
39
+ return {
40
+ disabled: false,
41
+ options: response.body.comments.map((comment) => {
42
+ var _a, _b;
43
+ return {
44
+ label: (_b = (_a = comment.body) === null || _a === void 0 ? void 0 : _a.substring(0, 100)) !== null && _b !== void 0 ? _b : comment.id,
45
+ value: comment.id,
46
+ };
47
+ }),
48
+ };
49
+ }),
50
+ }),
51
+ comment: pieces_framework_1.Property.LongText({
52
+ displayName: 'Comment Body',
53
+ required: true,
54
+ }),
55
+ },
56
+ run(context) {
57
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
58
+ const { issueId, comment, commentId } = context.propsValue;
59
+ const response = yield (0, common_1.sendJiraRequest)({
60
+ method: pieces_common_1.HttpMethod.PUT,
61
+ url: `issue/${issueId}/comment/${commentId}`,
62
+ auth: context.auth,
63
+ body: {
64
+ body: comment,
65
+ },
66
+ });
67
+ return response.body;
68
+ });
69
+ },
70
+ });
71
+ //# sourceMappingURL=update-issue-comment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-issue-comment.js","sourceRoot":"","sources":["../../../../src/lib/actions/update-issue-comment.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,qCAAgD;AAChD,+DAAyD;AACzD,sCAA4C;AAC5C,2CAA2E;AAE9D,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACpD,IAAI,EAAE,yBAAkB;IACxB,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sBAAsB;IACnC,WAAW,EAAE,wCAAwC;IACrD,KAAK,EAAE;QACN,SAAS,EAAE,IAAA,4BAAoB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AAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE3D,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAe,EAAC;gBACtC,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,SAAS,OAAO,YAAY,SAAS,EAAE;gBAC5C,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,IAAI,EAAE;oBACL,IAAI,EAAE,OAAO;iBACb;aACD,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACtB,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ export declare const updateIssueAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
4
+ }>, {
5
+ issueId: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
6
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
7
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
8
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
9
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
11
+ }>>;
12
+ statusId: import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
13
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
14
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
15
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
16
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
17
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
18
+ }>>;
19
+ issueFields: import("@activepieces/pieces-framework").DynamicProperties<true, import("@activepieces/pieces-framework").CustomAuthProperty<{
20
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
21
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
22
+ }>>;
23
+ }>;
24
+ //# sourceMappingURL=update-issue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-issue.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/update-issue.ts"],"names":[],"mappings":"AA8BA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;EAuH5B,CAAC"}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateIssueAction = 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 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");
12
+ function getFields(auth, issueId) {
13
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
+ const response = yield (0, common_1.jiraApiCall)({
15
+ auth: auth,
16
+ method: pieces_common_1.HttpMethod.GET,
17
+ resourceUri: `/issue/${issueId}/editmeta`,
18
+ });
19
+ if (!response.fields)
20
+ return [];
21
+ return Object.entries(response.fields).map(([key, field]) => (Object.assign(Object.assign({}, field), { key, fieldId: key })));
22
+ });
23
+ }
24
+ exports.updateIssueAction = (0, pieces_framework_1.createAction)({
25
+ name: 'update_issue',
26
+ displayName: 'Update Issue',
27
+ description: 'Updates an existing issue.',
28
+ auth: auth_1.jiraDataCenterAuth,
29
+ props: {
30
+ issueId: (0, props_1.issueIdOrKeyProp)('Issue ID or Key', true),
31
+ statusId: (0, props_1.issueStatusIdProp)('Status', false),
32
+ issueFields: pieces_framework_1.Property.DynamicProperties({
33
+ auth: auth_1.jiraDataCenterAuth,
34
+ displayName: 'Fields',
35
+ required: true,
36
+ refreshers: ['issueId'],
37
+ props: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, issueId }) {
38
+ if (!auth || !issueId) {
39
+ return {};
40
+ }
41
+ const props = {};
42
+ const authValue = auth;
43
+ const issueIdValue = issueId;
44
+ const fields = yield getFields(authValue, issueIdValue);
45
+ for (const field of fields) {
46
+ // skip invalid custom fields
47
+ if (field.schema.custom) {
48
+ const customFieldType = field.schema.custom.split(':')[1];
49
+ if (!types_1.VALID_CUSTOM_FIELD_TYPES.includes(customFieldType)) {
50
+ continue;
51
+ }
52
+ }
53
+ if (field.key === 'issuetype') {
54
+ props[field.key] = pieces_framework_1.Property.StaticDropdown({
55
+ displayName: field.name,
56
+ required: false,
57
+ options: {
58
+ disabled: false,
59
+ options: field.allowedValues
60
+ ? field.allowedValues.map((option) => ({
61
+ label: option.name,
62
+ value: option.id,
63
+ }))
64
+ : [],
65
+ },
66
+ });
67
+ }
68
+ else {
69
+ props[field.key] = yield (0, props_1.createPropertyDefinition)(authValue, field, false);
70
+ }
71
+ }
72
+ // Remove null props
73
+ return Object.fromEntries(Object.entries(props).filter(([_, prop]) => prop !== null));
74
+ }),
75
+ }),
76
+ },
77
+ run(context) {
78
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
79
+ var _a, _b;
80
+ const { issueId, statusId } = context.propsValue;
81
+ const inputIssueFields = (_a = context.propsValue.issueFields) !== null && _a !== void 0 ? _a : {};
82
+ if ((0, shared_1.isNil)(issueId)) {
83
+ throw new Error('Issue ID is required');
84
+ }
85
+ if (!(0, shared_1.isNil)(statusId) && statusId !== '') {
86
+ yield (0, common_1.jiraApiCall)({
87
+ auth: context.auth,
88
+ method: pieces_common_1.HttpMethod.POST,
89
+ resourceUri: `/issue/${issueId}/transitions`,
90
+ body: {
91
+ transition: {
92
+ id: statusId,
93
+ },
94
+ },
95
+ });
96
+ }
97
+ const issueTypeFieldsResponse = yield (0, common_1.jiraApiCall)({
98
+ auth: context.auth,
99
+ method: pieces_common_1.HttpMethod.GET,
100
+ resourceUri: `/issue/${issueId}/editmeta`,
101
+ });
102
+ const flattenedFields = Object.entries((_b = issueTypeFieldsResponse.fields) !== null && _b !== void 0 ? _b : {}).map(([key, field]) => (Object.assign(Object.assign({}, field), { key, fieldId: key })));
103
+ const formattedFields = (0, props_1.formatIssueFields)(flattenedFields, inputIssueFields);
104
+ yield (0, common_1.jiraApiCall)({
105
+ auth: context.auth,
106
+ method: pieces_common_1.HttpMethod.PUT,
107
+ resourceUri: `/issue/${issueId}`,
108
+ body: {
109
+ fields: formattedFields,
110
+ },
111
+ });
112
+ const issue = yield (0, common_1.jiraApiCall)({
113
+ auth: context.auth,
114
+ method: pieces_common_1.HttpMethod.GET,
115
+ resourceUri: `/issue/${issueId}`,
116
+ });
117
+ const updatedIssueProperties = (0, props_1.transformCustomFields)(flattenedFields, issue.fields);
118
+ return Object.assign(Object.assign({}, issue), { fields: updatedIssueProperties });
119
+ });
120
+ },
121
+ });
122
+ //# sourceMappingURL=update-issue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-issue.js","sourceRoot":"","sources":["../../../../src/lib/actions/update-issue.ts"],"names":[],"mappings":";;;;AAAA,qEAA2F;AAC3F,qCAAoE;AACpE,2CAMyB;AACzB,sCAAwC;AACxC,2CAA+E;AAC/E,+DAAyD;AACzD,iDAA6C;AAE7C,SAAe,SAAS,CAAC,IAAwB,EAAE,OAAe;;QACjE,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAA2E;YAC5G,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,0BAAU,CAAC,GAAG;YACtB,WAAW,EAAE,UAAU,OAAO,WAAW;SACzC,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO,EAAE,CAAC;QAEhC,OA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BAClB,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,WAAW,EAAE,UAAU,OAAO,EAAE;aAChC,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,74 @@
1
+ import { HttpMessageBody, HttpMethod, HttpRequest } from '@activepieces/pieces-common';
2
+ import { JiraDataCenterAuth } from '../../auth';
3
+ export declare function sendJiraRequest(request: HttpRequest & {
4
+ auth: JiraDataCenterAuth;
5
+ }): Promise<import("@activepieces/pieces-common").HttpResponse<any>>;
6
+ export declare function getUsers(auth: JiraDataCenterAuth): Promise<any[]>;
7
+ export declare function getProjects(auth: JiraDataCenterAuth): Promise<JiraProject[]>;
8
+ export declare function getIssueTypes({ auth, projectId, }: {
9
+ auth: JiraDataCenterAuth;
10
+ projectId: string;
11
+ }): Promise<{
12
+ id: string;
13
+ name: string;
14
+ }[]>;
15
+ export declare function getPriorities({ auth }: {
16
+ auth: JiraDataCenterAuth;
17
+ }): Promise<any[]>;
18
+ export declare function searchIssuesByJql({ auth, jql, maxResults, }: {
19
+ auth: JiraDataCenterAuth;
20
+ jql: string;
21
+ maxResults: number;
22
+ }): Promise<any[]>;
23
+ export declare function createJiraIssue(data: CreateIssueParams): Promise<any>;
24
+ export declare function updateJiraIssue(data: UpdateIssueParams): Promise<any>;
25
+ export type RequestParams = Record<string, string | number | string[] | undefined>;
26
+ export type JiraApiCallParams = {
27
+ auth: JiraDataCenterAuth;
28
+ method: HttpMethod;
29
+ resourceUri: string;
30
+ query?: RequestParams;
31
+ body?: any;
32
+ };
33
+ export declare function jiraApiCall<T extends HttpMessageBody>({ auth, method, resourceUri, query, body, }: JiraApiCallParams): Promise<T>;
34
+ export declare function jiraPaginatedApiCall<T extends HttpMessageBody, K extends string>({ auth, method, resourceUri, query, body, propertyName, }: JiraApiCallParams & {
35
+ propertyName: K;
36
+ }): Promise<T[]>;
37
+ export interface JiraIssueType {
38
+ id: string;
39
+ description: string;
40
+ name: string;
41
+ }
42
+ export interface JiraProject {
43
+ id: string;
44
+ key: string;
45
+ name: string;
46
+ expand: string;
47
+ self: string;
48
+ projectTypeKey: string;
49
+ simplified: boolean;
50
+ style: string;
51
+ isPrivate: boolean;
52
+ properties: any;
53
+ }
54
+ export interface CreateIssueParams {
55
+ auth: JiraDataCenterAuth;
56
+ projectId: string;
57
+ summary: string;
58
+ description?: string;
59
+ issueTypeId: string;
60
+ assignee?: string;
61
+ priority?: string;
62
+ parentKey?: string;
63
+ }
64
+ export interface UpdateIssueParams {
65
+ auth: JiraDataCenterAuth;
66
+ issueId?: string;
67
+ summary?: string;
68
+ description?: string;
69
+ issueTypeId: string;
70
+ assignee?: string;
71
+ priority?: string;
72
+ parentKey?: string;
73
+ }
74
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,eAAe,EACf,UAAU,EACV,WAAW,EAGX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGhD,wBAAsB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG;IAAE,IAAI,EAAE,kBAAkB,CAAA;CAAE,oEASxF;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,kBAAkB,kBAYtD;AAED,wBAAsB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAQlF;AAED,wBAAsB,aAAa,CAAC,EACnC,IAAI,EACJ,SAAS,GACT,EAAE;IACF,IAAI,EAAE,kBAAkB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;CAClB;QACwC,MAAM;UAAQ,MAAM;KAM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MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,GAAG,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,kBAAkB,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendJiraRequest = sendJiraRequest;
4
+ exports.getUsers = getUsers;
5
+ exports.getProjects = getProjects;
6
+ exports.getIssueTypes = getIssueTypes;
7
+ exports.getPriorities = getPriorities;
8
+ exports.searchIssuesByJql = searchIssuesByJql;
9
+ exports.createJiraIssue = createJiraIssue;
10
+ exports.updateJiraIssue = updateJiraIssue;
11
+ exports.jiraApiCall = jiraApiCall;
12
+ exports.jiraPaginatedApiCall = jiraPaginatedApiCall;
13
+ const tslib_1 = require("tslib");
14
+ const pieces_common_1 = require("@activepieces/pieces-common");
15
+ const shared_1 = require("@activepieces/shared");
16
+ function sendJiraRequest(request) {
17
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
18
+ return pieces_common_1.httpClient.sendRequest(Object.assign(Object.assign({}, request), { url: `${request.auth.props.instanceUrl}/rest/api/2/${request.url}`, authentication: {
19
+ type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
20
+ token: request.auth.props.personalAccessToken,
21
+ } }));
22
+ });
23
+ }
24
+ function getUsers(auth) {
25
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
26
+ const response = yield sendJiraRequest({
27
+ url: 'user/search',
28
+ method: pieces_common_1.HttpMethod.GET,
29
+ auth: auth,
30
+ queryParams: {
31
+ maxResults: '1000',
32
+ username: '.',
33
+ },
34
+ });
35
+ return response.body;
36
+ });
37
+ }
38
+ function getProjects(auth) {
39
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
40
+ const response = yield jiraApiCall({
41
+ auth,
42
+ method: pieces_common_1.HttpMethod.GET,
43
+ resourceUri: '/project',
44
+ });
45
+ return response;
46
+ });
47
+ }
48
+ function getIssueTypes(_a) {
49
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, projectId, }) {
50
+ return yield jiraPaginatedApiCall({
51
+ auth,
52
+ method: pieces_common_1.HttpMethod.GET,
53
+ resourceUri: `/issue/createmeta/${projectId}/issuetypes`,
54
+ propertyName: 'values',
55
+ });
56
+ });
57
+ }
58
+ function getPriorities(_a) {
59
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth }) {
60
+ const response = yield sendJiraRequest({
61
+ url: 'priority',
62
+ method: pieces_common_1.HttpMethod.GET,
63
+ auth: auth,
64
+ });
65
+ return response.body;
66
+ });
67
+ }
68
+ function searchIssuesByJql(_a) {
69
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, jql, maxResults, }) {
70
+ var _b, _c;
71
+ const response = yield sendJiraRequest({
72
+ auth,
73
+ url: 'search',
74
+ method: pieces_common_1.HttpMethod.POST,
75
+ body: {
76
+ jql,
77
+ maxResults,
78
+ fields: ['*all'],
79
+ },
80
+ });
81
+ return (_c = (_b = response.body) === null || _b === void 0 ? void 0 : _b.issues) !== null && _c !== void 0 ? _c : [];
82
+ });
83
+ }
84
+ function createJiraIssue(data) {
85
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
86
+ const fields = {
87
+ project: {
88
+ key: data.projectId,
89
+ },
90
+ summary: data.summary,
91
+ issuetype: {
92
+ id: data.issueTypeId,
93
+ },
94
+ };
95
+ if (data.assignee)
96
+ fields.assignee = { name: data.assignee };
97
+ if (data.priority)
98
+ fields.priority = { id: data.priority };
99
+ if (data.description)
100
+ fields.description = data.description;
101
+ if (data.parentKey) {
102
+ fields.parent = { key: data.parentKey };
103
+ }
104
+ const response = yield sendJiraRequest({
105
+ url: 'issue',
106
+ method: pieces_common_1.HttpMethod.POST,
107
+ auth: data.auth,
108
+ body: {
109
+ fields: fields,
110
+ },
111
+ });
112
+ return response.body;
113
+ });
114
+ }
115
+ function updateJiraIssue(data) {
116
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
117
+ const fields = {};
118
+ if (data.summary)
119
+ fields.summary = data.summary;
120
+ if (data.issueTypeId)
121
+ fields.issuetype = { id: data.issueTypeId };
122
+ if (data.assignee)
123
+ fields.assignee = { name: data.assignee };
124
+ if (data.priority)
125
+ fields.priority = { id: data.priority };
126
+ if (data.description)
127
+ fields.description = data.description;
128
+ if (data.parentKey) {
129
+ fields.parent = { key: data.parentKey };
130
+ }
131
+ const response = yield sendJiraRequest({
132
+ url: `issue/${data.issueId}`,
133
+ method: pieces_common_1.HttpMethod.PUT,
134
+ auth: data.auth,
135
+ body: {
136
+ fields: fields,
137
+ },
138
+ });
139
+ return response.body;
140
+ });
141
+ }
142
+ function jiraApiCall(_a) {
143
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, method, resourceUri, query, body, }) {
144
+ const baseUrl = `${auth.props.instanceUrl}/rest/api/2`;
145
+ const qs = {};
146
+ if (query) {
147
+ for (const [key, value] of Object.entries(query)) {
148
+ if (value !== null && value !== undefined) {
149
+ qs[key] = String(value);
150
+ }
151
+ }
152
+ }
153
+ const request = {
154
+ method,
155
+ url: baseUrl + resourceUri,
156
+ queryParams: qs,
157
+ body,
158
+ authentication: {
159
+ type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
160
+ token: auth.props.personalAccessToken,
161
+ },
162
+ };
163
+ const response = yield pieces_common_1.httpClient.sendRequest(request);
164
+ return response.body;
165
+ });
166
+ }
167
+ function jiraPaginatedApiCall(_a) {
168
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, method, resourceUri, query, body, propertyName, }) {
169
+ const qs = query ? Object.assign({}, query) : {};
170
+ qs['startAt'] = 0;
171
+ qs['maxResults'] = 100;
172
+ const resultData = [];
173
+ let hasMore = true;
174
+ do {
175
+ const response = yield jiraApiCall({
176
+ auth,
177
+ method,
178
+ resourceUri,
179
+ query: qs,
180
+ body,
181
+ });
182
+ if ((0, shared_1.isNil)(response[propertyName])) {
183
+ break;
184
+ }
185
+ if (Array.isArray(response[propertyName])) {
186
+ resultData.push(...response[propertyName]);
187
+ }
188
+ qs['startAt'] = qs['startAt'] + 100;
189
+ hasMore =
190
+ response.isLast === undefined
191
+ ? response.startAt + response.maxResults < response.total
192
+ : !response.isLast;
193
+ } while (hasMore);
194
+ return resultData;
195
+ });
196
+ }
197
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":";;AAWA,0CASC;AAED,4BAYC;AAED,kCAQC;AAED,sCAaC;AAED,sCAQC;AAED,8CAqBC;AAED,0CA2BC;AAED,0CAqBC;AAYD,kCA8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,MAAM,QAAQ,GAAG,MAAM,WAAW,CAA0B;gBAC3D,IAAI;gBACJ,MAAM;gBACN,WAAW;gBACX,KAAK,EAAE,EAAE;gBACT,IAAI;aACJ,CAAC,CAAC;YAEH,IAAI,IAAA,cAAK,EAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;gBACnC,MAAM;YACP,CAAC;YAED,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;gBAC3C,UAAU,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;YAC5C,CAAC;YAED,EAAE,CAAC,SAAS,CAAC,GAAI,EAAE,CAAC,SAAS,CAAY,GAAG,GAAG,CAAC;YAChD,OAAO;gBACN,QAAQ,CAAC,MAAM,KAAK,SAAS;oBAC5B,CAAC,CAAC,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,UAAU,GAAG,QAAQ,CAAC,KAAK;oBACzD,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;QACtB,CAAC,QAAQ,OAAO,EAAE;QAElB,OAAO,UAAU,CAAC;IACnB,CAAC;CAAA"}
@@ -0,0 +1,80 @@
1
+ import { JiraDataCenterAuth } from '../../auth';
2
+ import { IssueFieldMetaData } from './types';
3
+ export declare function getProjectIdDropdown(data?: DropdownParams): import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
4
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
5
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
6
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
7
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
8
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
9
+ }>>;
10
+ export declare function getIssueIdDropdown(data?: DropdownParams): import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
11
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
12
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
13
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
14
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
15
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
16
+ }>>;
17
+ export declare function getIssueTypeIdDropdown(data?: DropdownParams): import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
18
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
19
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
20
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
21
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
22
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
23
+ }>>;
24
+ export declare function getUsersDropdown(data?: DropdownParams): import("@activepieces/pieces-framework").DropdownProperty<any, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
25
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
26
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
27
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<any, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
28
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
29
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
30
+ }>>;
31
+ export declare const issueTypeIdProp: (displayName: string, required?: boolean) => import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
32
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
33
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
34
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
35
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
36
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
37
+ }>>;
38
+ export declare const issueLinkTypeIdProp: (displayName: string, required?: boolean) => import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
39
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
40
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
41
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
42
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
43
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
44
+ }>>;
45
+ export declare const issueIdOrKeyProp: (displayName: string, required?: boolean) => import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
46
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
47
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
48
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
49
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
50
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
51
+ }>>;
52
+ export declare const issueStatusIdProp: (displayName: string, required?: boolean) => import("@activepieces/pieces-framework").DropdownProperty<string, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
53
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
54
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
55
+ }>> | import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
56
+ instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
57
+ personalAccessToken: import("@activepieces/pieces-framework").SecretTextProperty<true>;
58
+ }>>;
59
+ export declare function createPropertyDefinition(auth: JiraDataCenterAuth, field: IssueFieldMetaData, isRequired?: boolean, projectKey?: string): Promise<import("@activepieces/pieces-framework").ShortTextProperty<true> | import("@activepieces/pieces-framework").ShortTextProperty<false> | import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, false> | import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<string, true> | import("@activepieces/pieces-framework").StaticDropdownProperty<string, false> | import("@activepieces/pieces-framework").StaticDropdownProperty<string, true> | import("@activepieces/pieces-framework").ArrayProperty<false> | import("@activepieces/pieces-framework").ArrayProperty<true> | import("@activepieces/pieces-framework").LongTextProperty<false> | import("@activepieces/pieces-framework").LongTextProperty<true> | import("@activepieces/pieces-framework").NumberProperty<true> | import("@activepieces/pieces-framework").DateTimeProperty<true> | import("@activepieces/pieces-framework").NumberProperty<false> | import("@activepieces/pieces-framework").DateTimeProperty<false> | null>;
60
+ export declare function formatIssueFields(fieldsMetadata: IssueFieldMetaData[], fieldsInput: Record<string, any>): Record<string, any>;
61
+ export declare function transformCustomFields(fieldsMetadata: IssueFieldMetaData[], fieldsInput: Record<string, any>): Record<string, any>;
62
+ export interface DropdownParams {
63
+ required?: boolean;
64
+ refreshers?: string[];
65
+ displayName?: string;
66
+ description?: string;
67
+ }
68
+ export interface SearchIssuesResponse {
69
+ startAt: number;
70
+ maxResults: number;
71
+ total: number;
72
+ issues: Array<{
73
+ id: string;
74
+ key: string;
75
+ fields: {
76
+ summary: string;
77
+ };
78
+ }>;
79
+ }
80
+ //# sourceMappingURL=props.d.ts.map