-
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
New Components - benchmarkone #15668
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
|
WalkthroughThis pull request introduces several new BenchmarkONE action modules for contact management, including adding notes, tags, creating, and updating contacts. In addition, it expands the BenchmarkONE application by populating property definitions and methods for API interactions. A new utility function for object parsing is added and the package has its version updated with a new dependency. There is also a new source module for handling webhook automation events with an accompanying test event. Minor formatting changes have been applied across several other component files. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant A as Action Module
participant B as BenchmarkONE API
U->>A: Initiate Action (e.g., Create/Update Contact)
A->>B: Call API method (e.g., createContact, updateContact)
B-->>A: Return API response
A-->>U: Return success summary
sequenceDiagram
participant S as Webhook Source
participant B as BenchmarkONE API
participant E as Event Handler
S->>B: Activate webhook (using createWebhook)
B-->>S: Confirm webhook creation
S->>E: Receive and process incoming event
E-->>S: Emit formatted event with unique ID
Possibly related PRs
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/benchmarkone/actions/create-contact/create-contact.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/benchmarkone/actions/add-note/add-note.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/benchmarkone/actions/update-contact/update-contact.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
✨ Finishing Touches
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 (
|
Sources - New Webhook Automation Event (Instant) Actions - Add Note - Add Tag - Create Contact - Update Contact
…into issue-15631
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: 5
🧹 Nitpick comments (8)
components/benchmarkone/benchmarkone.app.mjs (3)
6-82
: Add error-handling or fallback logic for async options retrieval.The
status
andtemperature
properties useasync
functions to fetch data from the server. If network errors or unexpected API responses occur, these methods may throw an error. Consider adding try-catch blocks or fallback logic to handle errors gracefully and provide a consistent user experience.
84-92
: Consider a more descriptive naming for_params
.The
_params
method is well-structured but a more descriptive name like_buildParams
or_mergeParams
could clarify its purpose, especially for new contributors.
93-101
: Add optional error handling and retry logic.Currently,
_makeRequest()
doesn’t catch exceptions. Including brief error handling (e.g., for timeouts or rate limits) or optional retries can help improve reliability.components/benchmarkone/common/utils.mjs (1)
1-24
: Ensure consistent handling of nested data.The
parseObject
function correctly attempts to parse strings as JSON. However, if deeper nested structures exist, the current logic won’t recursively parse them. If the data needs deeper unwrapping (e.g., arrays inside arrays of strings), consider making the function recursive or clarifying this function’s limited scope.components/benchmarkone/actions/add-tag/add-tag.mjs (1)
32-32
: Fix minor spelling error in success message.“Succcessfully” contains an extra “c.” Correcting the message helps maintain professionalism in user-facing outputs.
- $.export("$summary", `Succcessfully added tags to contact ID ${this.contactId}`); + $.export("$summary", `Successfully added tags to contact ID ${this.contactId}`);components/benchmarkone/actions/add-note/add-note.mjs (1)
35-53
: Enhance error handling and success message.The current error handling could be more specific, and the success message could include more details about the note added.
async run({ $ }) { try { const response = await this.benchmarkone.addNoteToContact({ $, contactId: this.contactId, data: { subject: this.subject, body: this.body, copyToCompany: this.copyToCompany, }, }); - $.export("$summary", `Added note to contact with ID ${this.contactId}`); + $.export("$summary", `Added note "${this.subject}" to contact with ID ${this.contactId}${this.copyToCompany ? " (copied to company)" : ""}`); return response; } catch (error) { - throw new ConfigurationError(error.message); + if (error.response?.status === 404) { + throw new ConfigurationError(`Contact with ID ${this.contactId} not found`); + } + throw new ConfigurationError(`Failed to add note: ${error.message}`); } },components/benchmarkone/sources/new-webhook-automation-event-instant/test-event.mjs (2)
10-10
: Fix the malformed contact URL.The contact URL contains a double forward slash which should be corrected to a single slash.
- "contactUrl":"https://app.hatchbuck.com//Contact/ContactDetail?eid=QmNXLWlfVk0zN1dOaERKYU45c0pEZzdxSUZTaE1ZanNvUmpySjc3eGxYYzE1", + "contactUrl":"https://app.hatchbuck.com/Contact/ContactDetail?eid=QmNXLWlfVk0zN1dOaERKYU45c0pEZzdxSUZTaE1ZanNvUmpySjc3eGxYYzE1",
1-116
: Well-structured test event with comprehensive contact data.The test event provides a realistic and detailed contact object that covers all essential fields and relationships. This will be valuable for testing webhook automation events.
However, consider the following improvements:
- Add sample data to empty arrays (socialNetworks, instantMessaging, website) to ensure proper handling of these fields.
- Consider using placeholder IDs instead of hardcoded ones to prevent test failures if the IDs become invalid.
📜 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/benchmarkone/actions/add-note/add-note.mjs
(1 hunks)components/benchmarkone/actions/add-tag/add-tag.mjs
(1 hunks)components/benchmarkone/actions/create-contact/create-contact.mjs
(1 hunks)components/benchmarkone/actions/update-contact/update-contact.mjs
(1 hunks)components/benchmarkone/benchmarkone.app.mjs
(1 hunks)components/benchmarkone/common/utils.mjs
(1 hunks)components/benchmarkone/package.json
(2 hunks)components/benchmarkone/sources/new-webhook-automation-event-instant/new-webhook-automation-event-instant.mjs
(1 hunks)components/benchmarkone/sources/new-webhook-automation-event-instant/test-event.mjs
(1 hunks)components/bitbucket_data_center/bitbucket_data_center.app.mjs
(1 hunks)components/frontify/frontify.app.mjs
(1 hunks)components/membership_io/membership_io.app.mjs
(1 hunks)components/portabilling/portabilling.app.mjs
(1 hunks)
✅ Files skipped from review due to trivial changes (4)
- components/portabilling/portabilling.app.mjs
- components/frontify/frontify.app.mjs
- components/membership_io/membership_io.app.mjs
- components/bitbucket_data_center/bitbucket_data_center.app.mjs
🧰 Additional context used
🪛 GitHub Check: Lint Code Base
components/benchmarkone/sources/new-webhook-automation-event-instant/new-webhook-automation-event-instant.mjs
[warning] 15-15:
Component prop alert must have a label. See https://pipedream.com/docs/components/guidelines/#props
[warning] 15-15:
Component prop alert must have a description. See https://pipedream.com/docs/components/guidelines/#props
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Publish TypeScript components
- GitHub Check: pnpm publish
- GitHub Check: Verify TypeScript components
🔇 Additional comments (4)
components/benchmarkone/benchmarkone.app.mjs (2)
62-66
: Validate string array inputs.The
emails
,phones
, andaddresses
properties direct users to pass “JSON-like” strings inside an array of strings. Consider incorporating validation or using a type that clarifies this requirement (e.g., an object array type if supported). Relying on string input can lead to parsing errors at runtime, especially if the user input is malformed.Also applies to: 67-71, 72-76
144-150
: Verify endpoint path naming.The path
/Webhook/Addwebhook
has a capital “A” which may be correct, but can also be a potential source of confusion if the target endpoint is case sensitive. Recommend verifying that the endpoint spelling and case matches the API’s specification.components/benchmarkone/package.json (2)
3-3
: Version bump aligns with feature additions.The minor version increment (0.0.1 → 0.1.0) appropriately reflects the addition of new features (contact management actions, webhook automation) without breaking changes.
15-17
:✅ Verification successful
Verify the @pipedream/platform version constraint.
The caret (^) in the version constraint allows automatic updates to minor and patch versions. Please ensure that the package remains compatible with future minor updates of @pipedream/platform.
🌐 Web query:
What is the latest version of @pipedream/platform package?
💡 Result:
The latest version of the
@pipedream/platform
package is 3.0.3, as confirmed by its npm registry entry[7][8]. This version was published approximately five months before February 2025[7], aligning with a release timeframe around September 2024.For developers using this package in Pipedream workflows:
- The
@pipedream/platform
module provides enhanced Axios functionality with improved error handling and simplified response data extraction[1]- To specify this exact version in code imports:
import { axios } from "@pipedream/[email protected]";
- Pipedream automatically uses the latest package versions unless explicitly pinned using semantic version syntax[2][5]
The package remains actively maintained by Pipedream as part of their core integration platform tools[9].
Citations:
- 1: https://pipedream.com/docs/pipedream-axios
- 2: https://pipedream.com/docs/code/nodejs
- 3: https://pipedream.com/community/t/what-is-the-correct-python-package-name-for-the-export-function-to-avoid-a-modulenotfounderror/9353
- 4: https://pipedream.com/docs/migrate-from-v1
- 5: https://pipedream.com/community/t/how-do-i-require-a-specific-version-of-an-npm-package/943
- 6: https://ecosystem.hubspot.com/marketplace/apps/pipedream-208642
- 7: https://www.npmjs.com/package/@pipedream/platform
- 8: https://www.npmjs.com/package/@pipedream/platform?activeTab=dependents
- 9: https://github.com/PipedreamHQ/pipedream
- 10: https://www.jsdelivr.com/package/npm/pipedream
@pipedream/platform Dependency Constraint Verified
The dependency in
components/benchmarkone/package.json
is specified as"@pipedream/platform": "^3.0.3"
, and our verification confirms that the latest version is indeed 3.0.3. The caret (^) correctly allows for automatic updates to any compatible minor and patch versions. No further changes are needed at this time.
alert: { | ||
type: "alert", | ||
alertType: "warning", | ||
content: "BenchmarkONE does not provide a way to delete webhooks through API. If you want to stop receiving events, you'll need to delete this source and the webhook from the BenchmarkONE UI.", | ||
}, |
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.
🛠️ Refactor suggestion
Add required label and description to alert prop.
According to component guidelines, props must have both a label and description.
alert: {
type: "alert",
alertType: "warning",
+ label: "Webhook Deletion Warning",
+ description: "Important information about webhook management in BenchmarkONE.",
content: "BenchmarkONE does not provide a way to delete webhooks through API. If you want to stop receiving events, you'll need to delete this source and the webhook from the BenchmarkONE UI.",
},
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
alert: { | |
type: "alert", | |
alertType: "warning", | |
content: "BenchmarkONE does not provide a way to delete webhooks through API. If you want to stop receiving events, you'll need to delete this source and the webhook from the BenchmarkONE UI.", | |
}, | |
alert: { | |
type: "alert", | |
alertType: "warning", | |
label: "Webhook Deletion Warning", | |
description: "Important information about webhook management in BenchmarkONE.", | |
content: "BenchmarkONE does not provide a way to delete webhooks through API. If you want to stop receiving events, you'll need to delete this source and the webhook from the BenchmarkONE UI.", | |
}, |
🧰 Tools
🪛 GitHub Check: Lint Code Base
[warning] 15-15:
Component prop alert must have a label. See https://pipedream.com/docs/components/guidelines/#props
[warning] 15-15:
Component prop alert must have a description. See https://pipedream.com/docs/components/guidelines/#props
async run({ body }) { | ||
const ts = Date.parse(body.Data.createdDt || new Date()); | ||
this.$emit(body, { | ||
id: `${body.Data.contactId}-${ts}`, | ||
summary: "New Automation Event", | ||
ts: ts, | ||
}); | ||
}, |
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.
🛠️ Refactor suggestion
Add validation and error handling for webhook event data.
The current implementation lacks validation for required fields and proper error handling for timestamp parsing.
async run({ body }) {
+ if (!body?.Data) {
+ throw new Error("Webhook event data is missing or invalid");
+ }
+
- const ts = Date.parse(body.Data.createdDt || new Date());
+ const ts = Date.parse(body.Data.createdDt || new Date().toISOString());
+ if (isNaN(ts)) {
+ throw new Error("Invalid timestamp in webhook event data");
+ }
+
+ if (!body.Data.contactId) {
+ throw new Error("Contact ID is missing in webhook event data");
+ }
+
this.$emit(body, {
id: `${body.Data.contactId}-${ts}`,
summary: "New Automation Event",
ts: ts,
});
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
async run({ body }) { | |
const ts = Date.parse(body.Data.createdDt || new Date()); | |
this.$emit(body, { | |
id: `${body.Data.contactId}-${ts}`, | |
summary: "New Automation Event", | |
ts: ts, | |
}); | |
}, | |
async run({ body }) { | |
if (!body?.Data) { | |
throw new Error("Webhook event data is missing or invalid"); | |
} | |
const ts = Date.parse(body.Data.createdDt || new Date().toISOString()); | |
if (isNaN(ts)) { | |
throw new Error("Invalid timestamp in webhook event data"); | |
} | |
if (!body.Data.contactId) { | |
throw new Error("Contact ID is missing in webhook event data"); | |
} | |
this.$emit(body, { | |
id: `${body.Data.contactId}-${ts}`, | |
summary: "New Automation Event", | |
ts: ts, | |
}); | |
}, |
const data = { | ||
contactId: this.contactId, | ||
firstName: this.firstName, | ||
lastName: this.lastName, | ||
emails: parseObject(this.emails), | ||
phones: parseObject(this.phones), | ||
addresses: parseObject(this.addresses), | ||
}; |
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.
Fix data object construction.
The data object includes contactId
which is not needed for contact creation, and is missing title
and company
fields.
const data = {
- contactId: this.contactId,
firstName: this.firstName,
lastName: this.lastName,
+ title: this.title,
+ company: this.company,
emails: parseObject(this.emails),
phones: parseObject(this.phones),
addresses: parseObject(this.addresses),
};
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const data = { | |
contactId: this.contactId, | |
firstName: this.firstName, | |
lastName: this.lastName, | |
emails: parseObject(this.emails), | |
phones: parseObject(this.phones), | |
addresses: parseObject(this.addresses), | |
}; | |
const data = { | |
firstName: this.firstName, | |
lastName: this.lastName, | |
title: this.title, | |
company: this.company, | |
emails: parseObject(this.emails), | |
phones: parseObject(this.phones), | |
addresses: parseObject(this.addresses), | |
}; |
$, | ||
data, | ||
}); | ||
$.export("$summary", "Contact updated successfully."); |
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.
Fix error message and enhance success message.
The error message incorrectly mentions "create" instead of "update", and the success message could be more descriptive.
- $.export("$summary", "Contact updated successfully.");
+ $.export("$summary", `Contact ${this.contactId} updated successfully.`);
- throw new ConfigurationError(`Failed to create contact: ${error.message}`);
+ throw new ConfigurationError(`Failed to update contact: ${error.message}`);
Also applies to: 127-127
const data = { | ||
contactId: this.contactId, | ||
firstName: this.firstName, | ||
lastName: this.lastName, | ||
emails: parseObject(this.emails), | ||
phones: parseObject(this.phones), | ||
addresses: parseObject(this.addresses), | ||
}; |
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.
Fix data object construction.
The data object is missing title
and company
fields.
const data = {
contactId: this.contactId,
firstName: this.firstName,
lastName: this.lastName,
+ title: this.title,
+ company: this.company,
emails: parseObject(this.emails),
phones: parseObject(this.phones),
addresses: parseObject(this.addresses),
};
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const data = { | |
contactId: this.contactId, | |
firstName: this.firstName, | |
lastName: this.lastName, | |
emails: parseObject(this.emails), | |
phones: parseObject(this.phones), | |
addresses: parseObject(this.addresses), | |
}; | |
const data = { | |
contactId: this.contactId, | |
firstName: this.firstName, | |
lastName: this.lastName, | |
title: this.title, | |
company: this.company, | |
emails: parseObject(this.emails), | |
phones: parseObject(this.phones), | |
addresses: parseObject(this.addresses), | |
}; |
Resolves #15631.
Summary by CodeRabbit
New Features
Chores