@ha-bits/bit-email 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.
@@ -0,0 +1,771 @@
1
+ /**
2
+ * @ha-bits/bit-email
3
+ *
4
+ * Email integration bit for IMAP fetching and SMTP sending.
5
+ * Provides triggers for new emails and actions for sending emails.
6
+ */
7
+ interface EmailContext {
8
+ auth?: {
9
+ imapHost?: string;
10
+ imapPort?: number;
11
+ imapUser?: string;
12
+ imapPassword?: string;
13
+ smtpHost?: string;
14
+ smtpPort?: number;
15
+ smtpUser?: string;
16
+ smtpPassword?: string;
17
+ };
18
+ propsValue: Record<string, any>;
19
+ }
20
+ interface EmailMessage {
21
+ id: string;
22
+ from: string;
23
+ to: string;
24
+ subject: string;
25
+ body: string;
26
+ date: string;
27
+ attachments?: Array<{
28
+ filename: string;
29
+ contentType: string;
30
+ size: number;
31
+ }>;
32
+ }
33
+ declare const emailBit: {
34
+ displayName: string;
35
+ description: string;
36
+ logoUrl: string;
37
+ auth: {
38
+ type: string;
39
+ displayName: string;
40
+ description: string;
41
+ required: boolean;
42
+ props: {
43
+ imapHost: {
44
+ type: string;
45
+ displayName: string;
46
+ required: boolean;
47
+ };
48
+ imapPort: {
49
+ type: string;
50
+ displayName: string;
51
+ required: boolean;
52
+ defaultValue: number;
53
+ };
54
+ imapUser: {
55
+ type: string;
56
+ displayName: string;
57
+ required: boolean;
58
+ };
59
+ imapPassword: {
60
+ type: string;
61
+ displayName: string;
62
+ required: boolean;
63
+ };
64
+ smtpHost: {
65
+ type: string;
66
+ displayName: string;
67
+ required: boolean;
68
+ };
69
+ smtpPort: {
70
+ type: string;
71
+ displayName: string;
72
+ required: boolean;
73
+ defaultValue: number;
74
+ };
75
+ smtpUser: {
76
+ type: string;
77
+ displayName: string;
78
+ required: boolean;
79
+ };
80
+ smtpPassword: {
81
+ type: string;
82
+ displayName: string;
83
+ required: boolean;
84
+ };
85
+ };
86
+ };
87
+ triggers: {
88
+ /**
89
+ * IMAP trigger - fetch new emails
90
+ */
91
+ newEmail: {
92
+ name: string;
93
+ displayName: string;
94
+ description: string;
95
+ type: string;
96
+ props: {
97
+ imapHost: {
98
+ type: string;
99
+ displayName: string;
100
+ description: string;
101
+ required: boolean;
102
+ };
103
+ imapPort: {
104
+ type: string;
105
+ displayName: string;
106
+ description: string;
107
+ required: boolean;
108
+ defaultValue: number;
109
+ };
110
+ imapUser: {
111
+ type: string;
112
+ displayName: string;
113
+ description: string;
114
+ required: boolean;
115
+ };
116
+ imapPassword: {
117
+ type: string;
118
+ displayName: string;
119
+ description: string;
120
+ required: boolean;
121
+ };
122
+ folder: {
123
+ type: string;
124
+ displayName: string;
125
+ description: string;
126
+ required: boolean;
127
+ defaultValue: string;
128
+ };
129
+ unreadOnly: {
130
+ type: string;
131
+ displayName: string;
132
+ description: string;
133
+ required: boolean;
134
+ defaultValue: boolean;
135
+ };
136
+ limit: {
137
+ type: string;
138
+ displayName: string;
139
+ description: string;
140
+ required: boolean;
141
+ defaultValue: number;
142
+ };
143
+ };
144
+ run(context: EmailContext): Promise<{
145
+ emails: EmailMessage[];
146
+ count: number;
147
+ folder: any;
148
+ timestamp: string;
149
+ }>;
150
+ };
151
+ };
152
+ actions: {
153
+ /**
154
+ * New Email action (for workflow testing - simulates IMAP trigger as action)
155
+ */
156
+ newEmail: {
157
+ name: string;
158
+ displayName: string;
159
+ description: string;
160
+ props: {
161
+ imapHost: {
162
+ type: string;
163
+ displayName: string;
164
+ description: string;
165
+ required: boolean;
166
+ };
167
+ imapPort: {
168
+ type: string;
169
+ displayName: string;
170
+ description: string;
171
+ required: boolean;
172
+ defaultValue: number;
173
+ };
174
+ imapUser: {
175
+ type: string;
176
+ displayName: string;
177
+ description: string;
178
+ required: boolean;
179
+ };
180
+ imapPassword: {
181
+ type: string;
182
+ displayName: string;
183
+ description: string;
184
+ required: boolean;
185
+ };
186
+ folder: {
187
+ type: string;
188
+ displayName: string;
189
+ description: string;
190
+ required: boolean;
191
+ defaultValue: string;
192
+ };
193
+ unreadOnly: {
194
+ type: string;
195
+ displayName: string;
196
+ description: string;
197
+ required: boolean;
198
+ defaultValue: boolean;
199
+ };
200
+ limit: {
201
+ type: string;
202
+ displayName: string;
203
+ description: string;
204
+ required: boolean;
205
+ defaultValue: number;
206
+ };
207
+ };
208
+ run(context: EmailContext): Promise<{
209
+ emails: EmailMessage[];
210
+ count: number;
211
+ folder: any;
212
+ timestamp: string;
213
+ }>;
214
+ };
215
+ /**
216
+ * Fetch emails from IMAP server
217
+ */
218
+ fetchEmails: {
219
+ name: string;
220
+ displayName: string;
221
+ description: string;
222
+ props: {
223
+ imapHost: {
224
+ type: string;
225
+ displayName: string;
226
+ description: string;
227
+ required: boolean;
228
+ };
229
+ imapPort: {
230
+ type: string;
231
+ displayName: string;
232
+ description: string;
233
+ required: boolean;
234
+ defaultValue: number;
235
+ };
236
+ imapUser: {
237
+ type: string;
238
+ displayName: string;
239
+ description: string;
240
+ required: boolean;
241
+ };
242
+ imapPassword: {
243
+ type: string;
244
+ displayName: string;
245
+ description: string;
246
+ required: boolean;
247
+ };
248
+ folder: {
249
+ type: string;
250
+ displayName: string;
251
+ description: string;
252
+ required: boolean;
253
+ defaultValue: string;
254
+ };
255
+ unreadOnly: {
256
+ type: string;
257
+ displayName: string;
258
+ description: string;
259
+ required: boolean;
260
+ defaultValue: boolean;
261
+ };
262
+ limit: {
263
+ type: string;
264
+ displayName: string;
265
+ description: string;
266
+ required: boolean;
267
+ defaultValue: number;
268
+ };
269
+ };
270
+ run(context: EmailContext): Promise<{
271
+ emails: EmailMessage[];
272
+ count: number;
273
+ folder: any;
274
+ }>;
275
+ };
276
+ /**
277
+ * Send email via SMTP
278
+ */
279
+ sendEmail: {
280
+ name: string;
281
+ displayName: string;
282
+ description: string;
283
+ props: {
284
+ smtpHost: {
285
+ type: string;
286
+ displayName: string;
287
+ description: string;
288
+ required: boolean;
289
+ };
290
+ smtpPort: {
291
+ type: string;
292
+ displayName: string;
293
+ description: string;
294
+ required: boolean;
295
+ defaultValue: number;
296
+ };
297
+ smtpUser: {
298
+ type: string;
299
+ displayName: string;
300
+ description: string;
301
+ required: boolean;
302
+ };
303
+ smtpPassword: {
304
+ type: string;
305
+ displayName: string;
306
+ description: string;
307
+ required: boolean;
308
+ };
309
+ from: {
310
+ type: string;
311
+ displayName: string;
312
+ description: string;
313
+ required: boolean;
314
+ };
315
+ to: {
316
+ type: string;
317
+ displayName: string;
318
+ description: string;
319
+ required: boolean;
320
+ };
321
+ cc: {
322
+ type: string;
323
+ displayName: string;
324
+ description: string;
325
+ required: boolean;
326
+ };
327
+ bcc: {
328
+ type: string;
329
+ displayName: string;
330
+ description: string;
331
+ required: boolean;
332
+ };
333
+ subject: {
334
+ type: string;
335
+ displayName: string;
336
+ description: string;
337
+ required: boolean;
338
+ };
339
+ body: {
340
+ type: string;
341
+ displayName: string;
342
+ description: string;
343
+ required: boolean;
344
+ };
345
+ html: {
346
+ type: string;
347
+ displayName: string;
348
+ description: string;
349
+ required: boolean;
350
+ };
351
+ replyTo: {
352
+ type: string;
353
+ displayName: string;
354
+ description: string;
355
+ required: boolean;
356
+ };
357
+ };
358
+ run(context: EmailContext): Promise<{
359
+ success: boolean;
360
+ messageId: string;
361
+ accepted: string[];
362
+ from: any;
363
+ to: any;
364
+ subject: any;
365
+ timestamp: string;
366
+ }>;
367
+ };
368
+ /**
369
+ * Parse email content
370
+ */
371
+ parseEmail: {
372
+ name: string;
373
+ displayName: string;
374
+ description: string;
375
+ props: {
376
+ rawEmail: {
377
+ type: string;
378
+ displayName: string;
379
+ description: string;
380
+ required: boolean;
381
+ };
382
+ extractAttachments: {
383
+ type: string;
384
+ displayName: string;
385
+ description: string;
386
+ required: boolean;
387
+ defaultValue: boolean;
388
+ };
389
+ };
390
+ run(context: EmailContext): Promise<{
391
+ from: any;
392
+ to: any;
393
+ subject: any;
394
+ body: any;
395
+ html: any;
396
+ date: any;
397
+ attachments: any;
398
+ }>;
399
+ };
400
+ };
401
+ };
402
+ export declare const email: {
403
+ displayName: string;
404
+ description: string;
405
+ logoUrl: string;
406
+ auth: {
407
+ type: string;
408
+ displayName: string;
409
+ description: string;
410
+ required: boolean;
411
+ props: {
412
+ imapHost: {
413
+ type: string;
414
+ displayName: string;
415
+ required: boolean;
416
+ };
417
+ imapPort: {
418
+ type: string;
419
+ displayName: string;
420
+ required: boolean;
421
+ defaultValue: number;
422
+ };
423
+ imapUser: {
424
+ type: string;
425
+ displayName: string;
426
+ required: boolean;
427
+ };
428
+ imapPassword: {
429
+ type: string;
430
+ displayName: string;
431
+ required: boolean;
432
+ };
433
+ smtpHost: {
434
+ type: string;
435
+ displayName: string;
436
+ required: boolean;
437
+ };
438
+ smtpPort: {
439
+ type: string;
440
+ displayName: string;
441
+ required: boolean;
442
+ defaultValue: number;
443
+ };
444
+ smtpUser: {
445
+ type: string;
446
+ displayName: string;
447
+ required: boolean;
448
+ };
449
+ smtpPassword: {
450
+ type: string;
451
+ displayName: string;
452
+ required: boolean;
453
+ };
454
+ };
455
+ };
456
+ triggers: {
457
+ /**
458
+ * IMAP trigger - fetch new emails
459
+ */
460
+ newEmail: {
461
+ name: string;
462
+ displayName: string;
463
+ description: string;
464
+ type: string;
465
+ props: {
466
+ imapHost: {
467
+ type: string;
468
+ displayName: string;
469
+ description: string;
470
+ required: boolean;
471
+ };
472
+ imapPort: {
473
+ type: string;
474
+ displayName: string;
475
+ description: string;
476
+ required: boolean;
477
+ defaultValue: number;
478
+ };
479
+ imapUser: {
480
+ type: string;
481
+ displayName: string;
482
+ description: string;
483
+ required: boolean;
484
+ };
485
+ imapPassword: {
486
+ type: string;
487
+ displayName: string;
488
+ description: string;
489
+ required: boolean;
490
+ };
491
+ folder: {
492
+ type: string;
493
+ displayName: string;
494
+ description: string;
495
+ required: boolean;
496
+ defaultValue: string;
497
+ };
498
+ unreadOnly: {
499
+ type: string;
500
+ displayName: string;
501
+ description: string;
502
+ required: boolean;
503
+ defaultValue: boolean;
504
+ };
505
+ limit: {
506
+ type: string;
507
+ displayName: string;
508
+ description: string;
509
+ required: boolean;
510
+ defaultValue: number;
511
+ };
512
+ };
513
+ run(context: EmailContext): Promise<{
514
+ emails: EmailMessage[];
515
+ count: number;
516
+ folder: any;
517
+ timestamp: string;
518
+ }>;
519
+ };
520
+ };
521
+ actions: {
522
+ /**
523
+ * New Email action (for workflow testing - simulates IMAP trigger as action)
524
+ */
525
+ newEmail: {
526
+ name: string;
527
+ displayName: string;
528
+ description: string;
529
+ props: {
530
+ imapHost: {
531
+ type: string;
532
+ displayName: string;
533
+ description: string;
534
+ required: boolean;
535
+ };
536
+ imapPort: {
537
+ type: string;
538
+ displayName: string;
539
+ description: string;
540
+ required: boolean;
541
+ defaultValue: number;
542
+ };
543
+ imapUser: {
544
+ type: string;
545
+ displayName: string;
546
+ description: string;
547
+ required: boolean;
548
+ };
549
+ imapPassword: {
550
+ type: string;
551
+ displayName: string;
552
+ description: string;
553
+ required: boolean;
554
+ };
555
+ folder: {
556
+ type: string;
557
+ displayName: string;
558
+ description: string;
559
+ required: boolean;
560
+ defaultValue: string;
561
+ };
562
+ unreadOnly: {
563
+ type: string;
564
+ displayName: string;
565
+ description: string;
566
+ required: boolean;
567
+ defaultValue: boolean;
568
+ };
569
+ limit: {
570
+ type: string;
571
+ displayName: string;
572
+ description: string;
573
+ required: boolean;
574
+ defaultValue: number;
575
+ };
576
+ };
577
+ run(context: EmailContext): Promise<{
578
+ emails: EmailMessage[];
579
+ count: number;
580
+ folder: any;
581
+ timestamp: string;
582
+ }>;
583
+ };
584
+ /**
585
+ * Fetch emails from IMAP server
586
+ */
587
+ fetchEmails: {
588
+ name: string;
589
+ displayName: string;
590
+ description: string;
591
+ props: {
592
+ imapHost: {
593
+ type: string;
594
+ displayName: string;
595
+ description: string;
596
+ required: boolean;
597
+ };
598
+ imapPort: {
599
+ type: string;
600
+ displayName: string;
601
+ description: string;
602
+ required: boolean;
603
+ defaultValue: number;
604
+ };
605
+ imapUser: {
606
+ type: string;
607
+ displayName: string;
608
+ description: string;
609
+ required: boolean;
610
+ };
611
+ imapPassword: {
612
+ type: string;
613
+ displayName: string;
614
+ description: string;
615
+ required: boolean;
616
+ };
617
+ folder: {
618
+ type: string;
619
+ displayName: string;
620
+ description: string;
621
+ required: boolean;
622
+ defaultValue: string;
623
+ };
624
+ unreadOnly: {
625
+ type: string;
626
+ displayName: string;
627
+ description: string;
628
+ required: boolean;
629
+ defaultValue: boolean;
630
+ };
631
+ limit: {
632
+ type: string;
633
+ displayName: string;
634
+ description: string;
635
+ required: boolean;
636
+ defaultValue: number;
637
+ };
638
+ };
639
+ run(context: EmailContext): Promise<{
640
+ emails: EmailMessage[];
641
+ count: number;
642
+ folder: any;
643
+ }>;
644
+ };
645
+ /**
646
+ * Send email via SMTP
647
+ */
648
+ sendEmail: {
649
+ name: string;
650
+ displayName: string;
651
+ description: string;
652
+ props: {
653
+ smtpHost: {
654
+ type: string;
655
+ displayName: string;
656
+ description: string;
657
+ required: boolean;
658
+ };
659
+ smtpPort: {
660
+ type: string;
661
+ displayName: string;
662
+ description: string;
663
+ required: boolean;
664
+ defaultValue: number;
665
+ };
666
+ smtpUser: {
667
+ type: string;
668
+ displayName: string;
669
+ description: string;
670
+ required: boolean;
671
+ };
672
+ smtpPassword: {
673
+ type: string;
674
+ displayName: string;
675
+ description: string;
676
+ required: boolean;
677
+ };
678
+ from: {
679
+ type: string;
680
+ displayName: string;
681
+ description: string;
682
+ required: boolean;
683
+ };
684
+ to: {
685
+ type: string;
686
+ displayName: string;
687
+ description: string;
688
+ required: boolean;
689
+ };
690
+ cc: {
691
+ type: string;
692
+ displayName: string;
693
+ description: string;
694
+ required: boolean;
695
+ };
696
+ bcc: {
697
+ type: string;
698
+ displayName: string;
699
+ description: string;
700
+ required: boolean;
701
+ };
702
+ subject: {
703
+ type: string;
704
+ displayName: string;
705
+ description: string;
706
+ required: boolean;
707
+ };
708
+ body: {
709
+ type: string;
710
+ displayName: string;
711
+ description: string;
712
+ required: boolean;
713
+ };
714
+ html: {
715
+ type: string;
716
+ displayName: string;
717
+ description: string;
718
+ required: boolean;
719
+ };
720
+ replyTo: {
721
+ type: string;
722
+ displayName: string;
723
+ description: string;
724
+ required: boolean;
725
+ };
726
+ };
727
+ run(context: EmailContext): Promise<{
728
+ success: boolean;
729
+ messageId: string;
730
+ accepted: string[];
731
+ from: any;
732
+ to: any;
733
+ subject: any;
734
+ timestamp: string;
735
+ }>;
736
+ };
737
+ /**
738
+ * Parse email content
739
+ */
740
+ parseEmail: {
741
+ name: string;
742
+ displayName: string;
743
+ description: string;
744
+ props: {
745
+ rawEmail: {
746
+ type: string;
747
+ displayName: string;
748
+ description: string;
749
+ required: boolean;
750
+ };
751
+ extractAttachments: {
752
+ type: string;
753
+ displayName: string;
754
+ description: string;
755
+ required: boolean;
756
+ defaultValue: boolean;
757
+ };
758
+ };
759
+ run(context: EmailContext): Promise<{
760
+ from: any;
761
+ to: any;
762
+ subject: any;
763
+ body: any;
764
+ html: any;
765
+ date: any;
766
+ attachments: any;
767
+ }>;
768
+ };
769
+ };
770
+ };
771
+ export default emailBit;