@activepieces/piece-monday 0.1.5 → 0.2.5

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 (78) hide show
  1. package/package.json +5 -5
  2. package/src/index.d.ts +2 -2
  3. package/src/index.js +32 -23
  4. package/src/index.js.map +1 -1
  5. package/src/lib/actions/create-column.d.ts +6 -0
  6. package/src/lib/actions/create-column.js +42 -0
  7. package/src/lib/actions/create-column.js.map +1 -0
  8. package/src/lib/actions/{get-column-value-by-item.d.ts → create-group.d.ts} +2 -2
  9. package/src/lib/actions/create-group.js +32 -0
  10. package/src/lib/actions/create-group.js.map +1 -0
  11. package/src/lib/actions/create-item.d.ts +2 -2
  12. package/src/lib/actions/create-item.js +42 -43
  13. package/src/lib/actions/create-item.js.map +1 -1
  14. package/src/lib/actions/create-update.d.ts +4 -0
  15. package/src/lib/actions/create-update.js +34 -0
  16. package/src/lib/actions/create-update.js.map +1 -0
  17. package/src/lib/actions/get-board-values.d.ts +5 -0
  18. package/src/lib/actions/get-board-values.js +43 -0
  19. package/src/lib/actions/get-board-values.js.map +1 -0
  20. package/src/lib/actions/{update-item.d.ts → get-column-values.d.ts} +2 -3
  21. package/src/lib/actions/get-column-values.js +41 -0
  22. package/src/lib/actions/get-column-values.js.map +1 -0
  23. package/src/lib/actions/update-column-values-of-item.d.ts +6 -0
  24. package/src/lib/actions/update-column-values-of-item.js +47 -0
  25. package/src/lib/actions/update-column-values-of-item.js.map +1 -0
  26. package/src/lib/actions/update-item-name.d.ts +6 -0
  27. package/src/lib/actions/update-item-name.js +34 -0
  28. package/src/lib/actions/update-item-name.js.map +1 -0
  29. package/src/lib/common/client.d.ts +99 -0
  30. package/src/lib/common/client.js +101 -0
  31. package/src/lib/common/client.js.map +1 -0
  32. package/src/lib/common/constants.d.ts +73 -0
  33. package/src/lib/common/constants.js +133 -0
  34. package/src/lib/common/constants.js.map +1 -0
  35. package/src/lib/common/helper.d.ts +10 -0
  36. package/src/lib/common/helper.js +369 -0
  37. package/src/lib/common/helper.js.map +1 -0
  38. package/src/lib/common/index.d.ts +10 -0
  39. package/src/lib/common/index.js +206 -0
  40. package/src/lib/common/index.js.map +1 -0
  41. package/src/lib/common/{types.d.ts → models.d.ts} +43 -25
  42. package/src/lib/common/models.js +3 -0
  43. package/src/lib/common/models.js.map +1 -0
  44. package/src/lib/common/mutations.d.ts +9 -0
  45. package/src/lib/common/mutations.js +85 -0
  46. package/src/lib/common/mutations.js.map +1 -0
  47. package/src/lib/common/queries.d.ts +10 -0
  48. package/src/lib/common/queries.js +162 -0
  49. package/src/lib/common/queries.js.map +1 -0
  50. package/src/lib/triggers/{item-created-trigger.d.ts → new-item-in-board.d.ts} +1 -1
  51. package/src/lib/triggers/new-item-in-board.js +96 -0
  52. package/src/lib/triggers/new-item-in-board.js.map +1 -0
  53. package/src/lib/triggers/specific-column-updated.d.ts +6 -0
  54. package/src/lib/triggers/specific-column-updated.js +118 -0
  55. package/src/lib/triggers/specific-column-updated.js.map +1 -0
  56. package/src/lib/actions/get-column-value-by-item.js +0 -52
  57. package/src/lib/actions/get-column-value-by-item.js.map +0 -1
  58. package/src/lib/actions/get-item-by-column-value.d.ts +0 -6
  59. package/src/lib/actions/get-item-by-column-value.js +0 -54
  60. package/src/lib/actions/get-item-by-column-value.js.map +0 -1
  61. package/src/lib/actions/update-item.js +0 -47
  62. package/src/lib/actions/update-item.js.map +0 -1
  63. package/src/lib/common/data.d.ts +0 -23
  64. package/src/lib/common/data.js +0 -117
  65. package/src/lib/common/data.js.map +0 -1
  66. package/src/lib/common/props.d.ts +0 -6
  67. package/src/lib/common/props.js +0 -95
  68. package/src/lib/common/props.js.map +0 -1
  69. package/src/lib/common/types.js +0 -9
  70. package/src/lib/common/types.js.map +0 -1
  71. package/src/lib/triggers/item-created-trigger.js +0 -45
  72. package/src/lib/triggers/item-created-trigger.js.map +0 -1
  73. package/src/lib/triggers/new-update-trigger.d.ts +0 -2
  74. package/src/lib/triggers/new-update-trigger.js +0 -41
  75. package/src/lib/triggers/new-update-trigger.js.map +0 -1
  76. package/src/lib/triggers/polling.d.ts +0 -7
  77. package/src/lib/triggers/polling.js +0 -34
  78. package/src/lib/triggers/polling.js.map +0 -1
@@ -1,9 +1,18 @@
1
- export type BoardResponse = {
2
- data: {
3
- boards: Board[];
4
- };
5
- account_id: number;
6
- };
1
+ import { BoardType, MondayColumnType } from './constants';
2
+ export interface MondayColumn {
3
+ id: string;
4
+ title: string;
5
+ type: MondayColumnType;
6
+ description?: string;
7
+ settings_str: string;
8
+ }
9
+ export interface ColumnValue {
10
+ id: string;
11
+ value: string;
12
+ text: string;
13
+ type: MondayColumnType;
14
+ [key: string]: any;
15
+ }
7
16
  export type WorkspaceResponse = {
8
17
  data: {
9
18
  workspaces: Workspace[];
@@ -14,17 +23,19 @@ export interface Workspace {
14
23
  id: string;
15
24
  name: string;
16
25
  }
17
- export interface Board {
18
- id: string;
19
- name: string;
20
- groups: Group[];
21
- type: BoardType;
22
- items: Item[];
23
- }
24
26
  export interface Group {
25
27
  id: string;
26
28
  title: string;
27
29
  }
30
+ export interface SubItem {
31
+ id: string;
32
+ board: Board;
33
+ group: Group;
34
+ subscribers: User[];
35
+ name: string;
36
+ email: string;
37
+ created_at: string;
38
+ }
28
39
  export interface Item {
29
40
  id: string;
30
41
  board: Board;
@@ -32,8 +43,18 @@ export interface Item {
32
43
  name: string;
33
44
  email: string;
34
45
  created_at: string;
46
+ column_values: ColumnValue[];
35
47
  subitems: SubItem[];
36
48
  }
49
+ export interface Board {
50
+ id: string;
51
+ name: string;
52
+ groups: Group[];
53
+ type: BoardType;
54
+ items_page: {
55
+ items: Item[];
56
+ };
57
+ }
37
58
  export interface Update {
38
59
  body: string;
39
60
  id: string;
@@ -43,22 +64,19 @@ export interface Update {
43
64
  id: string;
44
65
  };
45
66
  }
46
- export interface SubItem {
47
- id: string;
48
- board: Board;
49
- group: Group;
50
- subscribers: User[];
51
- name: string;
52
- email: string;
53
- created_at: string;
54
- }
55
67
  export interface User {
56
68
  id: string;
57
69
  name: string;
58
70
  email: string;
59
71
  created_at: string;
60
72
  }
61
- export declare enum BoardType {
62
- BOARD = "board",
63
- SUB_ITEMS_BOARD = "sub_items_board"
73
+ export type BoardResponse = {
74
+ data: {
75
+ boards: Board[];
76
+ };
77
+ account_id: number;
78
+ };
79
+ export interface WebhookInformation {
80
+ id: string;
81
+ board_id: string;
64
82
  }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/monday/src/lib/common/models.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ export declare const mondayGraphQLMutations: {
2
+ createItem: string;
3
+ updateItem: string;
4
+ createWebhook: string;
5
+ deleteWebhook: string;
6
+ createColumn: string;
7
+ createGroup: string;
8
+ createUpdate: string;
9
+ };
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mondayGraphQLMutations = void 0;
4
+ exports.mondayGraphQLMutations = {
5
+ createItem: `
6
+ mutation createItem(
7
+ $itemName: String!
8
+ $boardId: ID!
9
+ $groupId: String
10
+ $columnValues: JSON
11
+ $createLabels: Boolean
12
+ ) {
13
+ create_item(
14
+ item_name: $itemName
15
+ board_id: $boardId
16
+ group_id: $groupId
17
+ column_values: $columnValues
18
+ create_labels_if_missing: $createLabels
19
+ ) {
20
+ id
21
+ }
22
+ }`,
23
+ updateItem: `
24
+ mutation updateItem($itemId: ID!, $boardId: ID!, $columnValues: JSON!) {
25
+ change_multiple_column_values(
26
+ item_id: $itemId
27
+ board_id: $boardId
28
+ column_values: $columnValues
29
+ ) {
30
+ id
31
+ name
32
+ }
33
+ }`,
34
+ createWebhook: `
35
+ mutation createWebhook(
36
+ $boardId: ID!
37
+ $url: String!
38
+ $event: WebhookEventType!
39
+ $config: JSON
40
+ ) {
41
+ create_webhook(
42
+ board_id: $boardId
43
+ url: $url
44
+ event: $event
45
+ config: $config
46
+ ) {
47
+ id
48
+ board_id
49
+ }
50
+ }`,
51
+ deleteWebhook: `
52
+ mutation deleteWebhook($webhookId: ID!) {
53
+ delete_webhook(id: $webhookId) {
54
+ id
55
+ board_id
56
+ }
57
+ }`,
58
+ createColumn: `
59
+ mutation createColumn(
60
+ $boardId: ID!
61
+ $columnTitle: String!
62
+ $columnType: ColumnType!
63
+ ) {
64
+ create_column(
65
+ board_id: $boardId
66
+ title: $columnTitle
67
+ column_type: $columnType
68
+ ) {
69
+ id
70
+ }
71
+ }`,
72
+ createGroup: `
73
+ mutation createGroup($boardId: ID!, $groupName: String!) {
74
+ create_group(board_id: $boardId, group_name: $groupName) {
75
+ id
76
+ }
77
+ }`,
78
+ createUpdate: `
79
+ mutation createUpdate($itemId: ID!, $body: String!) {
80
+ create_update(item_id: $itemId, body: $body) {
81
+ id
82
+ }
83
+ }`,
84
+ };
85
+ //# sourceMappingURL=mutations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/monday/src/lib/common/mutations.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG;IACpC,UAAU,EAAE;;;;;;;;;;;;;;;;;IAiBV;IACF,UAAU,EAAE;;;;;;;;;;IAUV;IACF,aAAa,EAAE;;;;;;;;;;;;;;;;IAgBb;IACF,aAAa,EAAE;;;;;;IAMb;IACF,YAAY,EAAE;;;;;;;;;;;;;IAaZ;IACF,WAAW,EAAE;;;;;IAKX;IACF,YAAY,EAAE;;;;;IAKZ;CACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare const mondayGraphQLQueries: {
2
+ listWorkspaces: string;
3
+ listWorkspaceBoards: string;
4
+ listBoardGroups: string;
5
+ listBoardColumns: string;
6
+ listBoardItems: string;
7
+ listUsers: string;
8
+ getItemColumnValues: string;
9
+ getBoardItemValues: string;
10
+ };
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mondayGraphQLQueries = void 0;
4
+ exports.mondayGraphQLQueries = {
5
+ listWorkspaces: `
6
+ query listWorkspaces($limit: Int)
7
+ {
8
+ workspaces(limit: $limit)
9
+ {
10
+ id
11
+ name
12
+ }
13
+ }`,
14
+ listWorkspaceBoards: `
15
+ query listWorkspaceBoards($workspaceId: ID)
16
+ {
17
+ boards(workspace_ids: [$workspaceId], order_by: created_at)
18
+ {
19
+ id
20
+ name
21
+ type
22
+ }
23
+ }`,
24
+ listBoardGroups: `
25
+ query listGroups($boardId: ID!)
26
+ {
27
+ boards(ids: [$boardId])
28
+ {
29
+ groups{
30
+ id
31
+ title
32
+ }
33
+ }
34
+ }`,
35
+ listBoardColumns: `
36
+ query listBoardColumns($boardId: ID!)
37
+ {
38
+ boards(ids: [$boardId])
39
+ {
40
+ columns{
41
+ id
42
+ title
43
+ type
44
+ settings_str
45
+ description
46
+ }
47
+ }
48
+ }`,
49
+ listBoardItems: `
50
+ query listBoardItems($boardId: ID!)
51
+ {
52
+ boards(ids: [$boardId])
53
+ {
54
+ items_page
55
+ {
56
+ items{
57
+ id
58
+ name
59
+ }
60
+ }
61
+ }
62
+ }`,
63
+ listUsers: `
64
+ query listUsers
65
+ {
66
+ users(newest_first: true)
67
+ {
68
+ id
69
+ name
70
+ email
71
+ }
72
+ }`,
73
+ getItemColumnValues: `
74
+ query getItemColumnValues($boardId: ID!,$itemId: ID!,$columnIds: [String!])
75
+ {
76
+ boards(ids: [$boardId])
77
+ {
78
+ items_page(query_params: {ids: [$itemId]})
79
+ {
80
+ items{
81
+ id
82
+ name
83
+ column_values(ids: $columnIds){
84
+ id
85
+ type
86
+ value
87
+ text
88
+ ... on ButtonValue{
89
+ label
90
+ }
91
+ ... on StatusValue{
92
+ label
93
+ }
94
+ ... on VoteValue{
95
+ vote_count
96
+ }
97
+ ... on TagsValue{
98
+ tags{
99
+ name
100
+ }
101
+ }
102
+ ... on BoardRelationValue {
103
+ linked_item_ids
104
+ }
105
+ ... on DependencyValue {
106
+ linked_item_ids
107
+ }
108
+ ... on WeekValue {
109
+ start_date
110
+ end_date
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
116
+ }`,
117
+ getBoardItemValues: `
118
+ query getItemColumnValues($boardId: ID!,$columnIds: [String!])
119
+ {
120
+ boards(ids: [$boardId])
121
+ {
122
+ items_page(query_params: {order_by: {column_id: "__last_updated__",direction: desc}})
123
+ {
124
+ items{
125
+ id
126
+ name
127
+ column_values(ids: $columnIds){
128
+ id
129
+ type
130
+ value
131
+ text
132
+ ... on ButtonValue{
133
+ label
134
+ }
135
+ ... on StatusValue{
136
+ label
137
+ }
138
+ ... on VoteValue{
139
+ vote_count
140
+ }
141
+ ... on TagsValue{
142
+ tags{
143
+ name
144
+ }
145
+ }
146
+ ... on BoardRelationValue {
147
+ linked_item_ids
148
+ }
149
+ ... on DependencyValue {
150
+ linked_item_ids
151
+ }
152
+ ... on WeekValue {
153
+ start_date
154
+ end_date
155
+ }
156
+ }
157
+ }
158
+ }
159
+ }
160
+ }`,
161
+ };
162
+ //# sourceMappingURL=queries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/monday/src/lib/common/queries.ts"],"names":[],"mappings":";;;AAAa,QAAA,oBAAoB,GAAG;IAClC,cAAc,EAAE;;;;;;;;MAQZ;IACJ,mBAAmB,EAAE;;;;;;;;;MASjB;IACJ,eAAe,EAAE;;;;;;;;;;MAUb;IACJ,gBAAgB,EAAE;;;;;;;;;;;;;MAad;IACJ,cAAc,EAAE;;;;;;;;;;;;;MAaZ;IACJ,SAAS,EAAE;;;;;;;;;MASP;IACJ,mBAAmB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2CnB;IACF,kBAAkB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2ClB;CACH,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const mondayItemCreatedTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").OAuth2Property<true, import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ export declare const newItemInBoardTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
3
  workspace_id: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
4
4
  board_id: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
5
5
  }>;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newItemInBoardTrigger = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const __1 = require("../..");
7
+ const common_1 = require("../common");
8
+ const helper_1 = require("../common/helper");
9
+ exports.newItemInBoardTrigger = (0, pieces_framework_1.createTrigger)({
10
+ auth: __1.mondayAuth,
11
+ name: 'monday_new_item_in_board',
12
+ displayName: 'New Item in Board',
13
+ description: 'Triggers when a new item is created in board.',
14
+ props: {
15
+ workspace_id: common_1.mondayCommon.workspace_id(true),
16
+ board_id: common_1.mondayCommon.board_id(true),
17
+ },
18
+ type: pieces_framework_1.TriggerStrategy.WEBHOOK,
19
+ sampleData: {
20
+ event: {
21
+ userId: 9603417,
22
+ originalTriggerUuid: null,
23
+ boardId: 1771812698,
24
+ pulseId: 1772099344,
25
+ pulseName: 'Create_item webhook',
26
+ groupId: 'topics',
27
+ groupName: 'Group Title',
28
+ groupColor: '#579bfc',
29
+ isTopGroup: true,
30
+ columnValues: {},
31
+ app: 'monday',
32
+ type: 'create_pulse',
33
+ triggerTime: '2021-10-11T09:07:28.210Z',
34
+ subscriptionId: 73759690,
35
+ triggerUuid: 'b5ed2e17c530f43668de130142445cba',
36
+ },
37
+ },
38
+ onEnable(context) {
39
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
40
+ const { board_id } = context.propsValue;
41
+ const client = (0, common_1.makeClient)(context.auth);
42
+ const res = yield client.createWebhook({
43
+ boardId: board_id,
44
+ url: context.webhookUrl,
45
+ event: "create_item" /* MondayWebhookEventType.CREATE_ITEM */,
46
+ });
47
+ yield context.store.put('monday_new_item_trigger', res.data);
48
+ });
49
+ },
50
+ onDisable(context) {
51
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
52
+ const webhook = yield context.store.get('monday_new_item_trigger');
53
+ if (webhook != null) {
54
+ const client = (0, common_1.makeClient)(context.auth);
55
+ yield client.deleteWebhook({ webhookId: webhook.id });
56
+ }
57
+ });
58
+ },
59
+ run(context) {
60
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
61
+ const payload = context.payload.body;
62
+ const transformedValues = {};
63
+ try {
64
+ const client = (0, common_1.makeClient)(context.auth);
65
+ const res = yield client.getItemColumnValues({
66
+ boardId: payload.event.boardId,
67
+ itemId: payload.event.pulseId,
68
+ });
69
+ const item = res.data.boards[0].items_page.items[0];
70
+ for (const column of item.column_values) {
71
+ transformedValues[column.id] = (0, helper_1.parseMondayColumnValue)(column);
72
+ }
73
+ }
74
+ catch (e) {
75
+ console.error(e);
76
+ }
77
+ const enriched = [
78
+ Object.assign(Object.assign({}, payload), { columnValues: transformedValues }),
79
+ ];
80
+ return enriched;
81
+ });
82
+ },
83
+ handshakeConfiguration: {
84
+ strategy: pieces_framework_1.WebhookHandshakeStrategy.BODY_PARAM_PRESENT,
85
+ paramName: 'challenge',
86
+ },
87
+ onHandshake(context) {
88
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
89
+ return {
90
+ status: 200,
91
+ body: { challenge: context.payload.body['challenge'] },
92
+ };
93
+ });
94
+ },
95
+ });
96
+ //# sourceMappingURL=new-item-in-board.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-item-in-board.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/monday/src/lib/triggers/new-item-in-board.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,6BAAmC;AACnC,sCAAqD;AAErD,6CAA0D;AAG7C,QAAA,qBAAqB,GAAG,IAAA,gCAAa,EAAC;IACjD,IAAI,EAAE,cAAU;IAChB,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,+CAA+C;IAC5D,KAAK,EAAE;QACL,YAAY,EAAE,qBAAY,CAAC,YAAY,CAAC,IAAI,CAAC;QAC7C,QAAQ,EAAE,qBAAY,CAAC,QAAQ,CAAC,IAAI,CAAC;KACtC;IACD,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,UAAU,EAAE;QACV,KAAK,EAAE;YACL,MAAM,EAAE,OAAO;YACf,mBAAmB,EAAE,IAAI;YACzB,OAAO,EAAE,UAAU;YACnB,OAAO,EAAE,UAAU;YACnB,SAAS,EAAE,qBAAqB;YAChC,OAAO,EAAE,QAAQ;YACjB,SAAS,EAAE,aAAa;YACxB,UAAU,EAAE,SAAS;YACrB,UAAU,EAAE,IAAI;YAChB,YAAY,EAAE,EAAE;YAChB,GAAG,EAAE,QAAQ;YACb,IAAI,EAAE,cAAc;YACpB,WAAW,EAAE,0BAA0B;YACvC,cAAc,EAAE,QAAQ;YACxB,WAAW,EAAE,kCAAkC;SAChD;KACF;IACK,QAAQ,CAAC,OAAO;;YACpB,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAExC,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,OAAO,CAAC,IAAc,CAAC,CAAC;YAClD,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;gBACrC,OAAO,EAAE,QAAQ;gBACjB,GAAG,EAAE,OAA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C,CAAC;aAClB;YAED,MAAM,QAAQ,GAAG;gDAEV,OAAO,KACV,YAAY,EAAE,iBAAiB;aAElC,CAAC;YACF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;IACD,sBAAsB,EAAE;QACtB,QAAQ,EAAE,2CAAwB,CAAC,kBAAkB;QACrD,SAAS,EAAE,WAAW;KACvB;IACK,WAAW,CAAC,OAAO;;YACvB,OAAO;gBACL,MAAM,EAAE,GAAG;gBACX,IAAI,EAAE,EAAE,SAAS,EAAG,OAAO,CAAC,OAAO,CAAC,IAAY,CAAC,WAAW,CAAC,EAAE;aAChE,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { TriggerStrategy } from '@activepieces/pieces-framework';
2
+ export declare const specificColumnValueUpdatedTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
+ workspace_id: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
4
+ board_id: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
5
+ column_id: import("@activepieces/pieces-framework").DropdownProperty<string, true>;
6
+ }>;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.specificColumnValueUpdatedTrigger = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const __1 = require("../..");
7
+ const common_1 = require("../common");
8
+ const constants_1 = require("../common/constants");
9
+ exports.specificColumnValueUpdatedTrigger = (0, pieces_framework_1.createTrigger)({
10
+ auth: __1.mondayAuth,
11
+ name: 'monday_specific_column_updated',
12
+ displayName: 'Specific Column Value Updated in Board',
13
+ description: 'Triggers when a specific column value is updated in board.',
14
+ props: {
15
+ workspace_id: common_1.mondayCommon.workspace_id(true),
16
+ board_id: common_1.mondayCommon.board_id(true),
17
+ column_id: pieces_framework_1.Property.Dropdown({
18
+ displayName: 'Column ID',
19
+ required: true,
20
+ refreshers: ['board_id'],
21
+ options: ({ auth, board_id }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
22
+ if (!auth || !board_id) {
23
+ return {
24
+ disabled: true,
25
+ placeholder: 'connect your account first and select workspace board.',
26
+ options: [],
27
+ };
28
+ }
29
+ const client = (0, common_1.makeClient)(auth);
30
+ const res = yield client.listBoardColumns({
31
+ boardId: board_id,
32
+ });
33
+ return {
34
+ disabled: false,
35
+ options: res.data.boards[0].columns
36
+ .filter((column) => !constants_1.MondayNotWritableColumnType.includes(column.type))
37
+ .map((column) => {
38
+ return {
39
+ label: column.title,
40
+ value: column.id,
41
+ };
42
+ }),
43
+ };
44
+ }),
45
+ }),
46
+ },
47
+ type: pieces_framework_1.TriggerStrategy.WEBHOOK,
48
+ sampleData: {
49
+ event: {
50
+ app: 'monday',
51
+ type: 'update_column_value',
52
+ triggerTime: '2024-01-08T04:41:55.245Z',
53
+ subscriptionId: 3209024,
54
+ userId: 53812737,
55
+ originalTriggerUuid: null,
56
+ boardId: 1835745535,
57
+ groupId: 'topics',
58
+ pulseId: 1835700420,
59
+ pulseName: 'Sample Item',
60
+ columnId: 'country',
61
+ columnType: 'country',
62
+ columnTitle: 'Country',
63
+ value: {
64
+ countryCode: 'AW',
65
+ countryName: 'Aruba',
66
+ changed_at: '2024-01-08T04:42:00.109Z',
67
+ },
68
+ previousValue: {
69
+ changed_at: '2024-01-08T04:41:39.461Z',
70
+ countryCode: 'IO',
71
+ countryName: 'British Indian Ocean Territory',
72
+ },
73
+ changedAt: 1704688953.239433,
74
+ isTopGroup: true,
75
+ triggerUuid: '72a1ec82ea678e03b55b050711b71e9d',
76
+ },
77
+ },
78
+ onEnable(context) {
79
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
80
+ const { board_id, column_id } = context.propsValue;
81
+ const client = (0, common_1.makeClient)(context.auth);
82
+ const res = yield client.createWebhook({
83
+ boardId: board_id,
84
+ url: context.webhookUrl,
85
+ event: "change_specific_column_value" /* MondayWebhookEventType.CHANGE_SPECIFIC_COLUMN_VALUE */,
86
+ config: JSON.stringify({ columnId: column_id }),
87
+ });
88
+ yield context.store.put('monday_specific_column_updated', res.data);
89
+ });
90
+ },
91
+ onDisable(context) {
92
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
93
+ const webhook = yield context.store.get('monday_specific_column_updated');
94
+ if (webhook != null) {
95
+ const client = (0, common_1.makeClient)(context.auth);
96
+ yield client.deleteWebhook({ webhookId: webhook.id });
97
+ }
98
+ });
99
+ },
100
+ run(context) {
101
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
102
+ return [context.payload.body];
103
+ });
104
+ },
105
+ handshakeConfiguration: {
106
+ strategy: pieces_framework_1.WebhookHandshakeStrategy.BODY_PARAM_PRESENT,
107
+ paramName: 'challenge',
108
+ },
109
+ onHandshake(context) {
110
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
111
+ return {
112
+ status: 200,
113
+ body: { challenge: context.payload.body['challenge'] },
114
+ };
115
+ });
116
+ },
117
+ });
118
+ //# sourceMappingURL=specific-column-updated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"specific-column-updated.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/monday/src/lib/triggers/specific-column-updated.ts"],"names":[],"mappings":";;;;AAAA,qEAKwC;AACxC,6BAAmC;AACnC,sCAAqD;AACrD,mDAG6B;AAGhB,QAAA,iCAAiC,GAAG,IAAA,gCAAa,EAAC;IAC7D,IAAI,EAAE,cAAU;IAChB,IAAI,EAAE,gCAAgC;IACtC,WAAW,EAAE,wCAAwC;IACrD,WAAW,EAAE,4DAA4D;IACzE,KAAK,EAAE;QACL,YAAY,EAAE,qBAAY,CAAC,YAAY,CAAC,IAAI,CAAC;QAC7C,QAAQ,EAAE,qBAAY,CAAC,QAAQ,CAAC,IAAI,CAAC;QACrC,SAA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,CAAC;aACvD;QACH,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;IACD,sBAAsB,EAAE;QACtB,QAAQ,EAAE,2CAAwB,CAAC,kBAAkB;QACrD,SAAS,EAAE,WAAW;KACvB;IACK,WAAW,CAAC,OAAO;;YACvB,OAAO;gBACL,MAAM,EAAE,GAAG;gBACX,IAAI,EAAE,EAAE,SAAS,EAAG,OAAO,CAAC,OAAO,CAAC,IAAY,CAAC,WAAW,CAAC,EAAE;aAChE,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mondayGetItemColumnValues = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_common_1 = require("@activepieces/pieces-common");
6
- const pieces_framework_1 = require("@activepieces/pieces-framework");
7
- const props_1 = require("../common/props");
8
- const data_1 = require("../common/data");
9
- const __1 = require("../..");
10
- exports.mondayGetItemColumnValues = (0, pieces_framework_1.createAction)({
11
- auth: __1.mondayAuth,
12
- name: 'monday_get_item-col-val',
13
- displayName: 'Get Column Values',
14
- description: 'Get Column values by providing item id.',
15
- props: {
16
- workspace_id: props_1.mondayProps.workspace_id(true),
17
- board_id: props_1.mondayProps.board_id(true),
18
- item_id: pieces_framework_1.Property.ShortText({
19
- displayName: 'Item Id',
20
- description: "Value of an item's id",
21
- required: true,
22
- }),
23
- },
24
- run(context) {
25
- var _a, _b, _c;
26
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
27
- const itemValues = tslib_1.__rest(context.propsValue, []);
28
- const query = `
29
- query {
30
- items (
31
- ids: ${[itemValues.item_id]},
32
- )
33
- {
34
- id
35
- name
36
- column_values {
37
- id
38
- value
39
- text
40
- }
41
- }
42
- }
43
- `;
44
- const result = yield (0, data_1.mondayMakeRequest)(context.auth.access_token, query, pieces_common_1.HttpMethod.GET);
45
- if (result.status === 200) {
46
- return (_c = (_b = (_a = result.body) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.items) === null || _c === void 0 ? void 0 : _c[0];
47
- }
48
- return result;
49
- });
50
- }
51
- });
52
- //# sourceMappingURL=get-column-value-by-item.js.map