@steprotech/n8n-nodes-composio 0.0.0-stage → 0.2.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.
Files changed (31) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +124 -2
  3. package/dist/credentials/ComposioApi.credentials.d.ts +43 -0
  4. package/dist/credentials/ComposioApi.credentials.js +78 -0
  5. package/dist/credentials/ComposioApi.credentials.js.map +1 -0
  6. package/dist/credentials/composio.dark.svg +266 -0
  7. package/dist/credentials/composio.svg +266 -0
  8. package/dist/nodes/Composio/Composio.node.d.ts +12 -0
  9. package/dist/nodes/Composio/Composio.node.js +450 -0
  10. package/dist/nodes/Composio/Composio.node.js.map +1 -0
  11. package/dist/nodes/Composio/ComposioTrigger.node.d.ts +12 -0
  12. package/dist/nodes/Composio/ComposioTrigger.node.js +172 -0
  13. package/dist/nodes/Composio/ComposioTrigger.node.js.map +1 -0
  14. package/dist/nodes/Composio/GenericFunctions.d.ts +24 -0
  15. package/dist/nodes/Composio/GenericFunctions.js +163 -0
  16. package/dist/nodes/Composio/GenericFunctions.js.map +1 -0
  17. package/dist/nodes/Composio/catalog.d.ts +25 -0
  18. package/dist/nodes/Composio/catalog.js +195 -0
  19. package/dist/nodes/Composio/catalog.js.map +1 -0
  20. package/dist/nodes/Composio/composio.dark.svg +266 -0
  21. package/dist/nodes/Composio/composio.svg +266 -0
  22. package/dist/nodes/Composio/metatools.d.ts +37 -0
  23. package/dist/nodes/Composio/metatools.js +27 -0
  24. package/dist/nodes/Composio/metatools.js.map +1 -0
  25. package/dist/nodes/Composio/signature.d.ts +16 -0
  26. package/dist/nodes/Composio/signature.js +55 -0
  27. package/dist/nodes/Composio/signature.js.map +1 -0
  28. package/dist/nodes/ComposioTrigger/composio.dark.svg +266 -0
  29. package/dist/nodes/ComposioTrigger/composio.svg +266 -0
  30. package/dist/package.json +58 -0
  31. package/package.json +57 -5
@@ -0,0 +1,450 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Composio = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const catalog_1 = require("./catalog");
6
+ const GenericFunctions_1 = require("./GenericFunctions");
7
+ const metatools_1 = require("./metatools");
8
+ const resourceOptions = {
9
+ displayName: 'Resource',
10
+ name: 'resource',
11
+ type: 'options',
12
+ noDataExpression: true,
13
+ options: [
14
+ {
15
+ name: 'Action',
16
+ value: 'action',
17
+ description: 'Find an app action and run it against a connected account',
18
+ },
19
+ {
20
+ name: 'Connection',
21
+ value: 'connection',
22
+ description: 'Connect an app, check which apps are connected, or reconnect one',
23
+ },
24
+ {
25
+ name: 'Advanced',
26
+ value: 'advanced',
27
+ description: 'Call any Composio meta-tool directly with your own arguments',
28
+ },
29
+ ],
30
+ default: 'action',
31
+ };
32
+ const operationOptions = [
33
+ {
34
+ displayName: 'Operation',
35
+ name: 'operation',
36
+ type: 'options',
37
+ noDataExpression: true,
38
+ displayOptions: { show: { resource: ['action'] } },
39
+ options: [
40
+ {
41
+ name: 'Execute an Action',
42
+ value: 'execute',
43
+ description: 'Run the chosen action with the inputs you fill in',
44
+ action: 'Execute an action',
45
+ },
46
+ {
47
+ name: 'Get Action Inputs',
48
+ value: 'schemas',
49
+ description: 'List the inputs one or more actions expect',
50
+ action: 'Get action inputs',
51
+ },
52
+ {
53
+ name: 'Search Actions',
54
+ value: 'search',
55
+ description: 'Search the Composio catalog for actions matching what you want to do',
56
+ action: 'Search actions',
57
+ },
58
+ ],
59
+ default: 'search',
60
+ },
61
+ {
62
+ displayName: 'Operation',
63
+ name: 'operation',
64
+ type: 'options',
65
+ noDataExpression: true,
66
+ displayOptions: { show: { resource: ['connection'] } },
67
+ options: [
68
+ {
69
+ name: 'Check Connections',
70
+ value: 'check',
71
+ description: 'Report which of the chosen apps are connected',
72
+ action: 'Check connections',
73
+ },
74
+ {
75
+ name: 'Connect an App',
76
+ value: 'connect',
77
+ description: 'Start the authorization flow and return the link to open',
78
+ action: 'Connect an app',
79
+ },
80
+ {
81
+ name: 'Reconnect an App',
82
+ value: 'reconnect',
83
+ description: 'Replace a connection with a fresh authorization flow',
84
+ action: 'Reconnect an app',
85
+ },
86
+ ],
87
+ default: 'connect',
88
+ },
89
+ {
90
+ displayName: 'Operation',
91
+ name: 'operation',
92
+ type: 'options',
93
+ noDataExpression: true,
94
+ displayOptions: { show: { resource: ['advanced'] } },
95
+ options: [
96
+ {
97
+ name: 'Call a Meta-Tool',
98
+ value: 'call',
99
+ description: 'Send any Composio meta-tool with arguments you supply as JSON',
100
+ action: 'Call a meta tool',
101
+ },
102
+ ],
103
+ default: 'call',
104
+ },
105
+ ];
106
+ const fields = [
107
+ {
108
+ displayName: 'App Name or ID',
109
+ name: 'toolkit',
110
+ type: 'options',
111
+ typeOptions: { loadOptionsMethod: 'searchToolkits' },
112
+ default: '',
113
+ required: true,
114
+ description: 'The app to work with. Type part of a name such as gmail or sheets and pick from the list. Apps you have already connected are marked. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
115
+ displayOptions: { show: { resource: ['connection'], operation: ['connect', 'reconnect'] } },
116
+ },
117
+ {
118
+ displayName: 'App Names or IDs',
119
+ name: 'toolkits',
120
+ type: 'multiOptions',
121
+ typeOptions: { loadOptionsMethod: 'searchToolkits' },
122
+ default: [],
123
+ required: true,
124
+ description: 'The apps to check. Search and add each one. Any app that is not connected yet gets an authorization link in the output. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
125
+ displayOptions: { show: { resource: ['connection'], operation: ['check'] } },
126
+ },
127
+ {
128
+ displayName: 'Search For',
129
+ name: 'useCase',
130
+ type: 'string',
131
+ default: '',
132
+ required: true,
133
+ placeholder: 'send an email with an attachment',
134
+ description: 'What you want to do, in plain words. Composio returns matching actions, which app each belongs to, and which of those apps are already connected.',
135
+ displayOptions: { show: { resource: ['action'], operation: ['search'] } },
136
+ },
137
+ {
138
+ displayName: 'Action Name or ID',
139
+ name: 'toolSlug',
140
+ type: 'options',
141
+ typeOptions: { loadOptionsMethod: 'searchActions' },
142
+ default: '',
143
+ required: true,
144
+ description: 'The action to run. Type part of what it does, or of its name, and pick from the list. Use Search Actions first if you are unsure. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
145
+ displayOptions: { show: { resource: ['action'], operation: ['execute'] } },
146
+ },
147
+ {
148
+ displayName: 'Action Names or IDs',
149
+ name: 'toolSlugs',
150
+ type: 'multiOptions',
151
+ typeOptions: { loadOptionsMethod: 'searchActions' },
152
+ default: [],
153
+ required: true,
154
+ description: 'The actions whose inputs you want to see. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
155
+ displayOptions: { show: { resource: ['action'], operation: ['schemas'] } },
156
+ },
157
+ {
158
+ displayName: 'Set Inputs',
159
+ name: 'inputMode',
160
+ type: 'options',
161
+ options: [
162
+ {
163
+ name: 'Using Fields',
164
+ value: 'fields',
165
+ description: 'Pick each input by name and type its value, with no JSON to write',
166
+ },
167
+ {
168
+ name: 'Using JSON',
169
+ value: 'json',
170
+ description: 'Write the whole arguments object yourself',
171
+ },
172
+ ],
173
+ default: 'fields',
174
+ description: 'How to provide the action inputs',
175
+ displayOptions: { show: { resource: ['action'], operation: ['execute'] } },
176
+ },
177
+ {
178
+ displayName: 'Input Parameters',
179
+ name: 'parameterRows',
180
+ type: 'fixedCollection',
181
+ typeOptions: { multipleValues: true },
182
+ default: {},
183
+ placeholder: 'Add Input',
184
+ description: 'The inputs this action needs. Add one row per input and pick its name from the list, which is read from the action itself. Values that look like JSON, such as true, 42 or {"a":1}, are sent as JSON.',
185
+ displayOptions: { show: { resource: ['action'], operation: ['execute'], inputMode: ['fields'] } },
186
+ options: [
187
+ {
188
+ displayName: 'Input',
189
+ name: 'parameters',
190
+ values: [
191
+ {
192
+ displayName: 'Parameter Name or ID',
193
+ name: 'name',
194
+ type: 'options',
195
+ typeOptions: { loadOptionsMethod: 'getToolParameters' },
196
+ default: '',
197
+ description: 'Which input of the action to set. The list is read from the action chosen above, and marks the required ones. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
198
+ },
199
+ {
200
+ displayName: 'Value',
201
+ name: 'value',
202
+ type: 'string',
203
+ default: '',
204
+ description: 'The value to send. Numbers, true, false, null, and JSON objects or arrays are recognised automatically. Everything else is sent as text.',
205
+ },
206
+ ],
207
+ },
208
+ ],
209
+ },
210
+ {
211
+ displayName: 'Arguments (JSON)',
212
+ name: 'arguments',
213
+ type: 'json',
214
+ default: '{}',
215
+ description: 'The full arguments object, exactly as the action expects it',
216
+ displayOptions: { show: { resource: ['action'], operation: ['execute'], inputMode: ['json'] } },
217
+ },
218
+ {
219
+ displayName: 'Save Large Responses in the Workbench',
220
+ name: 'syncToWorkbench',
221
+ type: 'boolean',
222
+ default: false,
223
+ description: 'Whether Composio should keep the full response in its workbench and return only a preview, which helps when an action returns something big',
224
+ displayOptions: { show: { resource: ['action'], operation: ['execute'] } },
225
+ },
226
+ {
227
+ displayName: 'Meta-Tool',
228
+ name: 'metaTool',
229
+ type: 'options',
230
+ options: metatools_1.META_TOOL_OPTIONS,
231
+ default: 'COMPOSIO_SEARCH_TOOLS',
232
+ description: 'The Composio meta-tool to send',
233
+ displayOptions: { show: { resource: ['advanced'], operation: ['call'] } },
234
+ },
235
+ {
236
+ displayName: 'Arguments (JSON)',
237
+ name: 'metaArguments',
238
+ type: 'json',
239
+ default: '{}',
240
+ description: 'The meta-tool arguments, exactly as Composio documents them',
241
+ displayOptions: { show: { resource: ['advanced'], operation: ['call'] } },
242
+ },
243
+ {
244
+ displayName: 'User ID',
245
+ name: 'userId',
246
+ type: 'string',
247
+ default: '',
248
+ description: 'Optional. Override the user whose connections are used. Leave empty to use the credential default.',
249
+ },
250
+ ];
251
+ class Composio {
252
+ constructor() {
253
+ this.description = {
254
+ displayName: 'Composio Connect',
255
+ name: 'composio',
256
+ icon: { light: 'file:composio.svg', dark: 'file:composio.dark.svg' },
257
+ group: ['transform'],
258
+ version: [1],
259
+ subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
260
+ description: 'Connect your own apps through Composio and run their actions in any workflow',
261
+ defaults: { name: 'Composio Connect' },
262
+ usableAsTool: true,
263
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
264
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
265
+ credentials: [{ name: 'composioApi', required: true }],
266
+ properties: [resourceOptions, ...operationOptions, ...fields],
267
+ };
268
+ this.methods = {
269
+ loadOptions: {
270
+ async searchToolkits(filter) {
271
+ const search = (filter !== null && filter !== void 0 ? filter : '').trim();
272
+ const data = await (0, GenericFunctions_1.searchCatalog)(this, search === '' ? 'popular apps and their actions' : search);
273
+ const toolkits = (0, catalog_1.extractToolkits)(data);
274
+ if (toolkits.length === 0) {
275
+ return [
276
+ {
277
+ name: 'No App Matched. Keep Typing, for Example Gmail, Slack or Sheets.',
278
+ value: '',
279
+ description: 'No match',
280
+ },
281
+ ];
282
+ }
283
+ return toolkits.map((entry) => ({
284
+ name: `${entry.toolkit}${entry.connected ? ' (connected)' : ''}`,
285
+ value: entry.toolkit,
286
+ description: entry.description === '' ? 'Composio app' : entry.description.slice(0, 120),
287
+ }));
288
+ },
289
+ async searchActions(filter) {
290
+ const search = (filter !== null && filter !== void 0 ? filter : '').trim();
291
+ const data = await (0, GenericFunctions_1.searchCatalog)(this, search === '' ? 'common actions' : search);
292
+ const tools = (0, catalog_1.extractTools)(data);
293
+ if (tools.length === 0) {
294
+ return [
295
+ {
296
+ name: 'No Action Matched. Describe What You Want to Do, for Example Send an Email.',
297
+ value: '',
298
+ description: 'No match',
299
+ },
300
+ ];
301
+ }
302
+ return tools.map((tool) => ({
303
+ name: tool.slug,
304
+ value: tool.slug,
305
+ description: `${tool.toolkit}${tool.description === '' ? '' : ' — ' + tool.description.slice(0, 110)}`,
306
+ }));
307
+ },
308
+ async getToolParameters() {
309
+ const toolSlug = this.getCurrentNodeParameter('toolSlug') || '';
310
+ if (toolSlug === '') {
311
+ return [
312
+ {
313
+ name: 'Choose an Action Above First',
314
+ value: '',
315
+ description: 'An action is needed before its inputs can be listed',
316
+ },
317
+ ];
318
+ }
319
+ const data = await (0, GenericFunctions_1.fetchToolSchemas)(this, [toolSlug]);
320
+ const parameters = (0, catalog_1.extractParameters)(data, toolSlug);
321
+ if (parameters.length === 0) {
322
+ return [
323
+ {
324
+ name: 'This Action Reports No Inputs, or Its Schema Could Not Be Read. Use Using JSON if You Know the Fields.',
325
+ value: '',
326
+ description: 'No inputs found',
327
+ },
328
+ ];
329
+ }
330
+ return parameters.map((parameter) => ({
331
+ name: `${parameter.name}${parameter.required ? ' (required)' : ''}`,
332
+ value: parameter.name,
333
+ description: `${parameter.type}${parameter.description === '' ? '' : ' — ' + parameter.description.slice(0, 110)}`,
334
+ }));
335
+ },
336
+ },
337
+ };
338
+ }
339
+ async execute() {
340
+ const items = this.getInputData();
341
+ const returnData = [];
342
+ const credentials = await this.getCredentials('composioApi');
343
+ for (let i = 0; i < items.length; i++) {
344
+ try {
345
+ const resource = this.getNodeParameter('resource', i);
346
+ const operation = this.getNodeParameter('operation', i);
347
+ const nodeUserId = this.getNodeParameter('userId', i, '') || undefined;
348
+ const userId = nodeUserId || (credentials.userId || undefined);
349
+ const push = (payload) => {
350
+ returnData.push({ json: payload, pairedItem: { item: i } });
351
+ };
352
+ if (resource === 'connection') {
353
+ if (operation === 'check') {
354
+ const toolkits = this.getNodeParameter('toolkits', i, []).filter((toolkit) => toolkit !== '');
355
+ const outcome = await (0, GenericFunctions_1.manageConnections)(this, toolkits);
356
+ push({
357
+ tool: outcome.tool,
358
+ data: outcome.data,
359
+ raw: outcome.text,
360
+ isError: outcome.isError,
361
+ });
362
+ continue;
363
+ }
364
+ const toolkit = this.getNodeParameter('toolkit', i);
365
+ const outcome = await (0, GenericFunctions_1.manageConnections)(this, [toolkit], operation === 'reconnect');
366
+ push({
367
+ tool: outcome.tool,
368
+ data: outcome.data,
369
+ raw: outcome.text,
370
+ isError: outcome.isError,
371
+ });
372
+ continue;
373
+ }
374
+ let tool;
375
+ let args;
376
+ if (resource === 'action') {
377
+ if (operation === 'search') {
378
+ tool = metatools_1.META_TOOLS.searchTools;
379
+ args = {
380
+ queries: [{ use_case: this.getNodeParameter('useCase', i) }],
381
+ session: { generate_id: true },
382
+ };
383
+ }
384
+ else if (operation === 'schemas') {
385
+ tool = metatools_1.META_TOOLS.getToolSchemas;
386
+ args = {
387
+ tool_slugs: this.getNodeParameter('toolSlugs', i, []).filter((slug) => slug !== ''),
388
+ include: ['input_schema'],
389
+ };
390
+ }
391
+ else {
392
+ const inputMode = this.getNodeParameter('inputMode', i, 'fields');
393
+ let toolArguments;
394
+ if (inputMode === 'json') {
395
+ const raw = this.getNodeParameter('arguments', i, '{}');
396
+ toolArguments =
397
+ typeof raw === 'string'
398
+ ? JSON.parse(raw === '' ? '{}' : raw)
399
+ : raw;
400
+ }
401
+ else {
402
+ const rows = this.getNodeParameter('parameterRows.parameters', i, []);
403
+ toolArguments = (0, catalog_1.buildArgumentsFromRows)(rows);
404
+ }
405
+ tool = metatools_1.META_TOOLS.multiExecuteTool;
406
+ args = {
407
+ tools: [
408
+ {
409
+ tool_slug: this.getNodeParameter('toolSlug', i),
410
+ arguments: toolArguments,
411
+ },
412
+ ],
413
+ sync_response_to_workbench: this.getNodeParameter('syncToWorkbench', i, false),
414
+ };
415
+ }
416
+ }
417
+ else {
418
+ tool = this.getNodeParameter('metaTool', i);
419
+ const rawMetaArguments = this.getNodeParameter('metaArguments', i, '{}');
420
+ const parsed = typeof rawMetaArguments === 'string'
421
+ ? JSON.parse(rawMetaArguments === '' ? '{}' : rawMetaArguments)
422
+ : rawMetaArguments;
423
+ args = { ...parsed };
424
+ }
425
+ if (userId !== undefined)
426
+ args.user_id = userId;
427
+ const outcome = await (0, GenericFunctions_1.callMetaTool)(this, tool, args);
428
+ push({
429
+ tool: outcome.tool,
430
+ data: outcome.data,
431
+ raw: outcome.text,
432
+ isError: outcome.isError,
433
+ });
434
+ }
435
+ catch (error) {
436
+ if (this.continueOnFail()) {
437
+ returnData.push({
438
+ json: { error: error.message },
439
+ pairedItem: { item: i },
440
+ });
441
+ continue;
442
+ }
443
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex: i });
444
+ }
445
+ }
446
+ return [returnData];
447
+ }
448
+ }
449
+ exports.Composio = Composio;
450
+ //# sourceMappingURL=Composio.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Composio.node.js","sourceRoot":"","sources":["../../../nodes/Composio/Composio.node.ts"],"names":[],"mappings":";;;AAUA,+CAAuE;AAEvE,uCAAqG;AACrG,yDAAsG;AACtG,2CAA4D;AAE5D,MAAM,eAAe,GAAoB;IACxC,WAAW,EAAE,UAAU;IACvB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,SAAS;IACf,gBAAgB,EAAE,IAAI;IACtB,OAAO,EAAE;QACR;YACC,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,2DAA2D;SACxE;QACD;YACC,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,kEAAkE;SAC/E;QACD;YACC,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,UAAU;YACjB,WAAW,EAAE,8DAA8D;SAC3E;KACD;IACD,OAAO,EAAE,QAAQ;CACjB,CAAC;AAEF,MAAM,gBAAgB,GAAsB;IAC3C;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE;QAClD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,mBAAmB;gBACzB,KAAK,EAAE,SAAS;gBAChB,WAAW,EAAE,mDAAmD;gBAChE,MA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AE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE;wBACzC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAc,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;YAChF,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAnOD,4BAmOC"}
@@ -0,0 +1,12 @@
1
+ import type { IHookFunctions, INodeType, INodeTypeDescription, IWebhookFunctions, IWebhookResponseData } from 'n8n-workflow';
2
+ export declare class ComposioTrigger implements INodeType {
3
+ description: INodeTypeDescription;
4
+ webhookMethods: {
5
+ default: {
6
+ checkExists(this: IHookFunctions): Promise<boolean>;
7
+ create(this: IHookFunctions): Promise<boolean>;
8
+ delete(this: IHookFunctions): Promise<boolean>;
9
+ };
10
+ };
11
+ webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
12
+ }
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComposioTrigger = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const signature_1 = require("./signature");
6
+ function headerValue(value) {
7
+ if (Array.isArray(value))
8
+ return value[0];
9
+ return value !== null && value !== void 0 ? value : undefined;
10
+ }
11
+ class ComposioTrigger {
12
+ constructor() {
13
+ this.description = {
14
+ displayName: 'Composio Connect Trigger',
15
+ name: 'composioTrigger',
16
+ icon: { light: 'file:composio.svg', dark: 'file:composio.dark.svg' },
17
+ group: ['trigger'],
18
+ version: [1],
19
+ subtitle: '={{$parameter["events"].join(", ")}}',
20
+ description: 'Starts a workflow when something happens in an app connected through Composio',
21
+ defaults: { name: 'Composio Connect Trigger' },
22
+ inputs: [],
23
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
24
+ credentials: [{ name: 'composioApi', required: true }],
25
+ webhooks: [
26
+ {
27
+ name: 'default',
28
+ httpMethod: 'POST',
29
+ responseMode: 'onReceived',
30
+ path: 'composio-connect',
31
+ },
32
+ ],
33
+ properties: [
34
+ {
35
+ displayName: 'Events',
36
+ name: 'events',
37
+ type: 'multiOptions',
38
+ required: true,
39
+ default: ['composio.trigger.message'],
40
+ options: [
41
+ {
42
+ name: 'Any Event',
43
+ value: '*',
44
+ description: 'Every event Composio sends to this URL',
45
+ },
46
+ {
47
+ name: 'Trigger Message',
48
+ value: 'composio.trigger.message',
49
+ description: 'An event from an app, such as a new email or a new commit',
50
+ },
51
+ {
52
+ name: 'Connected Account Expired',
53
+ value: 'composio.connected_account.expired',
54
+ description: 'A connected account needs re-authorizing',
55
+ },
56
+ ],
57
+ description: 'Which Composio events should start this workflow',
58
+ },
59
+ {
60
+ displayName: 'Only These Triggers',
61
+ name: 'triggerSlugs',
62
+ type: 'string',
63
+ default: '',
64
+ placeholder: 'GITHUB_COMMIT_EVENT, GMAIL_NEW_GMAIL_MESSAGE',
65
+ description: 'Optional. Which trigger slugs to accept. Add several separated by commas. Leave empty to accept every trigger in the selected events.',
66
+ },
67
+ {
68
+ displayName: 'Verify Signature',
69
+ name: 'verifySignature',
70
+ type: 'boolean',
71
+ default: true,
72
+ description: 'Whether to reject requests whose Composio signature does not match, which stops anyone who learns the URL from injecting events. It needs the webhook signing secret saved in the credential.',
73
+ },
74
+ {
75
+ displayName: 'Signature Tolerance (Seconds)',
76
+ name: 'toleranceSeconds',
77
+ type: 'number',
78
+ default: signature_1.DEFAULT_TOLERANCE_SECONDS,
79
+ displayOptions: { show: { verifySignature: [true] } },
80
+ description: 'How old a request may be before it is refused, which blocks replayed payloads. Composio signs with the current time, so keep this generous enough for clock drift.',
81
+ },
82
+ ],
83
+ };
84
+ this.webhookMethods = {
85
+ default: {
86
+ async checkExists() {
87
+ return true;
88
+ },
89
+ async create() {
90
+ return true;
91
+ },
92
+ async delete() {
93
+ return true;
94
+ },
95
+ },
96
+ };
97
+ }
98
+ async webhook() {
99
+ var _a, _b, _c, _d, _e, _f;
100
+ const headers = this.getHeaderData();
101
+ const body = this.getBodyData();
102
+ const verifySignature = this.getNodeParameter('verifySignature', false);
103
+ const webhookId = headerValue(headers['webhook-id']);
104
+ const webhookTimestamp = headerValue(headers['webhook-timestamp']);
105
+ const webhookSignature = headerValue(headers['webhook-signature']);
106
+ if (verifySignature) {
107
+ const credentials = await this.getCredentials('composioApi');
108
+ const secret = ((_a = credentials.webhookSecret) !== null && _a !== void 0 ? _a : '').trim();
109
+ if (secret === '') {
110
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Signature verification is on but the credential has no webhook signing secret. Add it, or turn verification off if this URL is not reachable from outside.');
111
+ }
112
+ const request = this.getRequestObject();
113
+ let rawBody;
114
+ if (request !== undefined && request !== null) {
115
+ if (Buffer.isBuffer(request.rawBody)) {
116
+ rawBody = request.rawBody.toString('utf8');
117
+ }
118
+ else if (typeof request.readRawBody === 'function') {
119
+ await request.readRawBody();
120
+ rawBody = Buffer.isBuffer(request.rawBody) ? request.rawBody.toString('utf8') : undefined;
121
+ }
122
+ }
123
+ if (rawBody === undefined) {
124
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'n8n did not expose the raw request body, so the Composio signature cannot be checked. Verification cannot succeed without it.');
125
+ }
126
+ const result = (0, signature_1.checkSignature)({
127
+ secret,
128
+ rawBody,
129
+ signature: webhookSignature,
130
+ id: webhookId,
131
+ timestamp: webhookTimestamp,
132
+ toleranceSeconds: this.getNodeParameter('toleranceSeconds', signature_1.DEFAULT_TOLERANCE_SECONDS),
133
+ }, Date.now());
134
+ if (!result.ok) {
135
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Rejected a Composio webhook because ${result.reason}.`);
136
+ }
137
+ }
138
+ const event = (_c = (_b = body.type) !== null && _b !== void 0 ? _b : body.event) !== null && _c !== void 0 ? _c : 'unknown';
139
+ const metadata = (_d = body.metadata) !== null && _d !== void 0 ? _d : {};
140
+ const triggerSlug = (_e = metadata.trigger_slug) !== null && _e !== void 0 ? _e : metadata.triggerSlug;
141
+ const wantedEvents = this.getNodeParameter('events', []);
142
+ if (!wantedEvents.includes('*') && !wantedEvents.includes(event)) {
143
+ return { workflowData: [] };
144
+ }
145
+ const slugFilter = (this.getNodeParameter('triggerSlugs', '') || '')
146
+ .split(',')
147
+ .map((slug) => slug.trim().toUpperCase())
148
+ .filter((slug) => slug !== '');
149
+ if (slugFilter.length > 0 && !slugFilter.includes((triggerSlug !== null && triggerSlug !== void 0 ? triggerSlug : '').toUpperCase())) {
150
+ return { workflowData: [] };
151
+ }
152
+ return {
153
+ workflowData: [
154
+ [
155
+ {
156
+ json: {
157
+ event,
158
+ triggerSlug: triggerSlug !== null && triggerSlug !== void 0 ? triggerSlug : '',
159
+ webhookId: webhookId !== null && webhookId !== void 0 ? webhookId : '',
160
+ timestamp: webhookTimestamp !== null && webhookTimestamp !== void 0 ? webhookTimestamp : '',
161
+ verified: verifySignature,
162
+ data: (_f = body.data) !== null && _f !== void 0 ? _f : body,
163
+ payload: body,
164
+ },
165
+ },
166
+ ],
167
+ ],
168
+ };
169
+ }
170
+ }
171
+ exports.ComposioTrigger = ComposioTrigger;
172
+ //# sourceMappingURL=ComposioTrigger.node.js.map