Skip to content

New Components - benchmarkone #15668

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

Merged
merged 8 commits into from
Feb 26, 2025
Merged

New Components - benchmarkone #15668

merged 8 commits into from
Feb 26, 2025

Conversation

luancazarine
Copy link
Collaborator

@luancazarine luancazarine commented Feb 19, 2025

Resolves #15631.

Summary by CodeRabbit

  • New Features

    • Introduced multiple new actions for BenchmarkONE, including note addition, tag management, contact creation, and contact updating.
    • Launched a new webhook integration that triggers automation events and notifications.
    • Enhanced the BenchmarkONE integration with extended properties and capabilities for improved contact management.
  • Chores

    • Updated the package version and dependency details.
    • Added a new utility for robust data parsing.
    • Performed minor formatting improvements.

@luancazarine luancazarine added the ai-assisted Content generated by AI, with human refinement and modification label Feb 19, 2025
Copy link

vercel bot commented Feb 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Feb 25, 2025 2:13pm
pipedream-docs ⬜️ Ignored (Inspect) Feb 25, 2025 2:13pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Feb 25, 2025 2:13pm

Copy link
Contributor

coderabbitai bot commented Feb 19, 2025

Walkthrough

This pull request introduces several new BenchmarkONE action modules for contact management, including adding notes, tags, creating, and updating contacts. It also 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. Additionally, a new source module for handling webhook automation events with an accompanying test event is included. Minor formatting changes have been applied across several other component files.

Changes

File(s) Change Summary
components/benchmarkone/actions/add-note/add-note.mjs
components/benchmarkone/actions/add-tag/add-tag.mjs
components/benchmarkone/actions/create-contact/create-contact.mjs
components/benchmarkone/actions/update-contact/update-contact.mjs
New action modules added for BenchmarkONE: adding notes, adding tags, creating contacts, and updating contacts. Each action exports an object with metadata, defined properties, and an asynchronous run method invoking API functions.
components/benchmarkone/benchmarkone.app.mjs Expanded the default export by adding multiple property definitions (e.g., contactId, firstName, etc.) and new methods (e.g., _baseUrl, _makeRequest, createContact, updateContact, etc.), enhancing the application's API interaction capabilities.
components/benchmarkone/common/utils.mjs Introduced a new helper function parseObject to parse input objects and strings, including error handling for JSON parsing.
components/benchmarkone/package.json Package version updated from 0.0.1 to 0.1.0 and a new dependency on @pipedream/platform with version constraint ^3.0.3 was added.
components/benchmarkone/sources/new-webhook-automation-event-instant/... New source module for handling webhook automation events in BenchmarkONE was added along with a corresponding test event module that exports a sample contact payload.
components/bitbucket_data_center/...
components/frontify/...
components/membership_io/...
components/portabilling/...
Minor formatting updates (newline additions at the end of the files) with no changes to functionality.

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
Loading
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
Loading

Possibly related PRs

  • New Components - whautomate #13119: The changes in the main PR, which introduce a module for adding notes to a contact in BenchmarkONE, are related to the retrieved PR, as both involve functionalities for managing contact data, specifically through methods that interact with contact properties. Both PRs include asynchronous run methods that call API functions to modify contact information.

Suggested reviewers

  • michelle0927

Poem

I'm a little rabbit, coding through the night,
Hopping on new actions, everything feels so right.
Notes and tags, contacts galore,
Webhooks and updates, who could ask for more?
With every little line I nibble with delight,
Celebrating these changes from dawn to moonlit night!
🐰💻

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/benchmarkone/actions/create-contact/create-contact.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/benchmarkone/actions/update-contact/update-contact.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)

components/benchmarkone/benchmarkone.app.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f02a7f and 49ef151.

📒 Files selected for processing (3)
  • 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)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (5)
components/benchmarkone/actions/create-contact/create-contact.mjs (1)

146-153: 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,
   phones,
   addresses,
 };
components/benchmarkone/actions/update-contact/update-contact.mjs (2)

153-160: 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,
   phones,
   addresses,
 };

185-188: 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}`);
components/benchmarkone/benchmarkone.app.mjs (2)

113-179: LGTM! Comprehensive API implementation for BenchmarkONE integration.

The implementation follows good practices:

  1. Central request method with proper authentication
  2. Well-organized endpoint methods
  3. Clean parameter handling

176-177: ⚠️ Potential issue

Fix missing comma in URL path.

There is a syntax error in the createWebhook method's path parameter.

-        path: "/Webhook/Addwebhook",
+        path: "/Webhook/Addwebhook",

Likely an incorrect or invalid review comment.

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sources
 - New Webhook Automation Event (Instant)

Actions
 - Add Note
 - Add Tag
 - Create Contact
 - Update Contact
@luancazarine luancazarine marked this pull request as ready for review February 20, 2025 19:16
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 and temperature properties use async 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:

  1. Add sample data to empty arrays (socialNetworks, instantMessaging, website) to ensure proper handling of these fields.
  2. 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

📥 Commits

Reviewing files that changed from the base of the PR and between 423ddca and eee05a9.

⛔ 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, and addresses 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/platform@3.0.3";
  • 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:


@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.

lcaresia
lcaresia previously approved these changes Feb 24, 2025
…nstant/new-webhook-automation-event-instant.mjs
@luancazarine
Copy link
Collaborator Author

/approve

@luancazarine luancazarine merged commit db6687e into master Feb 26, 2025
11 checks passed
@luancazarine luancazarine deleted the issue-15631 branch February 26, 2025 18:44
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
ai-assisted Content generated by AI, with human refinement and modification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Components] benchmarkone
3 participants