feat: add smtp action#49
Open
nicosammito wants to merge 2 commits into
Open
Conversation
GitLab Pipeline ActionGeneral informationLink to pipeline: https://gitlab.com/code0-tech/development/centaurus/-/pipelines/2702802134 Status: Failed Job summariesdocs:previewDocumentation preview available at https://code0-tech.gitlab.io/-/development/telescopium/-/jobs/15516078817/artifacts/out/index.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an SMTP action so Hercules flows can send transactional and notification emails (with attachments) through any SMTP server. Implements issue #20, mirroring the existing actions' conventions — specifically the function-only shape of the
gls-actionand the official-SDK +helpers.tspattern of thetwilio-action.SDK / schema source (rule 1)
Uses nodemailer
^6.9, the de-facto standard SMTP client for Node.js, for all mail logic (transport creation,sendMail, attachment handling) rather than hand-rolling SMTP. TheSMTP_SEND_RESULTdata type is modeled directly on nodemailer'sSentMessageInfo, andSMTP_ATTACHMENTon nodemailer's attachment object. Every value returned to a flow is validated withzod.parse()before being handed back.Functions (3)
sendEmail(To, Subject, Text, Html?, From?, Cc?, Bcc?, ReplyTo?): SMTP_SEND_RESULTsendEmailWithAttachments(To, Subject, Text, Attachments, Html?, From?, Cc?, Bcc?): SMTP_SEND_RESULTcreateAttachment(Filename, Content, ContentType?, Encoding?): SMTP_ATTACHMENT— util builder (mirrors GLScreate*utils)To/Cc/Bccaccept comma-separated address lists. Errors are wrapped inRuntimeErrorwith stable codes (MISSING_SMTP_HOST,INVALID_SMTP_PORT,MISSING_SMTP_SENDER,ERROR_SENDING_EMAIL).Data types (3)
SMTP_SEND_RESULT,SMTP_ENVELOPE,SMTP_ATTACHMENT— one zod schema per file with@Identifier/@Name/@Schemadecorators.Triggers
None. SMTP is a send-only protocol, so — like
gls-action— this action registers no events. (Inbound mail would require IMAP/POP3 and is out of scope for this issue.)Config
host(required),port(default587),secure(defaultfalse),username,password,from_address— allTEXTConfigurationDefinitions on theAction, following the GLS/Twilio pattern. No provider-specific ENV vars beyond the sharedHERCULES_*are required.Registration
smtp-actionto the.node-actionslist in.gitlab-ci.yml.README.md.README.mddocumenting config, functions, data types, and provider setup (Gmail app passwords, port/secure pairing, etc.).Validation
Run in
actions/smtp-action/:npm install— OK (188 packages)npm run typecheck— ✅ PASS (0 errors; typechecks against the realnodemailer/@types/nodemailertypes)npm run build— ✅ PASS (dist/index.js, 19.91 kB)npm run test— ✅ PASS (4/4 vitest specs)Notes / choices (autonomous run)
@types/nodemailerwas added todevDependencies(nodemailer ships no bundled types). This is a small, necessary deviation from the otherwise-identical devDependency set.package-lock.jsonis not included in this commit (too large to include via the automation). The CItest-nodejob runsnpm ci, which requires it — please runnpm installinactions/smtp-action/and commit the lockfile before merge. TheDockerfileusesnpm install, so the image build is unaffected.Closes #20