-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Sage Accounting new components #17575
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?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughA comprehensive Sage Accounting integration was introduced, including new action modules for creating and updating contacts, products, and contact payments, as well as polling sources for new contact payments, products, and services. Supporting utility and constants modules were added, and the main app file was extensively expanded to provide prop definitions and API methods for CRUD operations and paginated resource listing. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Action
participant SageAccountingApp
participant SageAPI
User->>Action: Trigger (e.g., Create Product)
Action->>SageAccountingApp: Call createProduct({props})
SageAccountingApp->>SageAPI: POST /products (with data)
SageAPI-->>SageAccountingApp: Response (product info)
SageAccountingApp-->>Action: Return API response
Action-->>User: Output summary and response
sequenceDiagram
participant PollingSource
participant SageAccountingApp
participant SageAPI
participant EventSystem
PollingSource->>SageAccountingApp: listProducts / listServices / listContactPayments
SageAccountingApp->>SageAPI: GET /products|/services|/contact_payments
SageAPI-->>SageAccountingApp: Response (items)
SageAccountingApp-->>PollingSource: Return items
PollingSource->>EventSystem: Emit new event(s) for unseen items
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/sage_accounting/sources/new-contact-payment-created/new-contact-payment-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/sage_accounting/sources/new-service-created/new-service-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/sage_accounting/sources/new-product-created/new-product-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 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
⏰ 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)
✨ 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 (
|
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 (1)
components/sage_accounting/actions/create-contact-payment/create-contact-payment.mjs (1)
116-116
: Consider null safety for totalAmount parsing.The
totalAmount
field usesparseFloat
directly without null checking, which could cause issues if the value is null or undefined. Other similar fields useoptionalParseFloat
for safety.Consider applying this diff for consistency:
- total_amount: parseFloat(this.totalAmount), + total_amount: optionalParseFloat(this.totalAmount),Or ensure that
totalAmount
is always required and cannot be null in the prop definition.
📜 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/sage_accounting/actions/create-contact-payment/create-contact-payment.mjs
(1 hunks)components/sage_accounting/actions/create-contact/create-contact.mjs
(1 hunks)components/sage_accounting/actions/create-product/create-product.mjs
(1 hunks)components/sage_accounting/actions/get-ledger-accounts/get-ledger-accounts.mjs
(1 hunks)components/sage_accounting/actions/update-contact/update-contact.mjs
(1 hunks)components/sage_accounting/common/constants.mjs
(1 hunks)components/sage_accounting/common/utils.mjs
(1 hunks)components/sage_accounting/package.json
(2 hunks)components/sage_accounting/sage_accounting.app.mjs
(1 hunks)components/sage_accounting/sources/common/polling.mjs
(1 hunks)components/sage_accounting/sources/new-contact-payment-created/new-contact-payment-created.mjs
(1 hunks)components/sage_accounting/sources/new-product-created/new-product-created.mjs
(1 hunks)components/sage_accounting/sources/new-service-created/new-service-created.mjs
(1 hunks)
🧰 Additional context used
🧠 Learnings (11)
components/sage_accounting/package.json (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#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.
components/sage_accounting/actions/get-ledger-accounts/get-ledger-accounts.mjs (3)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#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: PipedreamHQ/pipedream#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`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#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`.
components/sage_accounting/sources/common/polling.mjs (2)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#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: PipedreamHQ/pipedream#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/sage_accounting/sources/new-service-created/new-service-created.mjs (2)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-10-08T15:33:38.240Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
components/sage_accounting/sources/new-contact-payment-created/new-contact-payment-created.mjs (2)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-10-08T15:33:38.240Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
components/sage_accounting/sources/new-product-created/new-product-created.mjs (5)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#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: PipedreamHQ/pipedream#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: PipedreamHQ/pipedream#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.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-10-08T15:33:38.240Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
components/sage_accounting/actions/create-contact-payment/create-contact-payment.mjs (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#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".
components/sage_accounting/actions/update-contact/update-contact.mjs (3)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#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: PipedreamHQ/pipedream#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: PipedreamHQ/pipedream#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/sage_accounting/actions/create-product/create-product.mjs (3)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#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: PipedreamHQ/pipedream#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`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#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`.
components/sage_accounting/actions/create-contact/create-contact.mjs (3)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#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: PipedreamHQ/pipedream#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: PipedreamHQ/pipedream#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/sage_accounting/sage_accounting.app.mjs (2)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#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.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: The Salesloft API list endpoints (listPeople, listCadences, listUsers, listAccounts) return arrays directly in the response body, not wrapped in a metadata object with a nested data property. The _makeRequest method correctly returns response.data which contains the arrays that can be mapped over directly in propDefinitions.
⏰ 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: Lint Code Base
- GitHub Check: Verify TypeScript components
🔇 Additional comments (24)
components/sage_accounting/package.json (2)
3-3
: LGTM: Appropriate version bump for new features.The version increment from 0.0.1 to 0.1.0 follows semantic versioning correctly for the addition of new Sage Accounting integration features.
15-17
: LGTM: Valid dependency addition.The @pipedream/platform dependency is correctly added to support the new integration components and follows the established pattern for Pipedream component dependencies.
components/sage_accounting/common/utils.mjs (1)
1-5
: LGTM: Clean utility function implementation.The function correctly handles conditional parsing of string values to floats while preserving non-string inputs unchanged. The implementation is straightforward and type-safe.
components/sage_accounting/common/constants.mjs (2)
1-26
: LGTM: Well-structured credit terms options.The credit terms options provide comprehensive coverage of business scenarios with clear labels and consistent snake_case values. The structure follows standard label/value pair conventions.
28-53
: LGTM: Proper locale options with standard codes.The locale options use correct ISO language-country codes (en-US, fr-FR, etc.) and cover major languages. The structure is consistent with the credit terms options.
components/sage_accounting/actions/get-ledger-accounts/get-ledger-accounts.mjs (2)
1-34
: LGTM: Well-structured action with proper pagination.The action follows Pipedream conventions with appropriate prop definitions, pagination constraints, and propDefinition usage for consistency across the integration.
35-52
: LGTM: Correct API call and summary formatting.The implementation correctly maps camelCase props to snake_case API parameters and follows the established pattern for summary messages with proper pluralization.
components/sage_accounting/sources/common/polling.mjs (3)
1-14
: LGTM: Proper polling source setup.The component correctly imports platform constants and sets up the required props for a polling source with database persistence and timer interface.
15-45
: LGTM: Robust incremental polling implementation.The polling logic correctly handles deduplication by tracking processed IDs, limits storage growth by capping at 100 IDs, and provides proper maxItems handling for both deploy and run scenarios.
46-55
: LGTM: Proper lifecycle methods implementation.The run method enables unlimited polling while the deploy hook appropriately limits initial emission to 5 items, preventing overwhelming users on first deployment.
components/sage_accounting/actions/create-contact-payment/create-contact-payment.mjs (1)
1-139
: Well-structured action with comprehensive prop definitions.The action follows good patterns with:
- Proper import statements and metadata
- Comprehensive prop definitions using the app's propDefinition pattern
- Consistent snake_case API payload structure
- Clear success message with response ID
- Proper error handling context with
$
components/sage_accounting/sources/new-service-created/new-service-created.mjs (1)
1-37
: Well-implemented polling source with proper fallbacks.The source follows excellent patterns:
- Properly extends the common polling module
- Implements all required methods with appropriate fallbacks
- Uses
Date.parse(service.created_at) || Date.now()
for timestamp safety- Provides meaningful fallbacks in
getItemSummary
(description → displayed_as → id)- Implements pagination with reasonable page size (100 items)
- Uses
unique
deduplication strategy appropriatelycomponents/sage_accounting/sources/new-contact-payment-created/new-contact-payment-created.mjs (2)
25-28
: Excellent handling of nested objects and fallbacks.The
getItemSummary
method demonstrates good defensive programming:
- Safely accesses nested
contact
object with optional chaining- Provides multiple fallback options for contact name
- Handles cases where amount fields might be missing
- Creates meaningful summary combining contact and amount information
1-39
: Consistent and robust polling source implementation.The source follows the same excellent patterns as other sources in this PR, with proper extension of the common polling module, appropriate fallbacks, and consistent API usage.
components/sage_accounting/sources/new-product-created/new-product-created.mjs (1)
1-37
: Consistent implementation following established patterns.The source maintains excellent consistency with other sources in this PR:
- Proper extension of common polling module
- Standard
generateMeta
implementation with timestamp fallback- Appropriate fallbacks in
getItemSummary
(description → displayed_as → id)- Correct API method call with pagination
- Maintains the same code structure and patterns
components/sage_accounting/actions/create-contact/create-contact.mjs (2)
119-140
: Good pattern for reusing prop definitions with custom labels.The reuse of
ledgerAccountId
prop definition with custom labels and descriptions for different use cases (sales vs purchase ledger accounts) demonstrates good code reuse while maintaining clarity.
142-175
: Robust contact creation with comprehensive field mapping.The implementation demonstrates excellent practices:
- Comprehensive data structure covering all contact fields
- Proper snake_case field naming for API compatibility
- Meaningful success message with fallbacks (
response.name || response.displayed_as
)- Proper error handling context with
$
- Clean separation of concerns with all logic in the run method
components/sage_accounting/actions/update-contact/update-contact.mjs (2)
11-149
: Well-structured props implementation!The props are properly defined using propDefinitions for consistency, and the optional nature of most fields is appropriate for an update operation.
150-184
: Excellent implementation of the update logic!The run method correctly structures the data payload, properly maps fields to snake_case, and follows best practices for summary messages with appropriate fallback.
components/sage_accounting/actions/create-product/create-product.mjs (3)
52-82
: Clarify if tax rate fields are requiredThe
salesTaxRateId
andpurchaseTaxRateId
props don't explicitly specifyoptional: true
oroptional: false
. Since Pipedream props are optional by default, these will be treated as optional. Please verify if these fields are required by the Sage API and addoptional: false
if needed.
124-150
: Clean implementation of product creation!The run method properly structures the request payload and follows best practices for summary messages.
83-88
: Confirm costPrice as stringVerification against the Sage Accounting API docs shows that
cost_price
must be provided as a string (e.g."100.00"
) to preserve precision. No change is needed—the current definition is correct.components/sage_accounting/sage_accounting.app.mjs (2)
9-338
: Comprehensive and well-structured prop definitions!The propDefinitions provide excellent user experience with dynamic option loading, proper validation constraints, and clear descriptions. The consistent use of pagination in async options is a best practice.
368-506
: Well-organized API methods with consistent patterns!The API methods follow a clean and consistent structure. The use of
_paginatedRequest
for all list operations ensures uniform pagination handling, and the filteredlistSuppliers
method is a nice convenience helper.
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.
Hi @GTFalcao lgtm! Ready for QA!
Closes #17279
Summary by CodeRabbit
New Features
Chores