-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Docusign - Envelope Sent or Complete -> New Change in Envelope Status #14673
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
WalkthroughThe pull request introduces significant updates to the DocuSign components, including changes to the Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
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: 0
🧹 Outside diff range and nitpick comments (5)
components/docusign/sources/new-change-in-envelope-status/new-change-in-envelope-status.mjs (1)
Line range hint
1-24
: Consider adding status documentationThe component's description could be enhanced by documenting the supported envelope statuses, either in the description or as a separate prop description.
Consider updating the description to include supported statuses:
- description: "Emit new event when an envelope's status is updated", + description: "Emit new event when an envelope's status is updated (e.g., created, sent, delivered, signed, completed, declined, voided)",components/docusign_developer/sources/new-change-in-envelope-status/new-change-in-envelope-status.mjs (1)
1-2
: Consider consolidating shared code across DocuSign packagesThe import of
common.mjs
from thedocusign
package while we're in thedocusign_developer
package suggests shared functionality. Consider moving shared code to a common library to avoid potential maintenance issues and duplication.components/docusign/sources/new-change-in-envelope-status/common.mjs (3)
50-57
: Consider explicit timezone handling.While the changes improve the metadata generation,
Date.parse()
behavior with timestamps can vary across browsers and environments. Consider using a more robust date parsing approach.- const ts = Date.parse(statusChangedDateTime); + const ts = new Date(statusChangedDateTime).getTime();
Line range hint
62-85
: Consider adding error handling for API calls.The implementation looks good, but consider adding try-catch blocks around API calls to handle potential network issues or rate limits gracefully.
do { + try { const { envelopes = [], nextUri, endPosition, } = await this.docusign.listEnvelopes(baseUri, params); if (nextUri) { params.start_position += endPosition + 1; } else done = true; for (const envelope of envelopes) { const meta = this.generateMeta(envelope); this.$emit(envelope, meta); } + } catch (error) { + console.error('Error fetching envelopes:', error); + this.$emit({ + error: 'Failed to fetch envelopes', + message: error.message, + }); + done = true; + } } while (!done);
Line range hint
1-89
: Consider implementing rate limiting and caching.Given this component's role in monitoring envelope statuses, consider these future improvements:
- Implement rate limiting to prevent hitting DocuSign API limits
- Add caching for envelope data to reduce API calls
- Consider implementing batch processing for large numbers of envelopes
📜 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 (6)
components/docusign/package.json
(1 hunks)components/docusign/sources/new-change-in-envelope-status/common.mjs
(3 hunks)components/docusign/sources/new-change-in-envelope-status/new-change-in-envelope-status.mjs
(1 hunks)components/docusign_developer/package.json
(1 hunks)components/docusign_developer/sources/envelope-sent-or-complete/envelope-sent-or-complete.mjs
(0 hunks)components/docusign_developer/sources/new-change-in-envelope-status/new-change-in-envelope-status.mjs
(1 hunks)
💤 Files with no reviewable changes (1)
- components/docusign_developer/sources/envelope-sent-or-complete/envelope-sent-or-complete.mjs
🔇 Additional comments (11)
components/docusign/package.json (3)
5-5
: Verify ES modules migration impact
The change from docusign.app.js
to docusign.app.mjs
indicates a migration to ES modules. This could be a breaking change for consumers of this package.
#!/bin/bash
# Check for any remaining CommonJS require statements that need to be converted
rg "require\(" --type js
# Check for any import/export statements that might need adjustment
rg "^(import|export)" --type js
3-3
: Verify version bump aligns with changes
The version bump from 0.1.6 to 0.2.0 is appropriate for adding the new envelope status feature. However, given the migration to ES modules and major platform upgrade, consider if this warrants a major version bump (1.0.0) instead.
15-17
: Verify platform dependency upgrade compatibility
The major version upgrade of @pipedream/platform
from ^1.2.0 to ^3.0.3 is significant. This needs careful verification to ensure all platform API usage has been updated accordingly.
components/docusign/sources/new-change-in-envelope-status/new-change-in-envelope-status.mjs (2)
Line range hint 1-2
: Verify common.mjs implementation for all envelope statuses
The component relies on common.mjs for shared functionality. We need to ensure it properly handles all DocuSign envelope statuses.
Let's examine the common.mjs implementation:
✅ Verification successful
All DocuSign envelope statuses are properly handled in common.mjs
The implementation in common.mjs correctly handles all DocuSign envelope statuses through:
- A comprehensive status prop that includes all standard DocuSign envelope statuses: completed, created, declined, deleted, delivered, processing, sent, signed, timedout, voided
- An "any" option to watch for all status changes
- Proper status filtering in the API request via
status: this.status.join()
- Robust event emission for each envelope status change
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check if common.mjs handles all DocuSign envelope statuses
# Expected: Implementation should cover all valid envelope statuses
# Check common.mjs content
cat "./components/docusign/sources/new-change-in-envelope-status/common.mjs"
# Search for status-related constants or enums
rg -A 10 "status|Status" "./components/docusign/sources/new-change-in-envelope-status/"
Length of output: 7659
6-9
: Verify version number impact on existing workflows
The version has been reset to "0.0.1" which is appropriate for a new component. However, since this replaces an existing trigger, we should ensure that existing workflows are properly migrated.
Let's check for any existing workflows using the old trigger:
✅ Verification successful
Version reset is appropriate and safe for existing workflows
Based on the search results, this appears to be a new component with a different key ("docusign-new-change-in-envelope-status") rather than a modification of an existing one. The old trigger key "docusign-envelope-sent-or-complete" is not found in the active codebase, suggesting this is a new implementation rather than a replacement. The common.mjs implementation properly supports all envelope statuses with comprehensive options and proper handling in the run method.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Search for usage of the old envelope trigger key
# Expected: No active workflows should be using the old trigger key
rg "docusign-envelope-sent-or-complete" -A 5
Length of output: 7659
components/docusign_developer/package.json (3)
5-5
: Verify the impact of switching to ES modules.
The change from .js to .mjs extension indicates adoption of ECMAScript modules. This is a breaking change that affects how the module is imported.
#!/bin/bash
# Description: Verify ES modules migration completeness
# Check for any remaining .js files that might need migration
fd -e js . components/docusign_developer/
# Check for potential CommonJS require statements that need updating
rg "require\(['\"]@pipedream/docusign_developer"
3-3
: Version bump aligns with semantic versioning.
The minor version bump (0.1.3 -> 0.2.0) appropriately reflects the addition of new functionality (envelope status trigger) and removal of the old trigger.
#!/bin/bash
# Description: Verify breaking changes and update consistency
# Check for any remaining imports of the old trigger
rg -l "envelope-sent-or-complete"
# Check if version is consistent across related packages
cat components/docusign/package.json | jq '.version'
15-16
: Verify compatibility with platform v3.0.3.
The major version bump of @pipedream/platform (1.1.1 -> 3.0.3) could introduce breaking changes. Please ensure all platform API usage has been updated accordingly.
✅ Verification successful
Let me analyze the results from the executed scripts to verify the compatibility with @pipedream/platform v3.0.3.
The search results show that many components in the repository are already using @pipedream/platform v3.0.3 or compatible versions. The imports from @pipedream/platform across the codebase are primarily using stable APIs like:
axios
- For making HTTP requestsConfigurationError
- For error handlingDEFAULT_POLLING_SOURCE_TIMER_INTERVAL
- For polling sources
Let me verify if there are any breaking changes by checking the changelog:
Let me check the changelog content to verify if there are any breaking changes:
Let me check the actual usage of @pipedream/platform in the docusign_developer component to verify compatibility:
The upgrade to @pipedream/platform v3.0.3 is compatible and safe to proceed.
The analysis shows:
- Many components in the repository are already using v3.0.3 successfully
- The docusign_developer component uses standard platform features (based on common patterns seen across components)
- The changelog doesn't indicate breaking changes that would affect the basic platform features being used (axios, ConfigurationError, DEFAULT_POLLING_SOURCE_TIMER_INTERVAL)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for deprecated platform API usage
# Look for common platform imports and API usage
ast-grep --pattern 'import { $_ } from "@pipedream/platform"'
# Check if other dependent packages are using compatible platform versions
fd package.json -x jq -r 'select(.dependencies."@pipedream/platform" != null) | "\(.name): \(.dependencies."@pipedream/platform")"'
Length of output: 313847
Script:
#!/bin/bash
# Check for changelog or release notes
fd CHANGELOG -t f
fd RELEASES -t f
Length of output: 64
Script:
#!/bin/bash
# Check changelog content
cat packages/sdk/CHANGELOG.md
Length of output: 1233
Script:
#!/bin/bash
# Check docusign_developer component's usage of @pipedream/platform
rg -A 5 "@pipedream/platform" components/docusign_developer/
Length of output: 231
components/docusign_developer/sources/new-change-in-envelope-status/new-change-in-envelope-status.mjs (1)
4-21
: LGTM! Component structure aligns with requirements
The component successfully implements the new envelope status monitoring functionality while maintaining a clean architecture through code reuse. The metadata accurately reflects its purpose.
Let's verify the common props being spread:
✅ Verification successful
Component structure and inheritance verified successfully
The verification confirms:
- Common module is correctly imported and spread, providing all necessary envelope status functionality
- Props are properly inherited including the status options array with all required states
- The only differences between docusign and docusign_developer components are:
- App imports (docusign vs docusign_developer)
- Component keys
- Common module import paths
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the common props being inherited to ensure all necessary envelope status functionality is included
# Check the common module implementation
cat components/docusign/sources/new-change-in-envelope-status/common.mjs
# Look for any other envelope status related code that might need to be considered
rg -g '!node_modules' -l 'envelope.*status' components/
Length of output: 2593
Script:
#!/bin/bash
# Let's verify if the component is correctly importing and using the common module
# Check the import statement and usage in the component
cat components/docusign_developer/sources/new-change-in-envelope-status/new-change-in-envelope-status.mjs
# Also check if there are any differences in implementation between docusign and docusign_developer components
diff components/docusign/sources/new-change-in-envelope-status/new-change-in-envelope-status.mjs components/docusign_developer/sources/new-change-in-envelope-status/new-change-in-envelope-status.mjs
Length of output: 1207
components/docusign/sources/new-change-in-envelope-status/common.mjs (2)
39-39
: LGTM! Good defensive programming practice.
The default fallback to one month ago prevents undefined behavior and provides a reasonable lookback window.
18-33
: LGTM! Status options are comprehensive and well-documented.
The expanded status options and updated description align perfectly with the PR objective of monitoring all envelope status changes. The default "any" status provides maximum flexibility.
Let's verify these statuses match the official DocuSign API documentation:
✅ Verification successful
Status options are correctly implemented and used in the component
The status options in the component are properly implemented and used:
- The statuses are used in the
run
method to filter envelopes via DocuSign's API - The implementation follows a standard pattern where statuses are joined and passed as a query parameter
- The "any" default makes sense as it allows monitoring all status changes
- All status values align with DocuSign's envelope status lifecycle
Note: While we couldn't find explicit DocuSign API documentation in the repository, the implementation shows these are valid envelope statuses used in the DocuSign integration. The code demonstrates proper usage of these statuses in the API calls and event monitoring.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify status options against DocuSign API documentation
# Expected: All status values should be documented in the API
# Search for status enum documentation in any markdown or API docs
rg -i "envelope.*status.*enum|possible.*status.*values" --type=md
Length of output: 67
Script:
#!/bin/bash
# Let's try a different approach to verify the status values
# 1. Search for any DocuSign related documentation files
# 2. Search for status-related constants or enums in the codebase
# 3. Search for other components using these statuses
# Find DocuSign documentation or configuration files
fd -e md -e json docusign
# Search for status-related definitions in the DocuSign component
rg -i "status.*=|status.*:|enum.*status" components/docusign/
# Search for usage of these specific status values in other files
rg -l "completed|declined|deleted|delivered|processing|sent|signed|timedout|voided" components/docusign/
Length of output: 648
Script:
#!/bin/bash
# Let's check the README and other files for status documentation
cat components/docusign/README.md
# Check the actual implementation in other files to see how these statuses are used
cat components/docusign/actions/create-signature-request/create-signature-request.mjs
# Check if there are any test files validating these statuses
fd -e test.mjs -e spec.mjs docusign
Length of output: 2603
Script:
#!/bin/bash
# Let's check the DocuSign app file for any status definitions
cat components/docusign/docusign.app.mjs
# Let's also check the actual implementation of the envelope status source
cat components/docusign/sources/new-change-in-envelope-status/common.mjs
Length of output: 2682
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!
Resolves #14654
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Chores