@worktables/n8n-nodes-worktables-staging 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +19 -0
- package/README.md +46 -0
- package/dist/credentials/WorktablesAPI.credentials.d.ts +7 -0
- package/dist/credentials/WorktablesAPI.credentials.js +25 -0
- package/dist/credentials/WorktablesAPI.credentials.js.map +1 -0
- package/dist/nodes/Worktables/MondayWebhook.node.d.ts +5 -0
- package/dist/nodes/Worktables/MondayWebhook.node.js +341 -0
- package/dist/nodes/Worktables/MondayWebhook.node.js.map +1 -0
- package/dist/nodes/Worktables/MondayWebhook.node.json +27 -0
- package/dist/nodes/Worktables/Worktables.node.d.ts +34 -0
- package/dist/nodes/Worktables/Worktables.node.js +6658 -0
- package/dist/nodes/Worktables/Worktables.node.js.map +1 -0
- package/dist/nodes/Worktables/Worktables.node.json +18 -0
- package/dist/nodes/Worktables/worktables_icon.svg +1 -0
- package/dist/package.json +56 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/country_codes.json +970 -0
- package/dist/utils/isErrorResponse.d.ts +4 -0
- package/dist/utils/isErrorResponse.js +18 -0
- package/dist/utils/isErrorResponse.js.map +1 -0
- package/dist/utils/parseValue.d.ts +1 -0
- package/dist/utils/parseValue.js +15 -0
- package/dist/utils/parseValue.js.map +1 -0
- package/dist/utils/worktablesHelpers.d.ts +43 -0
- package/dist/utils/worktablesHelpers.js +304 -0
- package/dist/utils/worktablesHelpers.js.map +1 -0
- package/index.js +0 -0
- package/package.json +56 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright 2022 n8n
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
8
|
+
so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# n8n-nodes-starter
|
|
4
|
+
|
|
5
|
+
This repo contains example nodes to help you get started building your own custom integrations for [n8n](n8n.io). It includes the node linter and other dependencies.
|
|
6
|
+
|
|
7
|
+
To make your custom node available to the community, you must create it as an npm package, and [submit it to the npm registry](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry).
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
You need the following installed on your development machine:
|
|
12
|
+
|
|
13
|
+
* [git](https://git-scm.com/downloads)
|
|
14
|
+
* Node.js and pnpm. Minimum version Node 18. You can find instructions on how to install both using nvm (Node Version Manager) for Linux, Mac, and WSL [here](https://github.com/nvm-sh/nvm). For Windows users, refer to Microsoft's guide to [Install NodeJS on Windows](https://docs.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-windows).
|
|
15
|
+
* Install n8n with:
|
|
16
|
+
```
|
|
17
|
+
pnpm install n8n -g
|
|
18
|
+
```
|
|
19
|
+
* Recommended: follow n8n's guide to [set up your development environment](https://docs.n8n.io/integrations/creating-nodes/build/node-development-environment/).
|
|
20
|
+
|
|
21
|
+
## Using this starter
|
|
22
|
+
|
|
23
|
+
These are the basic steps for working with the starter. For detailed guidance on creating and publishing nodes, refer to the [documentation](https://docs.n8n.io/integrations/creating-nodes/).
|
|
24
|
+
|
|
25
|
+
1. [Generate a new repository](https://github.com/n8n-io/n8n-nodes-starter/generate) from this template repository.
|
|
26
|
+
2. Clone your new repo:
|
|
27
|
+
```
|
|
28
|
+
git clone https://github.com/<your organization>/<your-repo-name>.git
|
|
29
|
+
```
|
|
30
|
+
3. Run `pnpm i` to install dependencies.
|
|
31
|
+
4. Open the project in your editor.
|
|
32
|
+
5. Browse the examples in `/nodes` and `/credentials`. Modify the examples, or replace them with your own nodes.
|
|
33
|
+
6. Update the `package.json` to match your details.
|
|
34
|
+
7. Run `pnpm lint` to check for errors or `pnpm lintfix` to automatically fix errors when possible.
|
|
35
|
+
8. Test your node locally. Refer to [Run your node locally](https://docs.n8n.io/integrations/creating-nodes/test/run-node-locally/) for guidance.
|
|
36
|
+
9. Replace this README with documentation for your node. Use the [README_TEMPLATE](README_TEMPLATE.md) to get started.
|
|
37
|
+
10. Update the LICENSE file to use your details.
|
|
38
|
+
11. [Publish](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry) your package to npm.
|
|
39
|
+
|
|
40
|
+
## More information
|
|
41
|
+
|
|
42
|
+
Refer to our [documentation on creating nodes](https://docs.n8n.io/integrations/creating-nodes/) for detailed information on building your own nodes.
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
[MIT](https://github.com/n8n-io/n8n-nodes-starter/blob/master/LICENSE.md)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorktablesAPI = void 0;
|
|
4
|
+
class WorktablesAPI {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'WorktablesApi';
|
|
7
|
+
this.displayName = 'monday.com API';
|
|
8
|
+
this.documentationUrl = 'https://docs.your-api.com';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'API Key',
|
|
12
|
+
name: 'apiKey',
|
|
13
|
+
type: 'string',
|
|
14
|
+
default: '',
|
|
15
|
+
required: true,
|
|
16
|
+
description: 'The API key to access Worktables',
|
|
17
|
+
typeOptions: {
|
|
18
|
+
password: true,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.WorktablesAPI = WorktablesAPI;
|
|
25
|
+
//# sourceMappingURL=WorktablesAPI.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorktablesAPI.credentials.js","sourceRoot":"","sources":["../../credentials/WorktablesAPI.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,aAAa;IAA1B;QACC,SAAI,GAAG,eAAe,CAAC;QACvB,gBAAW,GAAG,gBAAgB,CAAC;QAC/B,qBAAgB,GAAG,2BAA2B,CAAC;QAE/C,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EAAE,kCAAkC;gBAC/C,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;aACD;SACD,CAAC;IACH,CAAC;CAAA;AAlBD,sCAkBC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IWebhookFunctions, IWebhookResponseData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class MondayWebhook implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MondayWebhook = void 0;
|
|
4
|
+
const worktablesHelpers_1 = require("../../utils/worktablesHelpers");
|
|
5
|
+
class MondayWebhook {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: 'Worktables Webhook',
|
|
9
|
+
name: 'mondayWebhook',
|
|
10
|
+
icon: 'file:worktables_icon.svg',
|
|
11
|
+
group: ['trigger'],
|
|
12
|
+
version: 1,
|
|
13
|
+
description: 'Triggers workflows when an event occurs in Monday.com',
|
|
14
|
+
defaults: {
|
|
15
|
+
name: 'Monday Webhook',
|
|
16
|
+
},
|
|
17
|
+
inputs: ["main"],
|
|
18
|
+
outputs: ["main"],
|
|
19
|
+
credentials: [
|
|
20
|
+
{
|
|
21
|
+
name: 'WorktablesApi',
|
|
22
|
+
required: false,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
webhooks: [
|
|
26
|
+
{
|
|
27
|
+
name: 'default',
|
|
28
|
+
httpMethod: 'POST',
|
|
29
|
+
responseMode: 'onReceived',
|
|
30
|
+
path: '/webhook',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
properties: [
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Get Item After Event',
|
|
36
|
+
name: 'getItemAfterEvent',
|
|
37
|
+
type: 'boolean',
|
|
38
|
+
default: false,
|
|
39
|
+
description: 'Fetch the related item from Monday after receiving the event',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
displayName: 'Is Subitem',
|
|
43
|
+
name: 'isSubitem',
|
|
44
|
+
type: 'boolean',
|
|
45
|
+
default: false,
|
|
46
|
+
description: 'Treat the received item as a subitem when fetching data',
|
|
47
|
+
displayOptions: {
|
|
48
|
+
show: {
|
|
49
|
+
getItemAfterEvent: [true],
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
displayName: 'Fetch Subitems',
|
|
55
|
+
name: 'fetchSubitems',
|
|
56
|
+
type: 'boolean',
|
|
57
|
+
default: false,
|
|
58
|
+
description: 'Include subitems of the item in the response',
|
|
59
|
+
displayOptions: {
|
|
60
|
+
show: {
|
|
61
|
+
getItemAfterEvent: [true],
|
|
62
|
+
isSubitem: [false],
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
displayName: 'Fetch Parent Item',
|
|
68
|
+
name: 'fetchParentItem',
|
|
69
|
+
type: 'boolean',
|
|
70
|
+
default: false,
|
|
71
|
+
description: 'Include parent item in the response when the item is a subitem',
|
|
72
|
+
displayOptions: {
|
|
73
|
+
show: {
|
|
74
|
+
getItemAfterEvent: [true],
|
|
75
|
+
isSubitem: [true],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
displayName: 'Fetch All Columns',
|
|
81
|
+
name: 'fetchAllColumns',
|
|
82
|
+
type: 'boolean',
|
|
83
|
+
default: true,
|
|
84
|
+
description: 'When true, returns all columns; otherwise, only specified Column IDs',
|
|
85
|
+
displayOptions: {
|
|
86
|
+
show: {
|
|
87
|
+
getItemAfterEvent: [true],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
displayName: 'Column IDs',
|
|
93
|
+
name: 'columnIds',
|
|
94
|
+
type: 'string',
|
|
95
|
+
default: '',
|
|
96
|
+
placeholder: 'status,owner,date',
|
|
97
|
+
description: 'Comma-separated column IDs to fetch. Leave empty to fetch all columns.',
|
|
98
|
+
displayOptions: {
|
|
99
|
+
show: {
|
|
100
|
+
getItemAfterEvent: [true],
|
|
101
|
+
fetchAllColumns: [false],
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
async webhook() {
|
|
109
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
110
|
+
const req = this.getRequestObject();
|
|
111
|
+
const res = this.getResponseObject();
|
|
112
|
+
const body = req.body;
|
|
113
|
+
console.log('Webhook received', body);
|
|
114
|
+
if (body.challenge) {
|
|
115
|
+
res.status(200).json({ challenge: body.challenge });
|
|
116
|
+
return {};
|
|
117
|
+
}
|
|
118
|
+
const getItemAfterEvent = this.getNodeParameter('getItemAfterEvent', 0);
|
|
119
|
+
if (!getItemAfterEvent) {
|
|
120
|
+
return {
|
|
121
|
+
workflowData: [this.helpers.returnJsonArray([body])],
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const isSubitem = this.getNodeParameter('isSubitem', 0);
|
|
125
|
+
const fetchSubitems = this.getNodeParameter('fetchSubitems', 0);
|
|
126
|
+
const fetchParentItem = this.getNodeParameter('fetchParentItem', 0);
|
|
127
|
+
const fetchAllColumns = this.getNodeParameter('fetchAllColumns', 0);
|
|
128
|
+
const columnIdsRaw = this.getNodeParameter('columnIds', 0);
|
|
129
|
+
const itemId = (_g = (_f = (_d = (_b = (_a = body === null || body === void 0 ? void 0 : body.event) === null || _a === void 0 ? void 0 : _a.pulseId) !== null && _b !== void 0 ? _b : (_c = body === null || body === void 0 ? void 0 : body.event) === null || _c === void 0 ? void 0 : _c.itemId) !== null && _d !== void 0 ? _d : (_e = body === null || body === void 0 ? void 0 : body.event) === null || _e === void 0 ? void 0 : _e.entityId) !== null && _f !== void 0 ? _f : body === null || body === void 0 ? void 0 : body.pulseId) !== null && _g !== void 0 ? _g : body === null || body === void 0 ? void 0 : body.itemId;
|
|
130
|
+
if (!itemId) {
|
|
131
|
+
return {
|
|
132
|
+
workflowData: [this.helpers.returnJsonArray([body])],
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
let queryColumnValues = '';
|
|
136
|
+
if (fetchAllColumns) {
|
|
137
|
+
queryColumnValues = `
|
|
138
|
+
column_values {
|
|
139
|
+
id
|
|
140
|
+
text
|
|
141
|
+
value
|
|
142
|
+
type
|
|
143
|
+
... on BoardRelationValue {
|
|
144
|
+
display_value
|
|
145
|
+
linked_item_ids
|
|
146
|
+
}
|
|
147
|
+
... on MirrorValue {
|
|
148
|
+
display_value
|
|
149
|
+
mirrored_items {
|
|
150
|
+
linked_board_id
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
`;
|
|
155
|
+
}
|
|
156
|
+
else if (columnIdsRaw && columnIdsRaw.trim()) {
|
|
157
|
+
const specificColumnIds = columnIdsRaw.split(',').map(id => id.trim()).filter(id => id);
|
|
158
|
+
if (specificColumnIds.length > 0) {
|
|
159
|
+
const columnIdsString = specificColumnIds.map(id => `"${id}"`).join(', ');
|
|
160
|
+
queryColumnValues = `
|
|
161
|
+
column_values(ids: [${columnIdsString}]) {
|
|
162
|
+
id
|
|
163
|
+
text
|
|
164
|
+
value
|
|
165
|
+
type
|
|
166
|
+
... on BoardRelationValue {
|
|
167
|
+
display_value
|
|
168
|
+
linked_item_ids
|
|
169
|
+
}
|
|
170
|
+
... on MirrorValue {
|
|
171
|
+
display_value
|
|
172
|
+
mirrored_items {
|
|
173
|
+
linked_board_id
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
`;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const querySubitems = `
|
|
181
|
+
subitems {
|
|
182
|
+
id
|
|
183
|
+
name
|
|
184
|
+
url
|
|
185
|
+
board {
|
|
186
|
+
id
|
|
187
|
+
}
|
|
188
|
+
created_at
|
|
189
|
+
updated_at
|
|
190
|
+
${queryColumnValues}
|
|
191
|
+
}
|
|
192
|
+
`;
|
|
193
|
+
const queryParentItem = `
|
|
194
|
+
parent_item {
|
|
195
|
+
id
|
|
196
|
+
name
|
|
197
|
+
url
|
|
198
|
+
board {
|
|
199
|
+
id
|
|
200
|
+
}
|
|
201
|
+
created_at
|
|
202
|
+
updated_at
|
|
203
|
+
${queryColumnValues}
|
|
204
|
+
}
|
|
205
|
+
`;
|
|
206
|
+
const query = `
|
|
207
|
+
{
|
|
208
|
+
items(ids: ["${itemId}"]) {
|
|
209
|
+
id
|
|
210
|
+
name
|
|
211
|
+
url
|
|
212
|
+
board {
|
|
213
|
+
id
|
|
214
|
+
}
|
|
215
|
+
group {
|
|
216
|
+
id
|
|
217
|
+
title
|
|
218
|
+
color
|
|
219
|
+
position
|
|
220
|
+
}
|
|
221
|
+
created_at
|
|
222
|
+
updated_at
|
|
223
|
+
${queryColumnValues}
|
|
224
|
+
${!isSubitem && fetchSubitems ? querySubitems : ''}
|
|
225
|
+
${isSubitem && fetchParentItem ? queryParentItem : ''}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
`;
|
|
229
|
+
let fetchedItem = undefined;
|
|
230
|
+
try {
|
|
231
|
+
const credentials = await this.getCredentials('WorktablesApi');
|
|
232
|
+
const apiKey = credentials === null || credentials === void 0 ? void 0 : credentials.apiKey;
|
|
233
|
+
const headers = {
|
|
234
|
+
'Content-Type': 'application/json',
|
|
235
|
+
};
|
|
236
|
+
if (apiKey) {
|
|
237
|
+
headers['Authorization'] = `Bearer ${apiKey}`;
|
|
238
|
+
}
|
|
239
|
+
const rawResponse = await this.helpers.request({
|
|
240
|
+
method: 'POST',
|
|
241
|
+
url: 'https://api.monday.com/v2',
|
|
242
|
+
headers,
|
|
243
|
+
body: { query },
|
|
244
|
+
});
|
|
245
|
+
const parsed = typeof rawResponse === 'string' ? JSON.parse(rawResponse) : rawResponse;
|
|
246
|
+
const items = (_h = parsed === null || parsed === void 0 ? void 0 : parsed.data) === null || _h === void 0 ? void 0 : _h.items;
|
|
247
|
+
const rawItem = (_j = items === null || items === void 0 ? void 0 : items[0]) !== null && _j !== void 0 ? _j : null;
|
|
248
|
+
if (rawItem) {
|
|
249
|
+
const columnValues = rawItem.column_values || [];
|
|
250
|
+
const formatted = {
|
|
251
|
+
id: rawItem.id,
|
|
252
|
+
name: rawItem.name,
|
|
253
|
+
url: rawItem.url,
|
|
254
|
+
created_at: rawItem.created_at,
|
|
255
|
+
updated_at: rawItem.updated_at,
|
|
256
|
+
board: rawItem.board ? {
|
|
257
|
+
id: rawItem.board.id,
|
|
258
|
+
} : undefined,
|
|
259
|
+
group: rawItem.group ? {
|
|
260
|
+
id: rawItem.group.id,
|
|
261
|
+
title: rawItem.group.title,
|
|
262
|
+
color: rawItem.group.color,
|
|
263
|
+
position: rawItem.group.position,
|
|
264
|
+
} : undefined,
|
|
265
|
+
column_values: {},
|
|
266
|
+
};
|
|
267
|
+
for (const col of columnValues) {
|
|
268
|
+
if (col.type === 'subtasks')
|
|
269
|
+
continue;
|
|
270
|
+
const formattedCol = await (0, worktablesHelpers_1.formatColumnValue)(col);
|
|
271
|
+
if (formattedCol) {
|
|
272
|
+
formatted.column_values[col.id] = formattedCol;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (rawItem.subitems && Array.isArray(rawItem.subitems)) {
|
|
276
|
+
formatted.subitems = await Promise.all(rawItem.subitems.map(async (subitem) => {
|
|
277
|
+
const subFormatted = {
|
|
278
|
+
id: subitem.id,
|
|
279
|
+
name: subitem.name,
|
|
280
|
+
url: subitem.url,
|
|
281
|
+
created_at: subitem.created_at,
|
|
282
|
+
updated_at: subitem.updated_at,
|
|
283
|
+
board: subitem.board ? {
|
|
284
|
+
id: subitem.board.id,
|
|
285
|
+
} : undefined,
|
|
286
|
+
column_values: {},
|
|
287
|
+
};
|
|
288
|
+
for (const col of subitem.column_values || []) {
|
|
289
|
+
const subCol = await (0, worktablesHelpers_1.formatColumnValue)(col);
|
|
290
|
+
if (subCol) {
|
|
291
|
+
subFormatted.column_values[col.id] = subCol;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return subFormatted;
|
|
295
|
+
}));
|
|
296
|
+
}
|
|
297
|
+
if (isSubitem && fetchParentItem && rawItem.parent_item && typeof rawItem.parent_item === 'object') {
|
|
298
|
+
const parentItem = rawItem.parent_item;
|
|
299
|
+
const parentFormatted = {
|
|
300
|
+
id: parentItem.id,
|
|
301
|
+
name: parentItem.name,
|
|
302
|
+
url: parentItem.url,
|
|
303
|
+
created_at: parentItem.created_at,
|
|
304
|
+
updated_at: parentItem.updated_at,
|
|
305
|
+
board: parentItem.board ? {
|
|
306
|
+
id: parentItem.board.id,
|
|
307
|
+
} : undefined,
|
|
308
|
+
column_values: {},
|
|
309
|
+
};
|
|
310
|
+
for (const col of parentItem.column_values || []) {
|
|
311
|
+
const subCol = await (0, worktablesHelpers_1.formatColumnValue)(col);
|
|
312
|
+
if (subCol) {
|
|
313
|
+
parentFormatted.column_values[col.id] = subCol;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
formatted.parent_item = parentFormatted;
|
|
317
|
+
}
|
|
318
|
+
fetchedItem = formatted;
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
fetchedItem = null;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
catch (error) {
|
|
325
|
+
console.error('Error fetching item:', error);
|
|
326
|
+
fetchedItem = null;
|
|
327
|
+
}
|
|
328
|
+
return {
|
|
329
|
+
workflowData: [
|
|
330
|
+
this.helpers.returnJsonArray([
|
|
331
|
+
{
|
|
332
|
+
...body,
|
|
333
|
+
item: fetchedItem,
|
|
334
|
+
},
|
|
335
|
+
]),
|
|
336
|
+
],
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
exports.MondayWebhook = MondayWebhook;
|
|
341
|
+
//# sourceMappingURL=MondayWebhook.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MondayWebhook.node.js","sourceRoot":"","sources":["../../../nodes/Worktables/MondayWebhook.node.ts"],"names":[],"mappings":";;;AAUA,qEAAkE;AAElE,MAAa,aAAa;IAA1B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,oBAA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0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "MondayWebhook",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"description": "Triggers workflows when an event occurs in Monday.com",
|
|
5
|
+
"type": "trigger",
|
|
6
|
+
"class": "MondayWebhook",
|
|
7
|
+
"defaults": {
|
|
8
|
+
"name": "Monday Webhook"
|
|
9
|
+
},
|
|
10
|
+
"inputs": [],
|
|
11
|
+
"outputs": [
|
|
12
|
+
{
|
|
13
|
+
"name": "main",
|
|
14
|
+
"type": "output"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"credentials": [],
|
|
18
|
+
"webhooks": [
|
|
19
|
+
{
|
|
20
|
+
"name": "default",
|
|
21
|
+
"httpMethod": "POST",
|
|
22
|
+
"responseMode": "onReceived",
|
|
23
|
+
"path": "monday-webhook"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"properties": []
|
|
27
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { INodeType, INodeTypeDescription, ILoadOptionsFunctions, INodePropertyOptions, IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
|
|
2
|
+
export declare class Worktables implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
methods: {
|
|
5
|
+
loadOptions: {
|
|
6
|
+
getWorkspaces(): Promise<{
|
|
7
|
+
name: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}[]>;
|
|
10
|
+
getBoards(): Promise<{
|
|
11
|
+
name: string;
|
|
12
|
+
value: string;
|
|
13
|
+
type: string;
|
|
14
|
+
}[]>;
|
|
15
|
+
getGroupsFromBoard(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
16
|
+
getItemsFromBoard(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
17
|
+
getItemsOrSubitemsFromBoard(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
18
|
+
getSubitemFromItem(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
19
|
+
getColumnsFromBoard(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
20
|
+
getSubscribersFromBoard(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
21
|
+
getSubitems(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
22
|
+
getColumnsItems(this: ILoadOptionsFunctions): Promise<any>;
|
|
23
|
+
getColumnsItemsForIdentifier(this: ILoadOptionsFunctions): Promise<any>;
|
|
24
|
+
getColumnsItemsForCreateOrUpdate(this: ILoadOptionsFunctions): Promise<any>;
|
|
25
|
+
getFolders(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
26
|
+
getUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
27
|
+
getTeams(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
28
|
+
getFileColumns(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
29
|
+
getUpdates(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
30
|
+
getAllLabelStatus(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][] | null>;
|
|
34
|
+
}
|