@pipedream/trello 0.3.12 → 0.3.13

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 (50) hide show
  1. package/actions/add-attachment-to-card-via-url/add-attachment-to-card-via-url.mjs +1 -1
  2. package/actions/add-checklist/add-checklist.mjs +1 -1
  3. package/actions/add-comment/add-comment.mjs +1 -1
  4. package/actions/add-existing-label-to-card/add-existing-label-to-card.mjs +1 -1
  5. package/actions/add-file-as-attachment-via-url/add-file-as-attachment-via-url.mjs +1 -1
  6. package/actions/add-image-attachment/add-image-attachment.mjs +1 -1
  7. package/actions/add-label-to-card/add-label-to-card.mjs +1 -1
  8. package/actions/add-member-to-card/add-member-to-card.mjs +1 -1
  9. package/actions/archive-card/archive-card.mjs +1 -1
  10. package/actions/close-board/close-board.mjs +1 -1
  11. package/actions/complete-checklist-item/complete-checklist-item.mjs +1 -1
  12. package/actions/copy-board/copy-board.mjs +1 -1
  13. package/actions/create-board/create-board.mjs +1 -1
  14. package/actions/create-card/create-card.mjs +67 -2
  15. package/actions/create-checklist/create-checklist.mjs +1 -1
  16. package/actions/create-checklist-item/create-checklist-item.mjs +1 -1
  17. package/actions/create-comment-on-card/create-comment-on-card.mjs +1 -1
  18. package/actions/create-label/create-label.mjs +1 -1
  19. package/actions/create-list/create-list.mjs +1 -1
  20. package/actions/delete-checklist/delete-checklist.mjs +1 -1
  21. package/actions/find-labels/find-labels.mjs +1 -1
  22. package/actions/find-list/find-list.mjs +1 -1
  23. package/actions/get-card/get-card.mjs +11 -3
  24. package/actions/get-list/get-list.mjs +1 -1
  25. package/actions/move-card-to-list/move-card-to-list.mjs +1 -1
  26. package/actions/remove-label-from-card/remove-label-from-card.mjs +1 -1
  27. package/actions/rename-list/rename-list.mjs +1 -1
  28. package/actions/search-boards/search-boards.mjs +1 -1
  29. package/actions/search-cards/search-cards.mjs +1 -1
  30. package/actions/search-checklists/search-checklists.mjs +1 -1
  31. package/actions/search-members/search-members.mjs +1 -1
  32. package/actions/update-card/update-card.mjs +66 -2
  33. package/package.json +1 -1
  34. package/sources/card-archived/card-archived.mjs +1 -1
  35. package/sources/card-due-date-reminder/card-due-date-reminder.mjs +1 -1
  36. package/sources/card-moved/card-moved.mjs +1 -1
  37. package/sources/card-updates/card-updates.mjs +16 -4
  38. package/sources/custom-webhook-events/custom-webhook-events.mjs +1 -1
  39. package/sources/new-activity/new-activity.mjs +1 -1
  40. package/sources/new-attachment/new-attachment.mjs +1 -1
  41. package/sources/new-board/new-board.mjs +1 -1
  42. package/sources/new-card/new-card.mjs +16 -4
  43. package/sources/new-checklist/new-checklist.mjs +1 -1
  44. package/sources/new-comment-added-to-card/new-comment-added-to-card.mjs +1 -1
  45. package/sources/new-label/new-label.mjs +1 -1
  46. package/sources/new-label-added-to-card/new-label-added-to-card.mjs +1 -1
  47. package/sources/new-list/new-list.mjs +1 -1
  48. package/sources/new-member-on-card/new-member-on-card.mjs +1 -1
  49. package/sources/new-notification/new-notification.mjs +1 -1
  50. package/trello.app.mjs +48 -6
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-add-attachment-to-card-via-url",
6
6
  name: "Add Attachment to Card via URL",
7
7
  description: "Adds a file attachment on a card by referencing a public URL. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-attachments-post)",
8
- version: "0.0.2",
8
+ version: "0.0.3",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-add-checklist",
6
6
  name: "Create a Checklist",
7
7
  description: "Adds a new checklist to a card.",
8
- version: "0.1.2",
8
+ version: "0.1.3",
9
9
  type: "action",
10
10
  props: {
11
11
  trello: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-add-comment",
6
6
  name: "Create a Comment",
7
7
  description: "Create a new comment on a specific card.",
8
- version: "0.1.2",
8
+ version: "0.1.3",
9
9
  type: "action",
10
10
  props: {
11
11
  trello: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-add-existing-label-to-card",
6
6
  name: "Add Existing Label to Card",
7
7
  description: "Adds an existing label to the specified card. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idlabels-post)",
8
- version: "0.0.2",
8
+ version: "0.0.3",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-add-file-as-attachment-via-url",
6
6
  name: "Add Attachment to Card via URL",
7
7
  description: "Create a file attachment on a card by referencing a public URL",
8
- version: "0.1.2",
8
+ version: "0.1.3",
9
9
  type: "action",
10
10
  props: {
11
11
  trello: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-add-image-attachment",
6
6
  name: "Add Image Attachment to Card",
7
7
  description: "Adds image to card",
8
- version: "0.1.3",
8
+ version: "0.1.4",
9
9
  type: "action",
10
10
  props: {
11
11
  trello: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-add-label-to-card",
6
6
  name: "Add Existing Label to Card",
7
7
  description: "Add an existing label to a card.",
8
- version: "0.1.2",
8
+ version: "0.1.3",
9
9
  type: "action",
10
10
  props: {
11
11
  trello: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-add-member-to-card",
6
6
  name: "Add Member to Card",
7
7
  description: "Adds a member to the specified card. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idmembers-post)",
8
- version: "0.1.3",
8
+ version: "0.1.4",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-archive-card",
6
6
  name: "Archive Card",
7
7
  description: "Archives a card. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put)",
8
- version: "0.1.3",
8
+ version: "0.1.4",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-close-board",
6
6
  name: "Close Board",
7
7
  description: "Closes a board. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-put)",
8
- version: "0.0.2",
8
+ version: "0.0.3",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-complete-checklist-item",
6
6
  name: "Complete a Checklist Item",
7
7
  description: "Completes an existing checklist item in a card.",
8
- version: "0.1.2",
8
+ version: "0.1.3",
9
9
  type: "action",
10
10
  props: {
11
11
  trello: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-copy-board",
6
6
  name: "Copy a Board",
7
7
  description: "Creates a copy of an existing board.",
8
- version: "0.1.2",
8
+ version: "0.1.3",
9
9
  type: "action",
10
10
  props: {
11
11
  trello: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-create-board",
6
6
  name: "Create a Board",
7
7
  description: "Creates a new Trello board.",
8
- version: "0.1.2",
8
+ version: "0.1.3",
9
9
  type: "action",
10
10
  props: {
11
11
  trello: {
@@ -4,8 +4,8 @@ export default {
4
4
  ...common,
5
5
  key: "trello-create-card",
6
6
  name: "Create Card",
7
- description: "Creates a new card. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-post)",
8
- version: "0.0.2",
7
+ description: "Creates a new card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-post)",
8
+ version: "0.0.3",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -151,6 +151,61 @@ export default {
151
151
  "coordinates",
152
152
  ],
153
153
  },
154
+ customFieldIds: {
155
+ propDefinition: [
156
+ common.props.trello,
157
+ "customFieldIds",
158
+ (c) => ({
159
+ boardId: c.board,
160
+ }),
161
+ ],
162
+ reloadProps: true,
163
+ },
164
+ },
165
+ async additionalProps() {
166
+ const props = {};
167
+ if (!this.customFieldIds?.length) {
168
+ return props;
169
+ }
170
+ for (const customFieldId of this.customFieldIds) {
171
+ const customField = await this.trello.getCustomField(customFieldId);
172
+ props[customFieldId] = {
173
+ type: "string",
174
+ label: `Value for Custom Field - ${customField.name}`,
175
+ };
176
+ if (customField.type === "list") {
177
+ props[customFieldId].options = customField.options?.map((option) => ({
178
+ value: option.id,
179
+ label: option.value.text,
180
+ })) || [];
181
+ }
182
+ }
183
+ return props;
184
+ },
185
+ methods: {
186
+ ...common.methods,
187
+ async getCustomFieldItems($) {
188
+ const customFieldItems = [];
189
+ for (const customFieldId of this.customFieldIds) {
190
+ const customField = await this.trello.getCustomField(customFieldId, $);
191
+ const customFieldItem = {
192
+ idCustomField: customFieldId,
193
+ };
194
+ if (customField.type === "list") {
195
+ customFieldItem.idValue = this[customFieldId];
196
+ } else if (customField.type === "checkbox") {
197
+ customFieldItem.value = {
198
+ checked: this[customFieldId],
199
+ };
200
+ } else {
201
+ customFieldItem.value = {
202
+ [customField.type]: this[customFieldId],
203
+ };
204
+ }
205
+ customFieldItems.push(customFieldItem);
206
+ }
207
+ return customFieldItems;
208
+ },
154
209
  },
155
210
  async run({ $ }) {
156
211
  const {
@@ -170,6 +225,7 @@ export default {
170
225
  address,
171
226
  locationName,
172
227
  coordinates,
228
+ customFieldIds,
173
229
  } = this;
174
230
  const res = await this.trello.createCard({
175
231
  name,
@@ -189,6 +245,15 @@ export default {
189
245
  locationName,
190
246
  coordinates,
191
247
  }, $);
248
+
249
+ if (customFieldIds) {
250
+ const customFieldItems = await this.getCustomFieldItems($);
251
+ const customFields = await this.trello.updateCustomFields(res.id, {
252
+ customFieldItems,
253
+ }, $);
254
+ res.customFields = customFields;
255
+ }
256
+
192
257
  $.export("$summary", `Successfully created card ${res.id}`);
193
258
  return res;
194
259
  },
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-create-checklist",
6
6
  name: "Create Checklist",
7
7
  description: "Creates a checklist on the specified card. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-checklists/#api-checklists-post)",
8
- version: "0.0.2",
8
+ version: "0.0.3",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-create-checklist-item",
6
6
  name: "Create a Checklist Item",
7
7
  description: "Creates a new checklist item in a card.",
8
- version: "0.1.2",
8
+ version: "0.1.3",
9
9
  type: "action",
10
10
  props: {
11
11
  trello: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-create-comment-on-card",
6
6
  name: "Create Comment on Card",
7
7
  description: "Creates a new comment on a card. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-actions-comments-post)",
8
- version: "0.0.2",
8
+ version: "0.0.3",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-create-label",
6
6
  name: "Create Label",
7
7
  description: "Creates a new label on the specified board.",
8
- version: "0.1.2",
8
+ version: "0.1.3",
9
9
  type: "action",
10
10
  props: {
11
11
  trello: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-create-list",
6
6
  name: "Create a List",
7
7
  description: "Creates a new list on a board",
8
- version: "0.1.2",
8
+ version: "0.1.3",
9
9
  type: "action",
10
10
  props: {
11
11
  trello: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-delete-checklist",
6
6
  name: "Delete Checklist",
7
7
  description: "Deletes the specified checklist. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-checklists/#api-checklists-id-delete)",
8
- version: "0.1.3",
8
+ version: "0.1.4",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-find-labels",
6
6
  name: "Find a Label",
7
7
  description: "Finds a label on a specific board by name. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-labels-get)",
8
- version: "0.1.3",
8
+ version: "0.1.4",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-find-list",
6
6
  name: "Find a List",
7
7
  description: "Finds a list on a specific board by name. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-lists-get)",
8
- version: "0.1.3",
8
+ version: "0.1.4",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -4,8 +4,8 @@ export default {
4
4
  ...common,
5
5
  key: "trello-get-card",
6
6
  name: "Get Card",
7
- description: "Gets a card by its ID. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-get)",
8
- version: "0.1.6",
7
+ description: "Gets a card by its ID. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-get)",
8
+ version: "0.1.7",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -28,9 +28,17 @@ export default {
28
28
  description: "The ID of the card to get details of",
29
29
  optional: false,
30
30
  },
31
+ customFieldItems: {
32
+ propDefinition: [
33
+ common.props.trello,
34
+ "customFieldItems",
35
+ ],
36
+ },
31
37
  },
32
38
  async run({ $ }) {
33
- const res = await this.trello.getCard(this.cardId, $);
39
+ const res = await this.trello.getCard(this.cardId, {
40
+ customFieldItems: this.customFieldItems,
41
+ }, $);
34
42
  $.export("$summary", `Successfully retrieved card ${this.cardId}`);
35
43
  return res;
36
44
  },
@@ -4,7 +4,7 @@ export default {
4
4
  key: "trello-get-list",
5
5
  name: "Get List",
6
6
  description: "Get information about a List",
7
- version: "0.0.3",
7
+ version: "0.0.4",
8
8
  type: "action",
9
9
  props: {
10
10
  // eslint-disable-next-line pipedream/props-label, pipedream/props-description
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-move-card-to-list",
6
6
  name: "Move Card to List",
7
7
  description: "Moves a card to the specified board/list pair. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put)",
8
- version: "0.1.3",
8
+ version: "0.1.4",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-remove-label-from-card",
6
6
  name: "Remove Card Label",
7
7
  description: "Removes label from card. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idlabels-idlabel-delete)",
8
- version: "0.1.3",
8
+ version: "0.1.4",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-rename-list",
6
6
  name: "Rename List",
7
7
  description: "Renames an existing list. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-lists/#api-lists-id-put)",
8
- version: "0.0.2",
8
+ version: "0.0.3",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-search-boards",
6
6
  name: "Search Boards",
7
7
  description: "Searches for boards matching the specified query. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-search/#api-search-get)",
8
- version: "0.2.3",
8
+ version: "0.2.4",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-search-cards",
6
6
  name: "Search Cards",
7
7
  description: "Searches for cards matching the specified query. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-search/#api-search-get)",
8
- version: "0.1.3",
8
+ version: "0.1.4",
9
9
  type: "action",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-search-checklists",
6
6
  name: "Find Checklist",
7
7
  description: "Find a checklist on a particular board or card by name.",
8
- version: "0.1.2",
8
+ version: "0.1.3",
9
9
  type: "action",
10
10
  props: {
11
11
  trello: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-search-members",
6
6
  name: "Search Members",
7
7
  description: "Search for Trello members.",
8
- version: "0.1.2",
8
+ version: "0.1.3",
9
9
  type: "action",
10
10
  props: {
11
11
  trello: {
@@ -6,8 +6,8 @@ export default {
6
6
  ...common,
7
7
  key: "trello-update-card",
8
8
  name: "Update Card",
9
- description: "Updates a card. [See the docs here](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put)",
10
- version: "0.1.3",
9
+ description: "Updates a card. [See the documentation](https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put)",
10
+ version: "0.1.4",
11
11
  type: "action",
12
12
  props: {
13
13
  ...common.props,
@@ -139,6 +139,61 @@ export default {
139
139
  "coordinates",
140
140
  ],
141
141
  },
142
+ customFieldIds: {
143
+ propDefinition: [
144
+ common.props.trello,
145
+ "customFieldIds",
146
+ (c) => ({
147
+ boardId: c.idBoard,
148
+ }),
149
+ ],
150
+ reloadProps: true,
151
+ },
152
+ },
153
+ async additionalProps() {
154
+ const props = {};
155
+ if (!this.customFieldIds?.length) {
156
+ return props;
157
+ }
158
+ for (const customFieldId of this.customFieldIds) {
159
+ const customField = await this.trello.getCustomField(customFieldId);
160
+ props[customFieldId] = {
161
+ type: "string",
162
+ label: `Value for Custom Field - ${customField.name}`,
163
+ };
164
+ if (customField.type === "list") {
165
+ props[customFieldId].options = customField.options?.map((option) => ({
166
+ value: option.id,
167
+ label: option.value.text,
168
+ })) || [];
169
+ }
170
+ }
171
+ return props;
172
+ },
173
+ methods: {
174
+ ...common.methods,
175
+ async getCustomFieldItems($) {
176
+ const customFieldItems = [];
177
+ for (const customFieldId of this.customFieldIds) {
178
+ const customField = await this.trello.getCustomField(customFieldId, $);
179
+ const customFieldItem = {
180
+ idCustomField: customFieldId,
181
+ };
182
+ if (customField.type === "list") {
183
+ customFieldItem.idValue = this[customFieldId];
184
+ } else if (customField.type === "checkbox") {
185
+ customFieldItem.value = {
186
+ checked: this[customFieldId],
187
+ };
188
+ } else {
189
+ customFieldItem.value = {
190
+ [customField.type]: this[customFieldId],
191
+ };
192
+ }
193
+ customFieldItems.push(customFieldItem);
194
+ }
195
+ return customFieldItems;
196
+ },
142
197
  },
143
198
  async run({ $ }) {
144
199
  const opts = pickBy(pick(this, [
@@ -159,6 +214,15 @@ export default {
159
214
  "coordinates",
160
215
  ]));
161
216
  const res = await this.trello.updateCard(this.idCard, opts, $);
217
+
218
+ if (this.customFieldIds) {
219
+ const customFieldItems = await this.getCustomFieldItems($);
220
+ const updatedCustomFields = await this.trello.updateCustomFields(this.idCard, {
221
+ customFieldItems,
222
+ }, $);
223
+ res.updatedCustomFields = updatedCustomFields;
224
+ }
225
+
162
226
  $.export("$summary", `Successfully updated card ${res.name}`);
163
227
  return res;
164
228
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/trello",
3
- "version": "0.3.12",
3
+ "version": "0.3.13",
4
4
  "description": "Pipedream Trello Components",
5
5
  "main": "trello.app.mjs",
6
6
  "keywords": [
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-card-archived",
6
6
  name: "Card Archived (Instant)",
7
7
  description: "Emit new event for each card archived.",
8
- version: "0.0.12",
8
+ version: "0.0.13",
9
9
  type: "source",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-card-due-date-reminder",
6
6
  name: "Card Due Date Reminder",
7
7
  description: "Emit new event at a specified time before a card is due.",
8
- version: "0.0.9",
8
+ version: "0.0.10",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-card-moved",
6
6
  name: "Card Moved (Instant)",
7
7
  description: "Emit new event each time a card is moved to a list.",
8
- version: "0.0.11",
8
+ version: "0.0.12",
9
9
  type: "source",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-card-updates",
6
6
  name: "Card Updates (Instant)",
7
7
  description: "Emit new event for each update to a Trello card.",
8
- version: "0.0.11",
8
+ version: "0.0.12",
9
9
  type: "source",
10
10
  props: {
11
11
  ...common.props,
@@ -24,6 +24,12 @@ export default {
24
24
  }),
25
25
  ],
26
26
  },
27
+ customFieldItems: {
28
+ propDefinition: [
29
+ common.props.trello,
30
+ "customFieldItems",
31
+ ],
32
+ },
27
33
  },
28
34
  methods: {
29
35
  ...common.methods,
@@ -31,11 +37,15 @@ export default {
31
37
  let cards = [];
32
38
  if (this.cards && this.cards.length > 0) {
33
39
  for (const cardId of this.cards) {
34
- const card = await this.trello.getCard(cardId);
40
+ const card = await this.trello.getCard(cardId, {
41
+ customFieldItems: this.customFieldItems,
42
+ });
35
43
  cards.push(card);
36
44
  }
37
45
  } else {
38
- cards = await this.trello.getCards(this.board);
46
+ cards = await this.trello.getCards(this.board, {
47
+ customFieldItems: this.customFieldItems,
48
+ });
39
49
  }
40
50
  return {
41
51
  sampleEvents: cards,
@@ -48,7 +58,9 @@ export default {
48
58
  },
49
59
  async getResult(event) {
50
60
  const cardId = event.body?.action?.data?.card?.id;
51
- return this.trello.getCard(cardId);
61
+ return this.trello.getCard(cardId, {
62
+ customFieldItems: this.customFieldItems,
63
+ });
52
64
  },
53
65
  isRelevant({ result: card }) {
54
66
  return (
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-custom-webhook-events",
6
6
  name: "Custom Webhook Events (Instant)",
7
7
  description: "Emit new events for activity matching a board, event types, lists and/or cards.",
8
- version: "0.0.10",
8
+ version: "0.0.11",
9
9
  type: "source",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-new-activity",
6
6
  name: "New Activity (Instant)",
7
7
  description: "Emit new event for new activity on a board.",
8
- version: "0.0.8",
8
+ version: "0.0.9",
9
9
  type: "source",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-new-attachment",
6
6
  name: "New Attachment (Instant)",
7
7
  description: "Emit new event for new attachment on a board.",
8
- version: "0.0.8",
8
+ version: "0.0.9",
9
9
  type: "source",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-new-board",
6
6
  name: "New Board (Instant)",
7
7
  description: "Emit new event for each new board added.",
8
- version: "0.0.12",
8
+ version: "0.0.13",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-new-card",
6
6
  name: "New Card (Instant)",
7
7
  description: "Emit new event for each new Trello card on a board.",
8
- version: "0.0.11",
8
+ version: "0.0.12",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -25,13 +25,23 @@ export default {
25
25
  }),
26
26
  ],
27
27
  },
28
+ customFieldItems: {
29
+ propDefinition: [
30
+ common.props.trello,
31
+ "customFieldItems",
32
+ ],
33
+ },
28
34
  },
29
35
  methods: {
30
36
  ...common.methods,
31
37
  async getSampleEvents() {
32
38
  const cards = this.lists && this.lists.length > 0
33
- ? await this.trello.getCardsInList(this.lists[0])
34
- : await this.trello.getCards(this.board);
39
+ ? await this.trello.getCardsInList(this.lists[0], {
40
+ customFieldItems: this.customFieldItems,
41
+ })
42
+ : await this.trello.getCards(this.board, {
43
+ customFieldItems: this.customFieldItems,
44
+ });
35
45
  return {
36
46
  sampleEvents: cards,
37
47
  sortField: "dateLastActivity",
@@ -43,7 +53,9 @@ export default {
43
53
  },
44
54
  async getResult(event) {
45
55
  const cardId = event.body?.action?.data?.card?.id;
46
- return this.trello.getCard(cardId);
56
+ return this.trello.getCard(cardId, {
57
+ customFieldItems: this.customFieldItems,
58
+ });
47
59
  },
48
60
  isRelevant({ result: card }) {
49
61
  if (this.board && this.board !== card.idBoard) return false;
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-new-checklist",
6
6
  name: "New Checklist (Instant)",
7
7
  description: "Emit new event for each new checklist added to a board.",
8
- version: "0.0.13",
8
+ version: "0.0.14",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-new-comment-added-to-card",
6
6
  name: "New Comment Added to Card (Instant)",
7
7
  description: "Emit new event for each new comment added to a card.",
8
- version: "0.1.1",
8
+ version: "0.1.2",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  props: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-new-label",
6
6
  name: "New Label (Instant)",
7
7
  description: "Emit new event for each new label added to a board.",
8
- version: "0.0.13",
8
+ version: "0.0.14",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-new-label-added-to-card",
6
6
  name: "New Label Added To Card (Instant)",
7
7
  description: "Emit new event for each label added to a card.",
8
- version: "0.0.11",
8
+ version: "0.0.12",
9
9
  type: "source",
10
10
  props: {
11
11
  ...common.props,
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-new-list",
6
6
  name: "New List (Instant)",
7
7
  description: "Emit new event for each new list added to a board.",
8
- version: "0.0.13",
8
+ version: "0.0.14",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "trello-new-member-on-card",
6
6
  name: "New Member on Card (Instant)",
7
7
  description: "Emit new event for each member that join in a card.",
8
- version: "0.0.14",
8
+ version: "0.0.15",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -6,7 +6,7 @@ export default {
6
6
  name: "New Notification",
7
7
  description:
8
8
  "Emit new event for each new Trello notification for the authenticated user.",
9
- version: "0.0.10",
9
+ version: "0.0.11",
10
10
  type: "source",
11
11
  dedupe: "unique",
12
12
  methods: {
package/trello.app.mjs CHANGED
@@ -146,6 +146,21 @@ export default {
146
146
  }));
147
147
  },
148
148
  },
149
+ customFieldIds: {
150
+ type: "string[]",
151
+ label: "Custom Field Ids",
152
+ description: "An array of custom field Ids to create/update",
153
+ optional: true,
154
+ async options({ boardId }) {
155
+ const customFields = await this.listCustomFields(boardId);
156
+ return customFields?.map(({
157
+ id: value, name: label,
158
+ }) => ({
159
+ value,
160
+ label,
161
+ })) || [];
162
+ },
163
+ },
149
164
  mimeType: {
150
165
  type: "string",
151
166
  label: "File Attachment Type",
@@ -237,6 +252,13 @@ export default {
237
252
  ],
238
253
  default: "all",
239
254
  },
255
+ customFieldItems: {
256
+ type: "boolean",
257
+ label: "Custom Field Items",
258
+ description: "Whether to include the customFieldItems",
259
+ default: false,
260
+ optional: true,
261
+ },
240
262
  },
241
263
  methods: {
242
264
  _getBaseUrl() {
@@ -525,15 +547,17 @@ export default {
525
547
  * @returns {object} a card object. See more at the API docs:
526
548
  * https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-post
527
549
  */
528
- async getCard(id) {
550
+ async getCard(id, params = {}, $) {
529
551
  return this._makeRequest({
530
552
  path: `cards/${id}`,
531
- });
553
+ params,
554
+ }, $);
532
555
  },
533
- async getCards(id) {
556
+ async getCards(id, params = {}, $) {
534
557
  return this._makeRequest({
535
558
  path: `boards/${id}/cards`,
536
- });
559
+ params,
560
+ }, $);
537
561
  },
538
562
  async getFilteredCards(boardId, filter) {
539
563
  return this._makeRequest({
@@ -543,10 +567,11 @@ export default {
543
567
  },
544
568
  });
545
569
  },
546
- async getCardsInList(listId) {
570
+ async getCardsInList(listId, params = {}, $) {
547
571
  return this._makeRequest({
548
572
  path: `lists/${listId}/cards`,
549
- });
573
+ params,
574
+ }, $);
550
575
  },
551
576
  async getMemberCards(userId) {
552
577
  return this._makeRequest({
@@ -736,5 +761,22 @@ export default {
736
761
  path: `members/${id}/organizations?fields="id,name"`,
737
762
  });
738
763
  },
764
+ getCustomField(customFieldId, $) {
765
+ return this._makeRequest({
766
+ path: `customFields/${customFieldId}`,
767
+ }, $);
768
+ },
769
+ listCustomFields(boardId, $) {
770
+ return this._makeRequest({
771
+ path: `boards/${boardId}/customFields`,
772
+ }, $);
773
+ },
774
+ updateCustomFields(cardId, data, $) {
775
+ return this._makeRequest({
776
+ method: "PUT",
777
+ path: `cards/${cardId}/customFields`,
778
+ data,
779
+ }, $);
780
+ },
739
781
  },
740
782
  };