@nornweave/n8n-nodes-nornweave 0.1.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.
@@ -0,0 +1,701 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NornWeave = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ class NornWeave {
6
+ constructor() {
7
+ this.description = {
8
+ displayName: 'NornWeave',
9
+ name: 'nornWeave',
10
+ icon: 'file:../../icons/nornweave.svg',
11
+ group: ['transform'],
12
+ version: 1,
13
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
14
+ description: 'Interact with NornWeave - Inbox-as-a-Service for AI Agents',
15
+ defaults: {
16
+ name: 'NornWeave',
17
+ },
18
+ usableAsTool: true,
19
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
20
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
21
+ credentials: [
22
+ {
23
+ name: 'nornWeaveApi',
24
+ required: true,
25
+ },
26
+ ],
27
+ requestDefaults: {
28
+ baseURL: '={{$credentials?.baseUrl}}',
29
+ headers: {
30
+ Accept: 'application/json',
31
+ 'Content-Type': 'application/json',
32
+ },
33
+ },
34
+ properties: [
35
+ {
36
+ displayName: 'Resource',
37
+ name: 'resource',
38
+ type: 'options',
39
+ noDataExpression: true,
40
+ options: [
41
+ {
42
+ name: 'Inbox',
43
+ value: 'inbox',
44
+ description: 'Manage email inboxes',
45
+ },
46
+ {
47
+ name: 'Message',
48
+ value: 'message',
49
+ description: 'Send and retrieve email messages',
50
+ },
51
+ {
52
+ name: 'Thread',
53
+ value: 'thread',
54
+ description: 'Access email conversation threads',
55
+ },
56
+ {
57
+ name: 'Search',
58
+ value: 'search',
59
+ description: 'Search messages by content',
60
+ },
61
+ ],
62
+ default: 'inbox',
63
+ },
64
+ {
65
+ displayName: 'Operation',
66
+ name: 'operation',
67
+ type: 'options',
68
+ noDataExpression: true,
69
+ displayOptions: {
70
+ show: {
71
+ resource: ['inbox'],
72
+ },
73
+ },
74
+ options: [
75
+ {
76
+ name: 'Create',
77
+ value: 'create',
78
+ description: 'Create a new inbox',
79
+ action: 'Create an inbox',
80
+ routing: {
81
+ request: {
82
+ method: 'POST',
83
+ url: '/v1/inboxes',
84
+ },
85
+ },
86
+ },
87
+ {
88
+ name: 'Delete',
89
+ value: 'delete',
90
+ description: 'Delete an inbox',
91
+ action: 'Delete an inbox',
92
+ routing: {
93
+ request: {
94
+ method: 'DELETE',
95
+ url: '=/v1/inboxes/{{$parameter["inboxId"]}}',
96
+ },
97
+ output: {
98
+ postReceive: [
99
+ {
100
+ type: 'set',
101
+ properties: {
102
+ value: '={{ { "success": true } }}',
103
+ },
104
+ },
105
+ ],
106
+ },
107
+ },
108
+ },
109
+ {
110
+ name: 'Get',
111
+ value: 'get',
112
+ description: 'Get an inbox by ID',
113
+ action: 'Get an inbox',
114
+ routing: {
115
+ request: {
116
+ method: 'GET',
117
+ url: '=/v1/inboxes/{{$parameter["inboxId"]}}',
118
+ },
119
+ },
120
+ },
121
+ {
122
+ name: 'Get Many',
123
+ value: 'getMany',
124
+ description: 'Get many inboxes',
125
+ action: 'Get many inboxes',
126
+ routing: {
127
+ request: {
128
+ method: 'GET',
129
+ url: '/v1/inboxes',
130
+ },
131
+ output: {
132
+ postReceive: [
133
+ {
134
+ type: 'rootProperty',
135
+ properties: {
136
+ property: 'items',
137
+ },
138
+ },
139
+ ],
140
+ },
141
+ },
142
+ },
143
+ ],
144
+ default: 'getMany',
145
+ },
146
+ {
147
+ displayName: 'Name',
148
+ name: 'name',
149
+ type: 'string',
150
+ required: true,
151
+ default: '',
152
+ placeholder: 'Support Inbox',
153
+ description: 'A friendly name for the inbox',
154
+ displayOptions: {
155
+ show: {
156
+ resource: ['inbox'],
157
+ operation: ['create'],
158
+ },
159
+ },
160
+ routing: {
161
+ send: {
162
+ type: 'body',
163
+ property: 'name',
164
+ },
165
+ },
166
+ },
167
+ {
168
+ displayName: 'Email Username',
169
+ name: 'emailUsername',
170
+ type: 'string',
171
+ required: true,
172
+ default: '',
173
+ placeholder: 'support',
174
+ description: 'The username part of the email address (e.g., "support" for support@yourdomain.com)',
175
+ displayOptions: {
176
+ show: {
177
+ resource: ['inbox'],
178
+ operation: ['create'],
179
+ },
180
+ },
181
+ routing: {
182
+ send: {
183
+ type: 'body',
184
+ property: 'email_username',
185
+ },
186
+ },
187
+ },
188
+ {
189
+ displayName: 'Inbox ID',
190
+ name: 'inboxId',
191
+ type: 'string',
192
+ required: true,
193
+ default: '',
194
+ description: 'The ID of the inbox',
195
+ displayOptions: {
196
+ show: {
197
+ resource: ['inbox'],
198
+ operation: ['get', 'delete'],
199
+ },
200
+ },
201
+ },
202
+ {
203
+ displayName: 'Return All',
204
+ name: 'returnAll',
205
+ type: 'boolean',
206
+ default: false,
207
+ description: 'Whether to return all results or only up to a given limit',
208
+ displayOptions: {
209
+ show: {
210
+ resource: ['inbox'],
211
+ operation: ['getMany'],
212
+ },
213
+ },
214
+ },
215
+ {
216
+ displayName: 'Limit',
217
+ name: 'limit',
218
+ type: 'number',
219
+ typeOptions: {
220
+ minValue: 1,
221
+ maxValue: 100,
222
+ },
223
+ default: 50,
224
+ description: 'Max number of results to return',
225
+ displayOptions: {
226
+ show: {
227
+ resource: ['inbox'],
228
+ operation: ['getMany'],
229
+ returnAll: [false],
230
+ },
231
+ },
232
+ routing: {
233
+ send: {
234
+ type: 'query',
235
+ property: 'limit',
236
+ },
237
+ },
238
+ },
239
+ {
240
+ displayName: 'Operation',
241
+ name: 'operation',
242
+ type: 'options',
243
+ noDataExpression: true,
244
+ displayOptions: {
245
+ show: {
246
+ resource: ['message'],
247
+ },
248
+ },
249
+ options: [
250
+ {
251
+ name: 'Get',
252
+ value: 'get',
253
+ description: 'Get a message by ID',
254
+ action: 'Get a message',
255
+ routing: {
256
+ request: {
257
+ method: 'GET',
258
+ url: '=/v1/messages/{{$parameter["messageId"]}}',
259
+ },
260
+ },
261
+ },
262
+ {
263
+ name: 'Get Many',
264
+ value: 'getMany',
265
+ description: 'Get many messages from an inbox',
266
+ action: 'Get many messages',
267
+ routing: {
268
+ request: {
269
+ method: 'GET',
270
+ url: '/v1/messages',
271
+ },
272
+ output: {
273
+ postReceive: [
274
+ {
275
+ type: 'rootProperty',
276
+ properties: {
277
+ property: 'items',
278
+ },
279
+ },
280
+ ],
281
+ },
282
+ },
283
+ },
284
+ {
285
+ name: 'Send',
286
+ value: 'send',
287
+ description: 'Send an outbound email message',
288
+ action: 'Send a message',
289
+ routing: {
290
+ request: {
291
+ method: 'POST',
292
+ url: '/v1/messages',
293
+ },
294
+ },
295
+ },
296
+ ],
297
+ default: 'getMany',
298
+ },
299
+ {
300
+ displayName: 'Message ID',
301
+ name: 'messageId',
302
+ type: 'string',
303
+ required: true,
304
+ default: '',
305
+ description: 'The ID of the message',
306
+ displayOptions: {
307
+ show: {
308
+ resource: ['message'],
309
+ operation: ['get'],
310
+ },
311
+ },
312
+ },
313
+ {
314
+ displayName: 'Inbox ID',
315
+ name: 'inboxId',
316
+ type: 'string',
317
+ required: true,
318
+ default: '',
319
+ description: 'The ID of the inbox to get messages from',
320
+ displayOptions: {
321
+ show: {
322
+ resource: ['message'],
323
+ operation: ['getMany'],
324
+ },
325
+ },
326
+ routing: {
327
+ send: {
328
+ type: 'query',
329
+ property: 'inbox_id',
330
+ },
331
+ },
332
+ },
333
+ {
334
+ displayName: 'Return All',
335
+ name: 'returnAll',
336
+ type: 'boolean',
337
+ default: false,
338
+ description: 'Whether to return all results or only up to a given limit',
339
+ displayOptions: {
340
+ show: {
341
+ resource: ['message'],
342
+ operation: ['getMany'],
343
+ },
344
+ },
345
+ },
346
+ {
347
+ displayName: 'Limit',
348
+ name: 'limit',
349
+ type: 'number',
350
+ typeOptions: {
351
+ minValue: 1,
352
+ maxValue: 100,
353
+ },
354
+ default: 50,
355
+ description: 'Max number of results to return',
356
+ displayOptions: {
357
+ show: {
358
+ resource: ['message'],
359
+ operation: ['getMany'],
360
+ returnAll: [false],
361
+ },
362
+ },
363
+ routing: {
364
+ send: {
365
+ type: 'query',
366
+ property: 'limit',
367
+ },
368
+ },
369
+ },
370
+ {
371
+ displayName: 'Inbox ID',
372
+ name: 'inboxId',
373
+ type: 'string',
374
+ required: true,
375
+ default: '',
376
+ description: 'The ID of the inbox to send from',
377
+ displayOptions: {
378
+ show: {
379
+ resource: ['message'],
380
+ operation: ['send'],
381
+ },
382
+ },
383
+ routing: {
384
+ send: {
385
+ type: 'body',
386
+ property: 'inbox_id',
387
+ },
388
+ },
389
+ },
390
+ {
391
+ displayName: 'To',
392
+ name: 'to',
393
+ type: 'string',
394
+ required: true,
395
+ default: '',
396
+ placeholder: 'recipient@example.com',
397
+ description: 'Recipient email addresses (comma-separated for multiple)',
398
+ displayOptions: {
399
+ show: {
400
+ resource: ['message'],
401
+ operation: ['send'],
402
+ },
403
+ },
404
+ routing: {
405
+ send: {
406
+ type: 'body',
407
+ property: 'to',
408
+ value: '={{ $value.split(",").map(e => e.trim()) }}',
409
+ },
410
+ },
411
+ },
412
+ {
413
+ displayName: 'Subject',
414
+ name: 'subject',
415
+ type: 'string',
416
+ required: true,
417
+ default: '',
418
+ placeholder: 'Hello from NornWeave',
419
+ description: 'The email subject line',
420
+ displayOptions: {
421
+ show: {
422
+ resource: ['message'],
423
+ operation: ['send'],
424
+ },
425
+ },
426
+ routing: {
427
+ send: {
428
+ type: 'body',
429
+ property: 'subject',
430
+ },
431
+ },
432
+ },
433
+ {
434
+ displayName: 'Body',
435
+ name: 'body',
436
+ type: 'string',
437
+ typeOptions: {
438
+ rows: 5,
439
+ },
440
+ required: true,
441
+ default: '',
442
+ placeholder: 'Your message content in **Markdown** format',
443
+ description: 'The email body content (Markdown supported)',
444
+ displayOptions: {
445
+ show: {
446
+ resource: ['message'],
447
+ operation: ['send'],
448
+ },
449
+ },
450
+ routing: {
451
+ send: {
452
+ type: 'body',
453
+ property: 'body',
454
+ },
455
+ },
456
+ },
457
+ {
458
+ displayName: 'Reply to Thread ID',
459
+ name: 'replyToThreadId',
460
+ type: 'string',
461
+ default: '',
462
+ description: 'Optional thread ID to reply to (creates a new thread if empty)',
463
+ displayOptions: {
464
+ show: {
465
+ resource: ['message'],
466
+ operation: ['send'],
467
+ },
468
+ },
469
+ routing: {
470
+ send: {
471
+ type: 'body',
472
+ property: 'reply_to_thread_id',
473
+ value: '={{ $value || undefined }}',
474
+ },
475
+ },
476
+ },
477
+ {
478
+ displayName: 'Operation',
479
+ name: 'operation',
480
+ type: 'options',
481
+ noDataExpression: true,
482
+ displayOptions: {
483
+ show: {
484
+ resource: ['thread'],
485
+ },
486
+ },
487
+ options: [
488
+ {
489
+ name: 'Get',
490
+ value: 'get',
491
+ description: 'Get a thread with all messages',
492
+ action: 'Get a thread',
493
+ routing: {
494
+ request: {
495
+ method: 'GET',
496
+ url: '=/v1/threads/{{$parameter["threadId"]}}',
497
+ },
498
+ },
499
+ },
500
+ {
501
+ name: 'Get Many',
502
+ value: 'getMany',
503
+ description: 'Get many threads from an inbox',
504
+ action: 'Get many threads',
505
+ routing: {
506
+ request: {
507
+ method: 'GET',
508
+ url: '/v1/threads',
509
+ },
510
+ output: {
511
+ postReceive: [
512
+ {
513
+ type: 'rootProperty',
514
+ properties: {
515
+ property: 'items',
516
+ },
517
+ },
518
+ ],
519
+ },
520
+ },
521
+ },
522
+ ],
523
+ default: 'getMany',
524
+ },
525
+ {
526
+ displayName: 'Thread ID',
527
+ name: 'threadId',
528
+ type: 'string',
529
+ required: true,
530
+ default: '',
531
+ description: 'The ID of the thread',
532
+ displayOptions: {
533
+ show: {
534
+ resource: ['thread'],
535
+ operation: ['get'],
536
+ },
537
+ },
538
+ },
539
+ {
540
+ displayName: 'Inbox ID',
541
+ name: 'inboxId',
542
+ type: 'string',
543
+ required: true,
544
+ default: '',
545
+ description: 'The ID of the inbox to get threads from',
546
+ displayOptions: {
547
+ show: {
548
+ resource: ['thread'],
549
+ operation: ['getMany'],
550
+ },
551
+ },
552
+ routing: {
553
+ send: {
554
+ type: 'query',
555
+ property: 'inbox_id',
556
+ },
557
+ },
558
+ },
559
+ {
560
+ displayName: 'Return All',
561
+ name: 'returnAll',
562
+ type: 'boolean',
563
+ default: false,
564
+ description: 'Whether to return all results or only up to a given limit',
565
+ displayOptions: {
566
+ show: {
567
+ resource: ['thread'],
568
+ operation: ['getMany'],
569
+ },
570
+ },
571
+ },
572
+ {
573
+ displayName: 'Limit',
574
+ name: 'limit',
575
+ type: 'number',
576
+ typeOptions: {
577
+ minValue: 1,
578
+ maxValue: 100,
579
+ },
580
+ default: 50,
581
+ description: 'Max number of results to return',
582
+ displayOptions: {
583
+ show: {
584
+ resource: ['thread'],
585
+ operation: ['getMany'],
586
+ returnAll: [false],
587
+ },
588
+ },
589
+ routing: {
590
+ send: {
591
+ type: 'query',
592
+ property: 'limit',
593
+ },
594
+ },
595
+ },
596
+ {
597
+ displayName: 'Operation',
598
+ name: 'operation',
599
+ type: 'options',
600
+ noDataExpression: true,
601
+ displayOptions: {
602
+ show: {
603
+ resource: ['search'],
604
+ },
605
+ },
606
+ options: [
607
+ {
608
+ name: 'Query',
609
+ value: 'query',
610
+ description: 'Search messages by content',
611
+ action: 'Search messages',
612
+ routing: {
613
+ request: {
614
+ method: 'POST',
615
+ url: '/v1/search',
616
+ },
617
+ output: {
618
+ postReceive: [
619
+ {
620
+ type: 'rootProperty',
621
+ properties: {
622
+ property: 'items',
623
+ },
624
+ },
625
+ ],
626
+ },
627
+ },
628
+ },
629
+ ],
630
+ default: 'query',
631
+ },
632
+ {
633
+ displayName: 'Query',
634
+ name: 'query',
635
+ type: 'string',
636
+ required: true,
637
+ default: '',
638
+ placeholder: 'invoice from October',
639
+ description: 'The search query to find messages',
640
+ displayOptions: {
641
+ show: {
642
+ resource: ['search'],
643
+ operation: ['query'],
644
+ },
645
+ },
646
+ routing: {
647
+ send: {
648
+ type: 'body',
649
+ property: 'query',
650
+ },
651
+ },
652
+ },
653
+ {
654
+ displayName: 'Inbox ID',
655
+ name: 'inboxId',
656
+ type: 'string',
657
+ required: true,
658
+ default: '',
659
+ description: 'The ID of the inbox to search in',
660
+ displayOptions: {
661
+ show: {
662
+ resource: ['search'],
663
+ operation: ['query'],
664
+ },
665
+ },
666
+ routing: {
667
+ send: {
668
+ type: 'body',
669
+ property: 'inbox_id',
670
+ },
671
+ },
672
+ },
673
+ {
674
+ displayName: 'Limit',
675
+ name: 'limit',
676
+ type: 'number',
677
+ typeOptions: {
678
+ minValue: 1,
679
+ maxValue: 100,
680
+ },
681
+ default: 50,
682
+ description: 'Max number of results to return',
683
+ displayOptions: {
684
+ show: {
685
+ resource: ['search'],
686
+ operation: ['query'],
687
+ },
688
+ },
689
+ routing: {
690
+ send: {
691
+ type: 'body',
692
+ property: 'limit',
693
+ },
694
+ },
695
+ },
696
+ ],
697
+ };
698
+ }
699
+ }
700
+ exports.NornWeave = NornWeave;
701
+ //# sourceMappingURL=NornWeave.node.js.map