feat: add smtp action - #49
Open
nicosammito wants to merge 85 commits into
Open
nicosammito wants to merge 85 commits into
nicosammito wants to merge 85 commits into
Conversation
Introduce a new stripe-action to the monorepo following the existing Hercules action conventions (see gls-action, shopify-action). v1 scope (payments core): - Functions: createCustomer, createPaymentIntent, retrievePaymentIntent, createRefund - Events: payment_intent.succeeded, charge.refunded (generic Rest webhook receiver, same pattern as shopify/woocommerce) - Data types: STRIPE_CUSTOMER, STRIPE_PAYMENT_INTENT, STRIPE_REFUND plus the two webhook payload types - Config: secret_key, api_version (optional), webhook_secret (optional) All Stripe API calls go through the official `stripe` Node.js SDK via a cached client in helpers.ts. Registers the action in .gitlab-ci.yml's .node-actions matrix and adds it to the README actions table. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QuCVuBVi48HKcY6E8okUD9
`typescript` is not a field on Stripe.StripeConfig; drop it from the client options in helpers.ts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QuCVuBVi48HKcY6E8okUD9
The webhook payload files declared both an `export type` and an `export class` with the same name (StripePaymentIntentSucceededWebhookPayload and StripeChargeRefundedWebhookPayload), which triggers TS2300 "Duplicate identifier". A class already introduces a type, so the alias collides. The alias was unused (events reference the name via the @Signature string and index.ts imports the class), so remove it, matching the woocommerce/shopify webhook payload convention. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QuCVuBVi48HKcY6E8okUD9
Set up the openapi-zod-client pipeline used by woocommerce-action and shopware-action so the Stripe data type schemas can be generated from Stripe's official OpenAPI spec instead of maintained by hand: - generate:stripe-schemas npm script (download spec3.sdk.json -> filter -> openapi-zod-client -> patch) - scripts/filterStripeSpec.mjs reduces the ~6MB spec to the resources the action exposes (customer, payment_intent, refund, charge), stubbing foreign $refs to keep the generator tractable - scripts/patchGeneratedSchemas.mjs applies the zod v4 record + z.lazy fix-ups - openapi-zod-client devDependency - README documents how to run generation and switch data types over The hand-written schemas remain the active source until the generator is run in an environment with network access to registry.npmjs.org and the spec host, so the build stays green in the meantime. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QuCVuBVi48HKcY6E8okUD9
Wire the @Schema data types to the zod schemas generated from Stripe's official OpenAPI spec (src/generated/stripe-schemas.ts) instead of the hand-written ones, matching the twilio-action pattern: - STRIPE_CUSTOMER -> schemas.customer - STRIPE_PAYMENT_INTENT-> schemas.payment_intent - STRIPE_REFUND -> schemas.refund - charge.refunded webhook data.object -> schemas.charge The payment_intent.succeeded webhook wraps StripePaymentIntentSchema, which now resolves to schemas.payment_intent, so it uses the generated type too. README updated to describe the schemas as generated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QuCVuBVi48HKcY6E8okUD9
… package-lock.json with new peer dependencies
GitLab Pipeline ActionGeneral informationLink to pipeline: https://gitlab.com/code0-tech/development/centaurus/-/pipelines/2848028992 Status: Passed Job summariesdocs:previewDocumentation preview available at https://code0-tech.gitlab.io/-/development/telescopium/-/jobs/16491779670/artifacts/out/index.html |
…rences and improve type safety
…d naming consistency
cron action
rest action
Signed-off-by: Raphael Götz <52959657+raphael-goetz@users.noreply.github.com>
Update manifest.json
updated hercules & tucana
Co-authored-by: Niklas van Schrick <mc.taucher2003@gmail.com> Signed-off-by: Raphael Götz <52959657+raphael-goetz@users.noreply.github.com>
improve pipeline
enhance rest action
enhance rest action
raphael-goetz
self-requested a review
September 11, 2026 18:12
Member
|
@nicosammito @MarlonLange lets make a meeting for the review of this RP. We should get this merged asap |
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