-
Notifications
You must be signed in to change notification settings - Fork 5.5k
17699 components rewiser #17771
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
17699 components rewiser #17771
Conversation
Actions - Create Transaction Sources - New Transaction
WalkthroughThis update introduces a new integration for the Rewiser platform, adding the ability to create transactions and detect new transactions via polling. It implements API communication, dynamic property options, utility functions, and test fixtures. The changes include new action and source modules, utility enhancements, and expanded app logic for structured API interactions. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ActionModule as Create Transaction Action
participant App as Rewiser App
participant API as Rewiser API
User->>ActionModule: Provide transaction details
ActionModule->>App: Call createTransaction()
App->>API: POST /transactions (with data)
API-->>App: Response (inserted/errors/duplicates/skipped)
App-->>ActionModule: Response data
ActionModule-->>User: Summary of transaction creation
sequenceDiagram
participant Source as New Transaction Source
participant App as Rewiser App
participant API as Rewiser API
participant DB as Database
Source->>DB: Get last processed timestamp
Source->>App: getRecentTransactions()
App->>API: GET /transactions/recent
API-->>App: List of recent transactions
App-->>Source: Transactions data
Source->>DB: Update last processed timestamp
Source-->>User: Emit new transaction events
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes 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/rewiser/actions/create-transaction/create-transaction.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/rewiser/sources/new-transaction-created/new-transaction-created.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/rewiser/sources/new-transaction-created/test-event.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 ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (6)
✨ Finishing Touches
🧪 Generate unit tests
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 (
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
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: 1
🧹 Nitpick comments (2)
components/rewiser/common/utils.mjs (1)
1-25: Consider adding input validation and handling the undefined case.The function logic is sound, but there are potential edge cases to consider:
- If all arrays are empty or undefined, the function returns
undefinedwhich may not be the desired behavior- The function doesn't validate that the input parameters are actually arrays
Consider this improvement:
export const getSummary = ({ inserted, errors, duplicates, skipped, }) => { + // Ensure all inputs are arrays + const safeArrays = { + inserted: Array.isArray(inserted) ? inserted : [], + errors: Array.isArray(errors) ? errors : [], + duplicates: Array.isArray(duplicates) ? duplicates : [], + skipped: Array.isArray(skipped) ? skipped : [], + }; + - const actions = { - inserted, - errors, - duplicates, - skipped, - }; + const actions = safeArrays; const [ action, - ] = Object.keys(actions).filter((key) => actions[key].length > 0); + ] = Object.keys(actions).filter((key) => actions[key].length > 0); switch (action) { case "inserted": return "Inserted transaction"; case "errors": return "Transaction creation failed"; case "duplicates": return "Transaction creation duplicate"; case "skipped": return "Transaction creation skipped"; + default: + return "No action taken"; } };components/rewiser/actions/create-transaction/create-transaction.mjs (1)
38-46: Consider improving the planned date description.The current description could be clearer about whether time components are supported or just dates.
plannedDate: { type: "string", label: "Planned Date", - description: "The planned date for the transaction Format: YYYY-MM-DD. E.g. 2025-01-01", + description: "The planned date for the transaction. Format: YYYY-MM-DD (e.g., 2025-01-01) or YYYY-MM-DDTHH:mm:ss.sssZ for full datetime.", },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (6)
components/rewiser/actions/create-transaction/create-transaction.mjs(1 hunks)components/rewiser/common/utils.mjs(1 hunks)components/rewiser/package.json(2 hunks)components/rewiser/rewiser.app.mjs(1 hunks)components/rewiser/sources/new-transaction/new-transaction.mjs(1 hunks)components/rewiser/sources/new-transaction/test-event.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (6)
components/rewiser/package.json (2)
Learnt from: jcortes
PR: #14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like fs to package.json dependencies, as they are native modules provided by the Node.js runtime.
Learnt from: js07
PR: #17375
File: components/zerobounce/actions/get-validation-results-file/get-validation-results-file.mjs:23-27
Timestamp: 2025-07-01T17:07:48.193Z
Learning: "dir" props in Pipedream components are hidden in the component form and not user-facing, so they don't require labels or descriptions for user clarity.
components/rewiser/sources/new-transaction/test-event.mjs (1)
Learnt from: GTFalcao
PR: #14265
File: components/the_magic_drip/sources/common.mjs:35-43
Timestamp: 2024-10-10T19:18:27.998Z
Learning: In components/the_magic_drip/sources/common.mjs, when processing items in getAndProcessData, savedIds is intentionally updated with IDs of both emitted and non-emitted items to avoid emitting retroactive events upon first deployment and ensure only new events are emitted as they occur.
components/rewiser/common/utils.mjs (2)
Learnt from: GTFalcao
PR: #12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the run method of an action, ensure the message is correctly formatted. For example, in the hackerone-get-members action, the correct format is Successfully retrieved ${response.data.length} members.
Learnt from: GTFalcao
PR: #12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the run method of an action, ensure the message is correctly formatted. For example, in the hackerone-get-members action, the correct format is Successfully retrieved ${response.data.length} members.
components/rewiser/actions/create-transaction/create-transaction.mjs (3)
Learnt from: jcortes
PR: #14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In components/gainsight_px/actions/create-account/create-account.mjs, the action name should be "Create Account" instead of "Create Memory".
Learnt from: GTFalcao
PR: #12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the run method of an action, ensure the message is correctly formatted. For example, in the hackerone-get-members action, the correct format is Successfully retrieved ${response.data.length} members.
Learnt from: GTFalcao
PR: #12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the run method of an action, ensure the message is correctly formatted. For example, in the hackerone-get-members action, the correct format is Successfully retrieved ${response.data.length} members.
components/rewiser/sources/new-transaction/new-transaction.mjs (3)
Learnt from: GTFalcao
PR: #14265
File: components/the_magic_drip/sources/common.mjs:35-43
Timestamp: 2024-10-10T19:18:27.998Z
Learning: In components/the_magic_drip/sources/common.mjs, when processing items in getAndProcessData, savedIds is intentionally updated with IDs of both emitted and non-emitted items to avoid emitting retroactive events upon first deployment and ensure only new events are emitted as they occur.
Learnt from: GTFalcao
PR: #15376
File: components/monday/sources/name-updated/name-updated.mjs:6-6
Timestamp: 2025-01-23T03:55:15.166Z
Learning: Source names in Monday.com components don't need to start with "New" if they emit events for updated items (e.g., "Name Updated", "Column Value Updated") rather than new items. This follows the component guidelines exception where the "New" prefix is only required when emits are limited to new items.
Learnt from: GTFalcao
PR: #12697
File: components/salesforce_rest_api/sources/common.mjs:97-98
Timestamp: 2024-07-24T02:05:59.531Z
Learning: The processTimerEvent method in the components/salesforce_rest_api/sources/common.mjs file is intentionally left unimplemented to enforce that subclasses must implement this method, similar to an abstract class in object-oriented programming.
components/rewiser/rewiser.app.mjs (1)
Learnt from: GTFalcao
PR: #16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: In the Salesloft API integration (components/salesloft/salesloft.app.mjs), the _makeRequest method returns response.data which directly contains arrays for list endpoints like listPeople, listCadences, listUsers, and listAccounts. The propDefinitions correctly call .map() directly on these responses without needing to destructure a nested data property.
🧬 Code Graph Analysis (1)
components/rewiser/actions/create-transaction/create-transaction.mjs (1)
components/rewiser/common/utils.mjs (2)
getSummary(1-25)getSummary(1-25)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
- GitHub Check: Lint Code Base
- GitHub Check: pnpm publish
🔇 Additional comments (17)
components/rewiser/package.json (2)
3-3: LGTM! Version bump is appropriate.The version update from "0.0.1" to "0.1.0" correctly reflects the addition of new functional components (action, source, utilities).
15-17: Platform dependency addition is correct.The "@pipedream/platform" dependency is properly added and necessary for the new components that use platform features like DEFAULT_POLLING_SOURCE_TIMER_INTERVAL.
components/rewiser/sources/new-transaction/test-event.mjs (1)
1-11: LGTM! Well-structured test event data.The sample transaction object includes all necessary fields with appropriate data types and realistic values. This will provide good test coverage for the source component.
components/rewiser/actions/create-transaction/create-transaction.mjs (2)
1-11: LGTM! Clean imports and component structure.The component structure follows Pipedream conventions with appropriate imports and well-defined metadata.
85-106: LGTM! Well-structured run method.The API call structure and response handling follow good practices. The use of the getSummary utility provides consistent response formatting.
components/rewiser/sources/new-transaction/new-transaction.mjs (6)
1-4: LGTM! Proper imports and dependencies.Good use of the platform constant for consistent polling intervals and appropriate component imports.
21-25: Helpful user information.The alert provides valuable context about API limitations that users should be aware of.
27-33: LGTM! Clean database helper methods.The getter/setter methods for lastDate are simple and effective, with a sensible default fallback.
51-57: LGTM! Proper event emission with chronological ordering.Good practice reversing the array to emit events in chronological order and using appropriate event metadata structure.
59-59: LGTM! Sample emit inclusion.Proper inclusion of sample event data for testing and documentation purposes.
40-45: Verify getRecentTransactions ordering
The loop inrun()assumes thetransactionsarray is sorted bycreated_atdescending (newest first) so that hitting an older date safely breaks out. If the API doesn’t guarantee that order, this logic can skip newer records. Please confirm or adjust:
- File: components/rewiser/sources/new-transaction/new-transaction.mjs
- Method:
async run()- Location: the
for (const transaction of transactions)loop (around lines 40–45)If the API isn’t guaranteed to return descending data, sort
transactionsbycreated_atdescending before iterating.components/rewiser/rewiser.app.mjs (6)
1-5: LGTM! Proper import and app structure.The axios import and basic app configuration follow Pipedream's standard patterns correctly.
24-26: LGTM! Proper base URL configuration.The base URL is correctly configured with HTTPS and follows the expected Supabase Edge Functions pattern.
27-32: LGTM! Proper authentication and headers.The headers method correctly implements Bearer token authentication and sets appropriate content-type for JSON APIs.
33-41: LGTM! Well-structured generic request method.The
_makeRequestmethod follows Pipedream best practices by centralizing HTTP request logic and properly combining base URL, headers, and additional options.
42-60: AligncreateTransactionwith its plural endpoint and verify response shape.There’s a mismatch between the method name and the endpoint path—it’s called
createTransaction(singular) but hits/create_multiple_transactions. Please confirm the API’s behavior and update accordingly:• In
components/rewiser/rewiser.app.mjs:
– RenamecreateTransaction(opts = {})tocreateTransactions(opts = {})(or alias it) to match/create_multiple_transactions.
– Update thepathor method name if the endpoint actually only creates a single transaction.• In
components/rewiser/actions/create-transaction/create-transaction.mjs:
– Change calls fromthis.rewiser.createTransactiontothis.rewiser.createTransactions.
– Verify thatresponse.datareturns an array of created transactions (or adjust return logic for a single object if that’s what the API returns).• In
components/rewiser/sources/new-transaction/new-transaction.mjs:
– Ensure any downstream handling of the create action matches the confirmed response structure.Please confirm the endpoint’s payload and response format and adjust method naming and return values to keep the codebase consistent.
6-22: Verify get-folders API response structure
Please confirm thatlistFolders()returns an array of objects withkeyandlabelproperties so that this mapping works as expected:
- File: components/rewiser/rewiser.app.mjs, lines 12–16
return folders.map(({ key: value, label }) => ({ label, value }));If the API wraps the array in another property or uses different field names, update the destructuring accordingly.
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.
LGTM! Just one minor text suggestion that doesn't impact functionality
components/rewiser/actions/create-transaction/create-transaction.mjs
Outdated
Show resolved
Hide resolved
…on.mjs Co-authored-by: Guilherme Falcão <[email protected]>
- Implemented a new source that emits events when a new transaction is created in Rewiser. - Added methods to manage the last processed transaction date and emit new transactions. - Included a sample event for testing purposes.
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: 1
♻️ Duplicate comments (1)
components/rewiser/actions/create-transaction/create-transaction.mjs (1)
94-94: Add error handling for amount parsing.The
parseFloat()call could fail silently or produceNaNif the amount string is invalid, which needs proper error handling to prevent silent failures.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
components/rewiser/actions/create-transaction/create-transaction.mjs(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
components/rewiser/actions/create-transaction/create-transaction.mjs (1)
components/rewiser/common/utils.mjs (2)
getSummary(1-25)getSummary(1-25)
🪛 Biome (2.1.2)
components/rewiser/actions/create-transaction/create-transaction.mjs
[error] 46-46: expected , but instead found )
Remove )
(parse)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: pnpm publish
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (3)
components/rewiser/actions/create-transaction/create-transaction.mjs (3)
1-2: LGTM!The import statements are properly structured and import the necessary dependencies.
4-9: LGTM!The action metadata follows Pipedream conventions with proper key naming, clear description, and appropriate documentation link.
85-93: LGTM!The run method implementation follows good patterns with proper async handling, correct data structure mapping, and appropriate use of utility functions for response processing.
Also applies to: 95-106
components/rewiser/actions/create-transaction/create-transaction.mjs
Outdated
Show resolved
Hide resolved
…on.mjs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
/approve |
Resolves #17699
Summary by CodeRabbit
New Features
Improvements
Chores