-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Quickbooks - New Triggers #14840
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
Quickbooks - New Triggers #14840
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThe changes in this pull request involve the introduction of new modules for handling employee-related events in QuickBooks, specifically for new employee creation and updates. Additionally, a new utility function has been added to adjust property definitions, and a new package for the QuickBooks sandbox has been created. The version of an existing package has also been updated. These changes collectively enhance the functionality related to employee management within the QuickBooks application. Changes
Assessment against linked issues
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 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 (
|
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
🧹 Outside diff range and nitpick comments (5)
components/quickbooks_sandbox/sources/new-employee-created/new-employee-created.mjs (1)
13-14
: Consider starting with version 0.1.0For new components, it's recommended to start with version 0.1.0 following semantic versioning principles, where:
- 0.x.x indicates unstable/beta API
- x.0.0 indicates breaking changes
- x.x.0 indicates new features
- x.x.x indicates patches
components/quickbooks_sandbox/sources/new-employee-updated/new-employee-updated.mjs (2)
1-4
: Consider creating a shared base for employee triggersThe implementation is very similar to
new-employee-created
. Consider extracting the common setup into a shared base module to reduce duplication.+// components/quickbooks_sandbox/sources/common/employee-base.mjs +import { adjustPropDefinitions } from "../../common/utils.mjs"; + +export const createEmployeeSource = (sourceCommon, key) => { + const { name, description, type, ...others } = sourceCommon; + const props = adjustPropDefinitions(others.props, app); + + return { + ...others, + key, + version: "0.1.0", + name, + description, + type, + props: { + quickbooks: app, + ...props, + }, + }; +};Then both triggers could be simplified to:
-import app from "../../quickbooks_sandbox.app.mjs"; -import common from "../../../quickbooks/sources/new-employee-updated/new-employee-updated.mjs"; -import { adjustPropDefinitions } from "../../common/utils.mjs"; - -const { name, description, type, ...others } = common; -const props = adjustPropDefinitions(others.props, app); - -export default { - ...others, - key: "quickbooks_sandbox-new-employee-updated", - version: "0.0.1", - name, - description, - type, - props: { - quickbooks: app, - ...props, - }, -}; +import { createEmployeeSource } from "../common/employee-base.mjs"; +import common from "../../../quickbooks/sources/new-employee-updated/new-employee-updated.mjs"; + +export default createEmployeeSource(common, "quickbooks_sandbox-new-employee-updated");
13-14
: Maintain version consistency across related componentsThe version should be consistent with the
new-employee-created
component since they're part of the same feature set.components/quickbooks/sources/new-employee-created/new-employee-created.mjs (1)
23-25
: Enhance employee summary informationThe current summary only includes the employee ID, which might not be very user-friendly.
Consider including more meaningful information:
- return `New Employee: ${item.Id}`; + return `New Employee: ${item.DisplayName || item.Id}`;components/quickbooks/sources/new-employee-updated/new-employee-updated.mjs (1)
1-28
: Consider implementing change detectionThe current implementation triggers on any update, which might lead to unnecessary events.
Consider adding logic to detect meaningful changes and only emit events when relevant fields are modified. This could help reduce noise in the event stream.
Would you like me to provide an example implementation of change detection logic?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (10)
components/quickbooks/package.json
(1 hunks)components/quickbooks/sources/new-employee-created/new-employee-created.mjs
(1 hunks)components/quickbooks/sources/new-employee-created/test-event.mjs
(1 hunks)components/quickbooks/sources/new-employee-updated/new-employee-updated.mjs
(1 hunks)components/quickbooks/sources/new-employee-updated/test-event.mjs
(1 hunks)components/quickbooks_sandbox/common/utils.mjs
(1 hunks)components/quickbooks_sandbox/package.json
(1 hunks)components/quickbooks_sandbox/quickbooks_sandbox.app.mjs
(1 hunks)components/quickbooks_sandbox/sources/new-employee-created/new-employee-created.mjs
(1 hunks)components/quickbooks_sandbox/sources/new-employee-updated/new-employee-updated.mjs
(1 hunks)
✅ Files skipped from review due to trivial changes (4)
- components/quickbooks/package.json
- components/quickbooks/sources/new-employee-updated/test-event.mjs
- components/quickbooks/sources/new-employee-created/test-event.mjs
- components/quickbooks_sandbox/package.json
🔇 Additional comments (6)
components/quickbooks_sandbox/quickbooks_sandbox.app.mjs (2)
8-10
: LGTM: Sandbox API endpoint correctly configured
The sandbox API endpoint is properly configured to use the QuickBooks sandbox environment.
1-1
: Verify common methods compatibility with sandbox environment
While reusing common methods is good practice, we should ensure all inherited methods work correctly with the sandbox API endpoint.
Also applies to: 7-7
✅ Verification successful
Methods are compatible with sandbox environment
The sandbox app correctly inherits all methods from the main QuickBooks app and only overrides the _apiUrl()
method to point to the sandbox endpoint. All other methods remain unchanged and will work correctly with the sandbox environment since they:
- Use the overridden
_apiUrl()
method for all API calls - Handle authentication and company ID consistently
- Maintain the same API version (v3) and endpoint structure
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any sandbox-specific method overrides that might be needed
rg -t js -t mjs "methods\." ../quickbooks/quickbooks.app.mjs
Length of output: 90
Script:
#!/bin/bash
# Search for method definitions in both files
rg -t javascript "methods?\." components/quickbooks/quickbooks.app.mjs
rg -t javascript "methods?\." components/quickbooks_sandbox/quickbooks_sandbox.app.mjs
# Get the content of both files to analyze inheritance and method usage
cat components/quickbooks/quickbooks.app.mjs
cat components/quickbooks_sandbox/quickbooks_sandbox.app.mjs
Length of output: 18887
components/quickbooks_sandbox/sources/new-employee-created/new-employee-created.mjs (1)
6-9
: Verify prop definitions adjustment
The implementation correctly extracts and adjusts properties from the common implementation. However, we should verify that all required employee-related properties are properly carried over.
Also applies to: 18-21
✅ Verification successful
Property definitions adjustment verified
The implementation correctly handles property adjustments between QuickBooks and QuickBooks Sandbox. The adjustPropDefinitions
function properly maintains all properties while only modifying app references to point to the sandbox app. The employee-related properties are inherited from the common base implementation which provides core functionality for QuickBooks API queries and event emission. No employee-specific properties are lost in this process.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check property definitions in common implementation
ast-grep --pattern 'props = {
$$$
}' ../quickbooks/sources/new-employee-created/new-employee-created.mjs
Length of output: 223
Script:
#!/bin/bash
# Let's first find the common implementation file
fd common.mjs
# Then check for property definitions in both files
ast-grep --pattern 'props = {
$$$
}'
# Also search for adjustPropDefinitions function
ast-grep --pattern 'function adjustPropDefinitions($_) {
$$$
}'
Length of output: 42289
Script:
#!/bin/bash
# Let's find the common implementation for QuickBooks employee source
fd -t f new-employee-created.mjs
# Search for the adjustPropDefinitions function in the codebase
rg -l "adjustPropDefinitions" --type js --type mjs
# Look for employee-related property definitions
rg -A 10 "props.*employee" --type js --type mjs
Length of output: 351
Script:
#!/bin/bash
# Let's examine both the sandbox and production implementations
cat components/quickbooks/sources/new-employee-created/new-employee-created.mjs
cat components/quickbooks_sandbox/sources/new-employee-created/new-employee-created.mjs
# Also check for any common files in these directories
fd common.mjs components/quickbooks components/quickbooks_sandbox
Length of output: 1448
Script:
#!/bin/bash
# Let's check the utils file containing adjustPropDefinitions
cat components/quickbooks_sandbox/common/utils.mjs
# And check the base common file
cat components/quickbooks/sources/common/base.mjs
Length of output: 2306
components/quickbooks/sources/new-employee-updated/new-employee-updated.mjs (2)
23-25
: Enhance employee summary information
Consistent with the new-employee-created module, the summary could be more informative.
Consider including more meaningful information:
- return `Employee Updated: ${item.Id}`;
+ return `Employee Updated: ${item.DisplayName || item.Id}`;
14-16
:
Prevent SQL injection vulnerability in getQuery method
Similar to the new-employee-created module, this implementation is vulnerable to SQL injection.
Implement proper parameter sanitization:
- return `select * from Employee Where Metadata.LastUpdatedTime >= '${lastDate}' orderby Metadata.LastUpdatedTime desc`;
+ return `select * from Employee Where Metadata.LastUpdatedTime >= '${this.sanitizeDate(lastDate)}' orderby Metadata.LastUpdatedTime desc`;
components/quickbooks_sandbox/common/utils.mjs (1)
1-40
: Verify the impact of property transformations
Let's ensure that the property transformations don't affect any existing components.
✅ Verification successful
Based on the search results, I can now provide a final response:
Property transformations are used consistently and safely
The adjustPropDefinitions
utility is used in a controlled manner within sandbox components (quickbooks_sandbox, monday_oauth, gitlab_developer_app) to adapt prop definitions from their base components. The transformation:
- Only affects the app reference in propDefinitions
- Maintains the original property structure
- Is used consistently across all actions and sources in these sandbox components
- Does not affect any runtime behavior of the components
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for existing usage of adjustPropDefinitions
# and verify the structure of prop definitions
# Find all files that might use property definitions
rg -l "propDefinition" --type js --type mjs
# Find direct usage of the new utility
rg -l "adjustPropDefinitions" --type js --type mjs
Length of output: 150
Script:
#!/bin/bash
# Search for propDefinition and adjustPropDefinitions without file type restrictions
rg -l "propDefinition"
rg -l "adjustPropDefinitions"
# Look for any JavaScript/Node.js files that might use these
fd -e js -e mjs -e jsx -e ts -e tsx
Length of output: 66167
Script:
#!/bin/bash
# Search for files that use adjustPropDefinitions without file type restrictions
rg "adjustPropDefinitions" -A 5 -B 5
# Look for any imports of the utils.mjs file
rg -l "from.*utils.*mjs"
Length of output: 65686
components/quickbooks/sources/new-employee-created/new-employee-created.mjs
Show resolved
Hide resolved
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 @michelle0927 lgtm! Ready for QA!
/approve |
Resolves #14032
Summary by CodeRabbit
New Features
Bug Fixes
@pipedream/quickbooks
package to ensure compatibility and stability.Documentation
package.json
for the QuickBooks Sandbox component, including metadata and discoverability keywords.