-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
New Components - bloomerang #16105
New Components - bloomerang #16105
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThe pull request introduces multiple modules to enhance the Bloomerang integration. New actions for adding interactions, creating constituents, and recording donations have been added. The Bloomerang app has been expanded with additional properties and methods for API communication and pagination. In addition, new source modules for polling donation, constituent, and interaction events—including associated test event files—have been implemented. A new constants module and package updates further support these integrations. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User/System
participant A as Action Module
participant API as Bloomerang API
U->>A: Provide action details (e.g., donation data)
A->>API: Call createDonation/createConstituent/addInteraction
API-->>A: Return response with new record ID
A-->>U: Return summary message
sequenceDiagram
participant S as Source Module
participant APP as Bloomerang App
participant DB as Database
S->>APP: Request events (constituents/donations/interactions)
APP-->>S: Return paginated event data
S->>DB: Retrieve last processed ID
alt New events present
S->>DB: Update last processed ID
S-->>U: Emit events with details
else No new events
S-->>U: No events to emit
end
Assessment against linked issues
Suggested reviewers
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/microbilt_developer/microbilt_developer.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 components/adyntel/adyntel.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 components/cvr_dev/cvr_dev.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
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (14)
✅ Files skipped from review due to trivial changes (14)
⏰ Context from checks skipped due to timeout of 90000ms (3)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 Donation - New Constituent - New Interaction Actions - Create Donation - Create Constituent - Add Interaction
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 (10)
components/bloomerang/actions/add-interaction/add-interaction.mjs (2)
28-29
: Fix typos in property descriptionsThere are typos in several property descriptions:
- description: "The subject od the interation", + description: "The subject of the interaction", - description: "The channel of the interation", + description: "The channel of the interaction", - description: "The purpose of the interation", + description: "The purpose of the interaction",Also applies to: 33-34, 39-40
20-24
: Add date format validationThe date property lacks format validation. Consider adding a format pattern to ensure users provide dates in the expected format required by the Bloomerang API.
date: { type: "string", label: "Date", description: "The date of the interaction", + description: "The date of the interaction (YYYY-MM-DD format)", + pattern: "^\\d{4}-\\d{2}-\\d{2}$", },components/bloomerang/sources/new-constituent/new-constituent.mjs (1)
17-19
: Consider adding error handling for potential undefined values.The getSummary method might encounter an undefined FullName property if the API returns unexpected data.
getSummary(item) { - return `New Constituent: ${item.FullName}`; + return `New Constituent: ${item.FullName || "Unknown"}`; },components/bloomerang/sources/new-donation/new-donation.mjs (1)
17-19
: Consider improving the summary message for better readability.The current implementation uses the raw AccountId which may not be user-friendly. Consider adding more context or formatting.
getSummary(item) { - return `New Donation from ${item.AccountId}`; + return `New Donation from Account #${item.AccountId}`; },components/bloomerang/bloomerang.app.mjs (4)
7-83
: Consider adding basic error handling or fallback behavior in prop definitions.
Each of the dynamic dropdown props (constituentId
,fundId
,campaignId
,appealId
) correctly retrieves data from respectivelist*
methods with pagination. Ensure thatResults
always exists in the returned payload. For added resilience, consider handling empty or error responses (e.g., wrapping in a try/catch or verifying attributes before mapping).
86-88
: Hard-coded base URL appears fine.
For typical usage, a fixed URL works. If you need test or staging environments, consider making_baseUrl()
configurable through environment variables.
89-94
: Add 'Content-Type' for POST requests.
Currently,_headers()
omits the"Content-Type": "application/json"
header. Many Bloomerang API endpoints expect JSON bodies, so consider adding it by default to prevent potential parsing issues._headers() { return { "accept": "application/json", "x-api-key": `${this.$auth.api_key}`, + "Content-Type": "application/json", }; },
95-103
: Merge default headers before spreading opts.
If a caller overridesheaders
inopts
, the merged spread likely overwrites_headers()
. Preserving the"x-api-key"
ensures authentication isn’t accidentally dropped._makeRequest({ $ = this, path, ...opts }) { - return axios($, { - url: this._baseUrl() + path, - headers: this._headers(), - ...opts, - }); + const mergedHeaders = { ...this._headers(), ...opts.headers }; + return axios($, { + url: this._baseUrl() + path, + headers: mergedHeaders, + ...opts, + }); }components/bloomerang/actions/create-donation/create-donation.mjs (1)
23-27
: Consider adding amount validationThe amount is currently defined as a string type. Consider adding validation to ensure it contains a valid numeric value or changing the type to "integer" or "number" if appropriate for the Bloomerang API.
components/bloomerang/sources/new-interaction/new-interaction.mjs (1)
14-16
: Consider adding error handling for listInteractions.The
getFunction()
method returnsthis.app.listInteractions
directly, but it might be beneficial to add error handling to gracefully manage potential API failures.getFunction() { - return this.app.listInteractions; + return async (...args) => { + try { + return await this.app.listInteractions(...args); + } catch (error) { + console.error("Error fetching interactions:", error); + throw error; + } + }; },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (13)
components/bloomerang/actions/add-interaction/add-interaction.mjs
(1 hunks)components/bloomerang/actions/create-constituent/create-constituent.mjs
(1 hunks)components/bloomerang/actions/create-donation/create-donation.mjs
(1 hunks)components/bloomerang/bloomerang.app.mjs
(1 hunks)components/bloomerang/common/constants.mjs
(1 hunks)components/bloomerang/package.json
(2 hunks)components/bloomerang/sources/common/base.mjs
(1 hunks)components/bloomerang/sources/new-constituent/new-constituent.mjs
(1 hunks)components/bloomerang/sources/new-constituent/test-event.mjs
(1 hunks)components/bloomerang/sources/new-donation/new-donation.mjs
(1 hunks)components/bloomerang/sources/new-donation/test-event.mjs
(1 hunks)components/bloomerang/sources/new-interaction/new-interaction.mjs
(1 hunks)components/bloomerang/sources/new-interaction/test-event.mjs
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: pnpm publish
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
🔇 Additional comments (22)
components/bloomerang/sources/new-interaction/test-event.mjs (1)
1-50
: LGTM! Good test event structure.The test event correctly models a Bloomerang interaction with all the necessary fields including identification, dates, content details, and audit information.
components/bloomerang/sources/new-constituent/new-constituent.mjs (1)
4-22
: LGTM! Well-structured source component.The component follows the established pattern for source components by extending the common base. The implementation correctly defines the key, name, description, and provides appropriate methods for retrieving constituent data.
components/bloomerang/sources/new-donation/new-donation.mjs (1)
4-22
: LGTM! Well-structured donation source component.The component correctly extends the common base and implements the necessary methods for transaction listing.
components/bloomerang/sources/new-constituent/test-event.mjs (1)
1-152
: LGTM! Comprehensive test event structure.The test event provides a complete model of a Bloomerang constituent with all necessary fields including personal information, contact details, and related metadata.
components/bloomerang/sources/new-donation/test-event.mjs (1)
1-402
: Well-structured test event object for donation source.This test event provides a comprehensive template representing a Bloomerang donation structure with all possible fields and nested objects. The structure captures donations with different designation types (standard donation, pledge, pledge payment, recurring donation, and recurring donation payment).
A few observations:
- The future date "2025-04-02" is used throughout the object, which is fine for test data
- All numeric IDs are set to 0, and strings use the placeholder "string"
- The object includes comprehensive audit trail information and all relevant fields needed for processing donation events
components/bloomerang/sources/common/base.mjs (3)
16-21
: Good database utility methods for tracking processed IDs.The
_getLastId
and_setLastId
methods provide a clean interface for managing the last processed ID in the database, with appropriate defaults.
22-53
: Well-implemented event emission logic with pagination handling.The
emitEvent
method efficiently:
- Retrieves the last processed ID
- Uses pagination to fetch data in descending order by creation date
- Breaks early when encountering already processed items
- Updates the last ID when new items are found
- Emits events in chronological order (oldest first via reverse())
55-62
: Appropriate lifecycle hooks for initial and ongoing event processing.The implementation correctly:
- Emits a limited set of events (25) on initial deployment
- Processes all events during normal scheduled runs
components/bloomerang/actions/create-constituent/create-constituent.mjs (3)
11-127
: Well-designed action with comprehensive constituent properties.The component properly:
- Defines a clear key, name, description, and version
- References documentation for API details
- Includes all necessary fields for constituent creation with appropriate descriptions and options
- Makes optional fields clearly marked
- Uses consistent property patterns throughout
128-134
: Dynamic field visibility based on constituent type.The
additionalProps
method correctly toggles visibility of relevant fields based on whether the constituent is an individual or organization. For individuals, first/last name are shown, while organization name is hidden, and vice versa.
135-161
: Clean API interaction with comprehensive data mapping.The
run
method:
- Properly passes all constituent properties to the API
- Returns the API response
- Exports a clear summary message with the new constituent ID
components/bloomerang/common/constants.mjs (3)
1-91
: Well-organized constants for LIMIT, CHANNEL_OPTIONS, and PURPOSE_OPTIONS.These constants provide centralized values for:
- Pagination limit (50)
- Communication channel options with labels and values
- Purpose options with appropriate labeling
This approach ensures consistency across the integration and improves maintainability.
93-153
: Comprehensive constituent-related option constants.The constants appropriately define:
- Constituent types (Individual, Organization)
- Status options (Active, Inactive, Deceased)
- Extensive list of prefix options
- Suffix options
- Gender options
Having these in a central location promotes consistency and makes updates easier.
155-173
: Well-defined communication and payment method constants.These constants provide:
- Simplified communication channel options
- Comprehensive payment method options
The separation between
CHANNEL_OPTIONS
(which includes label/value pairs) andCOMMUNICATION_CHANNEL_OPTIONS
(simple strings) suggests they're used in different contexts within the application.components/bloomerang/bloomerang.app.mjs (4)
1-2
: Imports look good.
No issues identified with importingaxios
andLIMIT
from separate modules.
104-139
: List methods logic approved.
These methods (listConstituents
,listInteractions
,listTransactions
,listFunds
,listCampaigns
,listAppeals
) cleanly structure GET calls. No concerns with correctness or naming.
140-160
: POST request methods appear correct.
createDonation()
,createConstituent()
, andcreateInteraction()
are straightforward. Just ensure the request bodies are properly formed JSON if required.
161-187
: Pagination logic looks robust.
Yourasync *paginate()
correctly yields items page by page until exhausted or untilmaxResults
is reached. If the API’s response ever omitsResults
, consider gracefully handling that scenario to avoid runtime errors.components/bloomerang/actions/create-donation/create-donation.mjs (2)
1-85
: Well-structured donation creation actionThis action component follows the standard Pipedream pattern with clear prop definitions, documentation links, and a logical implementation flow.
62-80
:✅ Verification successful
Verify app method and API structure
The component relies on
this.bloomerang.createDonation
which should be defined in the Bloomerang app file. Also, the amount is used twice in the request (in both the root object and in the designation). This is likely intentional per Bloomerang's API, but it might be worth verifying.
🏁 Script executed:
#!/bin/bash # Check if the createDonation method is defined in the bloomerang app file grep -r "createDonation" --include="*.mjs" components/bloomerang/ # Also look for any API documentation or comments about donation structure grep -r "donation.*amount" --include="*.mjs" components/bloomerang/Length of output: 334
Verified: Bloomerang Create Donation API Usage is Correct
- The
createDonation
method is correctly defined incomponents/bloomerang/bloomerang.app.mjs
.- The duplication of the
amount
field—once at the root level and once within theDesignations
array—appears to follow Bloomerang's API structure.No changes are necessary at this time.
components/bloomerang/package.json (1)
3-4
: Package updates look good - version bump and proper dependencies added.The version increment from 0.0.1 to 0.1.0 appropriately reflects the significant additions to the Bloomerang component. Adding the @pipedream/platform dependency is necessary for the new source components. The JSON structure is also properly formatted.
Also applies to: 14-17
components/bloomerang/sources/new-interaction/new-interaction.mjs (1)
1-22
: Well-structured source component implementation.The New Interaction source follows the Pipedream component best practices:
- Extends the common base module for code reuse
- Clear naming and descriptive purpose
- Proper versioning starting at 0.0.1
- Appropriate deduplication strategy
- Well-defined methods for fetching and summarizing data
The component effectively leverages the app's
listInteractions
method and provides a clear summary format for new interactions.
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: 2
🧹 Nitpick comments (2)
components/bloomerang/actions/create-constituent/create-constituent.mjs (2)
99-99
: Fix grammar in the description.Replace "An website" with "A website" or "Website" for clarity.
- description: "An website of the constituent", + description: "A website of the constituent",
129-134
: Consider omitting fields for non-Individual constituents.While toggling UI visibility is helpful, consider conditionally excluding hidden fields from the request payload to avoid confusion or potential data conflicts.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
components/bloomerang/actions/create-constituent/create-constituent.mjs
(1 hunks)components/bloomerang/bloomerang.app.mjs
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: pnpm publish
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
🔇 Additional comments (1)
components/bloomerang/bloomerang.app.mjs (1)
168-194
: Pagination logic is concise and practical.No concerns regarding performance or correctness—this approach nicely handles iteration of paginated results.
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: 0
🧹 Nitpick comments (4)
components/bloomerang/bloomerang.app.mjs (4)
65-83
: Consider unifying the repetitive logic in prop definitionsYou can extract shared pagination code (skip/take approach) into a helper or generator for all similar prop definitions to reduce duplication.
86-94
: Use standard header capitalization and consider including Content-TypeAlthough all-lowercase header names work, it's conventional to use
'Accept': 'application/json'
. Also, if you plan to send JSON payloads, adding"Content-Type": "application/json"
ensures correct MIME type handling.
95-103
: Optional: add error handling for more robust requestsWrapping the axios call in a
try/catch
lets you log or manage errors gracefully, providing better clarity on API failures.
104-160
: Consider creating a unified helper for similar list methodsYou could replace functions like
listConstituents
,listInteractions
, etc., with a singlelistResource(path, opts)
to reduce repetition and simplify maintenance.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
components/bloomerang/bloomerang.app.mjs
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: pnpm publish
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
🔇 Additional comments (7)
components/bloomerang/bloomerang.app.mjs (7)
1-2
: No issues found with the initial imports
7-26
: Prop definition forconstituentId
is well-structured
27-45
: Prop definition forfundId
looks correct
46-64
: Prop definition forcampaignId
is properly implemented
65-83
: Prop definition forappealId
is functioning as expected
104-160
: List and create methods appear correct
161-187
: Pagination logic is well-implemented
/approve |
Resolves #16081.
Summary by CodeRabbit
New Features
Chores