feat: Convert all app files to JS
This commit is contained in:
3
packages/backend/src/apps/smtp/actions/index.js
Normal file
3
packages/backend/src/apps/smtp/actions/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import sendEmail from './send-email/index.js';
|
||||
|
||||
export default [sendEmail];
|
||||
@@ -1,3 +0,0 @@
|
||||
import sendEmail from './send-email';
|
||||
|
||||
export default [sendEmail];
|
||||
@@ -1,6 +1,5 @@
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import transporter from '../../common/transporter';
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
import transporter from '../../common/transporter.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Send an email',
|
||||
@@ -10,7 +9,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'From name',
|
||||
key: 'fromName',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
description: 'Display name of the sender.',
|
||||
variables: true,
|
||||
@@ -18,7 +17,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'From email',
|
||||
key: 'fromEmail',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Email address of the sender.',
|
||||
variables: true,
|
||||
@@ -26,7 +25,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Reply to',
|
||||
key: 'replyTo',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
description:
|
||||
'Email address to reply to. Defaults to the from email address.',
|
||||
@@ -35,7 +34,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'To',
|
||||
key: 'to',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description:
|
||||
'Comma seperated list of email addresses to send the email to.',
|
||||
@@ -44,7 +43,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Cc',
|
||||
key: 'cc',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
description: 'Comma seperated list of email addresses.',
|
||||
variables: true,
|
||||
@@ -52,7 +51,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Bcc',
|
||||
key: 'bcc',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
description: 'Comma seperated list of email addresses.',
|
||||
variables: true,
|
||||
@@ -60,7 +59,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Subject',
|
||||
key: 'subject',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Subject of the email.',
|
||||
variables: true,
|
||||
@@ -68,7 +67,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Body',
|
||||
key: 'body',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Body of the email.',
|
||||
variables: true,
|
||||
@@ -78,14 +77,14 @@ export default defineAction({
|
||||
async run($) {
|
||||
const info = await transporter($).sendMail({
|
||||
from: `${$.step.parameters.fromName} <${$.step.parameters.fromEmail}>`,
|
||||
to: ($.step.parameters.to as string).split(','),
|
||||
replyTo: $.step.parameters.replyTo as string,
|
||||
cc: ($.step.parameters.cc as string).split(','),
|
||||
bcc: ($.step.parameters.bcc as string).split(','),
|
||||
subject: $.step.parameters.subject as string,
|
||||
text: $.step.parameters.body as string,
|
||||
to: $.step.parameters.to.split(','),
|
||||
replyTo: $.step.parameters.replyTo,
|
||||
cc: $.step.parameters.cc.split(','),
|
||||
bcc: $.step.parameters.bcc.split(','),
|
||||
subject: $.step.parameters.subject,
|
||||
text: $.step.parameters.body,
|
||||
});
|
||||
|
||||
$.setActionItem({ raw: info as IJSONObject });
|
||||
$.setActionItem({ raw: info });
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user