-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New Components - mailosaur #16666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
New Components - mailosaur #16666
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
""" WalkthroughThis update introduces a comprehensive Mailosaur integration, adding new polling sources for incoming emails, actions to create, search, and delete emails, and supporting utilities. The Mailosaur app component is refactored to include structured API methods, dynamic property loading, and pagination. Test event fixtures and common constants are also provided. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CreateEmailAction
participant MailosaurApp
participant MailosaurAPI
User->>CreateEmailAction: Trigger create-email
CreateEmailAction->>MailosaurApp: sendEmail({ serverId, to, ... })
MailosaurApp->>MailosaurAPI: POST /messages
MailosaurAPI-->>MailosaurApp: Email creation response
MailosaurApp-->>CreateEmailAction: Response
CreateEmailAction-->>User: Summary and result
sequenceDiagram
participant Source
participant MailosaurApp
participant MailosaurAPI
participant EventStream
Source->>MailosaurApp: listMessages/searchMessages({ serverId, ... })
MailosaurApp->>MailosaurAPI: GET /messages or /messages/search
MailosaurAPI-->>MailosaurApp: List of messages
MailosaurApp-->>Source: Messages
Source->>EventStream: Emit new events for each message
Assessment against linked issues
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
components/scrapeless/scrapeless.app.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure 📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Sources - New Message - New Message Macthing Criteira Actions - Create Email - Search Message - Delete Message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (9)
components/mailosaur/sources/new-message/test-event.mjs (1)
1-16
: Well-structured test event for new message detection.This test event provides appropriate mock data for the new message source. Note that this test fixture is identical to the one in
new-email-matching-criteria/test-event.mjs
.Consider creating a shared test fixture that both source components could import if they'll always use identical test data. This would reduce duplication and make future updates more maintainable.
components/mailosaur/actions/create-email/create-email.mjs (3)
24-28
: Fix spacing in the email exampleThere's an extra space in the email example that should be removed.
- description: "Optionally overrides of the message's `from` address. This **must** be an address ending with `YOUR_SERVER.mailosaur.net`, such as `my-emails @a1bcdef2.mailosaur.net`.", + description: "Optionally overrides of the message's `from` address. This **must** be an address ending with `YOUR_SERVER.mailosaur.net`, such as `[email protected]`.",
34-45
: Consider enhancing documentation for HTML and text objectsThe props for HTML and text are defined as objects with limited description of their expected structure. Consider providing more details or examples to help users understand the expected format.
53-55
: Simplify validation logicThe validation logic can be simplified slightly.
- if ((!!this.send) && (!this.html && !this.text)) { + if (this.send && !this.html && !this.text) { throw new ConfigurationError("Please provide either HTML or plain text content."); }components/mailosaur/mailosaur.app.mjs (3)
23-27
: Label/description typo foremailId
propertyBoth the
label
anddescription
still read “Server ID”, which is misleading for an e-mail selector and will confuse users in the UI.- label: "Server ID", - description: "The identifier of the server from which the email should be sent.", + label: "Email ID", + description: "The identifier of the email to operate on.",
53-61
: Risk of leaking component context via default$
parameter
_makeRequest({ $ = this, … })
passes the whole component instance by default toaxios
, which may inadvertently expose internal props (e.g. secrets) to request/response interceptors. Instead, forward only the$
that Pipedream explicitly injects (this
).-_makeRequest({ $ = this, path, ...opts }) { - return axios($, { +_makeRequest({ $, path, ...opts }) { + // default to the app instance when a `$` context + // isn’t supplied by the caller + const context = $ || this; + return axios(context, {
44-46
: Consider extracting base URL & limit to constantsHard-coding
"https://mailosaur.com/api"
here makes future upgrades painful (e.g., v2 endpoint or regional hosts). You already importLIMIT
from./common/constants.mjs
; doing the same for the base URL will improve maintainability.components/mailosaur/sources/common/base.mjs (2)
50-54
:_setLastDate
assumes API is sorted newest-firstIf the API ever returns results oldest-first,
responseArray[0]
will point to the oldest message, causing duplicates on the next run. Safer to computeMath.max(...receivedTimestamps)
or rely on the first element after sorting.
65-73
: Missing abstractgetFunction
/getSummary
contracts
emitEvent
callsthis.getFunction()
andthis.getSummary(item)
but the base class does not enforce or document these. AddingrequiredMethods
checks or JSDoc will prevent accidental runtime errors in extending sources.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (11)
components/mailosaur/actions/create-email/create-email.mjs
(1 hunks)components/mailosaur/actions/delete-email/delete-email.mjs
(1 hunks)components/mailosaur/actions/search-email/search-email.mjs
(1 hunks)components/mailosaur/common/constants.mjs
(1 hunks)components/mailosaur/mailosaur.app.mjs
(1 hunks)components/mailosaur/package.json
(2 hunks)components/mailosaur/sources/common/base.mjs
(1 hunks)components/mailosaur/sources/new-email-matching-criteria/new-email-matching-criteria.mjs
(1 hunks)components/mailosaur/sources/new-email-matching-criteria/test-event.mjs
(1 hunks)components/mailosaur/sources/new-message/new-message.mjs
(1 hunks)components/mailosaur/sources/new-message/test-event.mjs
(1 hunks)
🔇 Additional comments (10)
components/mailosaur/package.json (1)
3-3
: Package version and dependencies correctly updated.The version bump to 0.1.0 is appropriate for the introduction of new Mailosaur integration components. The added dependency on @pipedream/platform is standard for Pipedream components and properly uses semantic versioning.
Also applies to: 14-16
components/mailosaur/sources/new-email-matching-criteria/test-event.mjs (1)
1-16
: Well-structured test event for email matching criteria.This test event provides a comprehensive mock email object with all the expected fields (id, timestamp, subject, sender/recipient details) that would be needed to test matching criteria functionality. The structure follows Mailosaur's API response format.
components/mailosaur/common/constants.mjs (1)
1-12
: Well-organized constants module.Centralizing the limit value and match options in a common constants file is a good practice. The match options are properly structured with descriptive labels and values for dropdown selection, and the 1000 item limit is a reasonable default for pagination.
components/mailosaur/actions/delete-email/delete-email.mjs (1)
1-37
: Well-structured delete email action with appropriate props and error handling.This action properly imports the Mailosaur app, defines the necessary properties with correct dependencies (emailId depends on serverId), and includes appropriate error handling through the Pipedream context. The success message is clear, and returning the deleted emailId allows for chaining with other actions if needed.
components/mailosaur/sources/new-message/new-message.mjs (1)
1-22
: Implementation looks clean and well-structured!This source component is well implemented with clear naming, proper documentation links, and good separation of concerns. The extension of a common base component promotes code reuse, and the methods are concise and focused.
components/mailosaur/actions/create-email/create-email.mjs (1)
52-73
: Implementation looks good!The validation, error handling, and API interaction are well implemented. The export summary provides clear feedback to the user.
components/mailosaur/actions/search-email/search-email.mjs (1)
1-101
: Component is well-structured with comprehensive search parametersThe search email action provides a comprehensive set of search parameters with clear descriptions and appropriate separation between query parameters and body data in the API call. The export summary is informative.
components/mailosaur/sources/new-email-matching-criteria/new-email-matching-criteria.mjs (2)
1-66
: Component effectively extends base functionality with filtering criteriaThis component nicely extends the common base module with additional filtering capabilities. The implementation is clean and follows consistent patterns with the other Mailosaur components.
15-26
:✅ Verification successful
Check description references to phone numbers
The property descriptions reference "phone number" which seems unusual for an email service. Verify if Mailosaur supports both email and SMS messaging, and adjust the descriptions if necessary.
🌐 Web query:
Does Mailosaur support SMS or phone number messaging in addition to email?
💡 Result:
Yes, Mailosaur fully supports SMS messaging alongside email testing. Mailosaur's platform allows you to test and automate SMS communications with features similar to their email testing capabilities.
SMS Testing Capabilities
Mailosaur provides dedicated test phone numbers that you can use for SMS testing. These numbers are assigned to your servers, allowing you to send SMS messages to them and then retrieve and analyze those messages using the Mailosaur API[3][4]. This enables end-to-end testing of SMS functionality in your applications.
Key SMS Features:
- Dedicated phone numbers for testing that are assigned to your account[9]
- Support for international mobile numbers[4]
- Ability to verify SMS delivery timing[4]
- Testing of identity/account verification codes and one-time passwords (OTPs)[4]
- Validation of promotional text messages[4]
- Automated SMS testing with various frameworks like Cypress, Playwright, Selenium, and Robot Framework[3][6]
- Reply functionality to simulate user responses to SMS messages[5]
How SMS Testing Works
The process for testing SMS messages with Mailosaur is straightforward:
- Request and assign a phone number to one of your Mailosaur servers
- Send SMS messages to that number as you normally would
- Use the Mailosaur API to retrieve and test the content of those messages[3]
The code for retrieving and testing SMS messages is very similar to the approach used for email testing, making it easy to implement if you're already using Mailosaur for email tests[6][7].
Phone Number Availability
Mailosaur offers phone numbers in various countries:
- US, UK, and Canadian numbers are included in standard pricing
- Numbers for other countries (such as France, Germany, and Australia) are available with additional charges
- The Business plan includes 1 number, while the Professional plan includes 5 numbers as standard
- Additional numbers can be added starting from $1 per number per month[9]
This combined approach of handling both email and SMS testing through a single platform is considered one of Mailosaur's key advantages according to user reviews[10].
Citations:
- 1: https://mailosaur.com/contact
- 2: https://mailosaur.com
- 3: https://mailosaur.com/docs/sms-testing
- 4: https://mailosaur.com/sms-testing
- 5: https://mailosaur.com/docs/sms-testing/replying
- 6: https://mailosaur.com/docs/frameworks-and-tools/selenium/sms-testing
- 7: https://github.com/mailosaur/mailosaur-php/blob/main/README.md
- 8: https://mailosaur.com/docs/api/messages
- 9: https://mailosaur.com/docs/sms-testing/phone-numbers
- 10: https://www.g2.com/products/mailosaur/reviews?qs=pros-and-cons
No changes needed for phone number references
Mailosaur supports both email and SMS testing, so keeping “email address or phone number” in these field descriptions is correct.
components/mailosaur/sources/common/base.mjs (1)
45-47
: Date comparison may skip newer items on equal timestamps
break
triggers whenreceived <= lastDate
, so if two messages share the samereceived
value the second one is never emitted. Considercontinue
for equality or store millisecond precision to guarantee monotonicity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a couple minor things.
options: [ | ||
"ALL", | ||
"ANY", | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be options: constants.MATCH_OPTIONS
?
const response = this.mailosaur.paginate({ | ||
fn: this.getFunction(), | ||
receivedAfter: lastDate, | ||
params: { | ||
server: this.serverId, | ||
}, | ||
data: this.getData(), | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think receivedAfter
is meant to go in params
.
const response = this.mailosaur.paginate({ | |
fn: this.getFunction(), | |
receivedAfter: lastDate, | |
params: { | |
server: this.serverId, | |
}, | |
data: this.getData(), | |
}); | |
const response = this.mailosaur.paginate({ | |
fn: this.getFunction(), | |
params: { | |
server: this.serverId, | |
receivedAfter: lastDate, | |
}, | |
data: this.getData(), | |
}); |
Resolves #16655.
Summary by CodeRabbit
New Features
Chores