Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Mar 28, 2025

Resolves #16061

Summary by CodeRabbit

  • New Features

    • Enhanced Asana task search with an optional project filter and streamlined input validations for a more flexible filtering experience.
    • Refined Freshdesk integrations where contact creation now enforces a valid email or phone, and ticket creation has been simplified with fewer, clearer input options.
  • Chores

    • Updated version numbers across both Asana and Freshdesk components to reflect the latest enhancements.

@vercel
Copy link

vercel bot commented Mar 28, 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 Apr 1, 2025 4:36am
pipedream-docs ⬜️ Ignored (Inspect) Apr 1, 2025 4:36am
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Apr 1, 2025 4:36am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 28, 2025

Walkthrough

The changes update multiple Asana and Freshdesk components by introducing new error handling and parameter validation. In the Asana search tasks action, version and property modifications enforce that at least one of project, section, or assignee is provided while renaming some parameters to camelCase. Freshdesk actions now import a configuration error for explicit validation, with create-contact ensuring an email or phone is provided and create-ticket streamlining properties by making some optional and removing description fields. Additionally, package versions have been incremented.

Changes

File(s) Change Summary
components/asana/.../search-tasks.mjs Updated version (0.3.1 → 0.3.2), added import for ConfigurationError, added optional project property (from common.props), renamed properties (completed_sincecompletedSince, modified_sincemodifiedSince), and updated validation logic in run method.
components/asana/package.json Version bump from 0.7.1 to 0.7.2.
components/freshdesk/.../create-contact.mjs Updated version (0.0.2 → 0.0.3), added import for ConfigurationError, modified destructuring to include freshdesk, and added error check ensuring at least one of email or phone is provided.
components/freshdesk/.../create-ticket.mjs Updated version (0.0.3 → 0.0.4), marked email and subject as optional, and removed description and descriptionText properties along with their handling in the API call.
components/freshdesk/package.json Version bump from 0.1.0 to 0.1.1.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant ST as Asana Search Tasks Action
    participant API as Asana API
    U->>ST: Execute search-tasks with parameters
    ST->>ST: Validate input (ensure one of project, section, or assignee)
    alt Validation passes
        ST->>API: Call API with structured (camelCase) parameters
        API-->>ST: Return task results
        ST-->>U: Send search response
    else Validation fails
        ST-->>U: Throw ConfigurationError
    end
Loading
sequenceDiagram
    participant U as User
    participant CC as Freshdesk Create Contact Action
    participant API as Freshdesk API
    U->>CC: Invoke create contact with email/phone
    CC->>CC: Validate presence of email/phone
    alt Validation passes
        CC->>API: Call freshdesk.createContact with parameters
        API-->>CC: Return contact info
        CC-->>U: Send contact details
    else Validation fails
        CC-->>U: Throw ConfigurationError
    end
Loading
sequenceDiagram
    participant U as User
    participant CT as Freshdesk Create Ticket Action
    participant API as Freshdesk API
    U->>CT: Execute create ticket with data
    CT->>CT: Validate and restructure input (remove description fields)
    CT->>API: Call createTicket with companyId and updated data
    API-->>CT: Return ticket response
    CT-->>U: Send ticket details
Loading

Assessment against linked issues

Objective Addressed Explanation
[#16061] Asana Search Tasks action handles team parameter The changes do not explicitly add or manage a team field.
[#16061] Freshdesk Create Contact/Ticket actions validate fields to avoid 404 errors Updated validations and parameter restructuring are implemented.

Possibly related PRs

Suggested labels

bug, User submitted

Suggested reviewers

  • lcaresia

Poem

I'm a rabbit hopping through a code-filled glade,
Where validations grow and logic is laid.
With each version bump and careful tune,
My scripted hops make bugs leave soon.
In fields of code I dance with glee 🐰,
Celebrating changes simply and happily!

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/freshdesk/freshdesk.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)

components/freshdesk/actions/create-company/create-company.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/freshdesk/actions/get-ticket/get-ticket.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)

  • 3 others

📜 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 e2016db and 68fbd6a.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • components/freshdesk/actions/create-company/create-company.mjs (1 hunks)
  • components/freshdesk/actions/get-ticket/get-ticket.mjs (1 hunks)
  • components/freshdesk/actions/list-all-tickets/list-all-tickets.mjs (1 hunks)
  • components/freshdesk/freshdesk.app.mjs (1 hunks)
  • components/freshdesk/sources/new-contact/new-contact.mjs (1 hunks)
  • components/freshdesk/sources/new-ticket/new-ticket.mjs (1 hunks)
✅ Files skipped from review due to trivial changes (5)
  • components/freshdesk/actions/list-all-tickets/list-all-tickets.mjs
  • components/freshdesk/sources/new-contact/new-contact.mjs
  • components/freshdesk/actions/create-company/create-company.mjs
  • components/freshdesk/sources/new-ticket/new-ticket.mjs
  • components/freshdesk/actions/get-ticket/get-ticket.mjs
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (2)
components/freshdesk/freshdesk.app.mjs (2)

67-67: Changed filtering logic to only return contacts with emails.

This change makes sense for a property named contactEmail, ensuring that only contacts with valid emails are returned. The previous implementation likely filtered by company ID, but since we're now passing that parameter to the API, this client-side filtering is appropriately focused on ensuring email existence.


61-65:

❓ Verification inconclusive

Verify that the API handles undefined company_id gracefully.

The code now passes company_id to the getContacts method, which is a good improvement for filtering contacts by company on the server side. However, if companyId is not provided (it's optional based on the function signature), the API call will include a company_id: undefined parameter.


🏁 Script executed:

#!/bin/bash
# Check how getContacts is called elsewhere in the codebase to ensure consistent handling of optional parameters
rg "getContacts\(" --type js --type mjs -A 3 -B 3

Length of output: 79


I'm going to re-run the search using a corrected command that properly includes .mjs files. This should help us verify how getContacts is used throughout the codebase and whether it handles an undefined company_id reliably.

Once these commands are executed, please share the output so we can verify if any other usage sites handle the optional parameter consistently.


🏁 Script executed:

#!/bin/bash
# Search for getContacts usage in js files:
rg "getContacts\(" --type js -A 3 -B 3

# Search for getContacts usage in mjs files by explicitly adding the file type:
rg --type-add 'mjs:*.mjs' -t mjs "getContacts\(" -A 3 -B 3

Length of output: 38978


I'm going to further inspect how _makeRequest is implemented within the Freshdesk adapter to see if it filters out or handles undefined query parameters gracefully. This will help determine if passing company_id: undefined is safe.

Once this command is executed, please share the output so we can verify the behavior.


🏁 Script executed:

#!/bin/bash
# Search for _makeRequest in the freshdesk file
rg "_makeRequest" --type mjs -A 10 -B 10 components/freshdesk/freshdesk.app.mjs

Length of output: 229


Action Required: Validate Handling of Undefined company_id

The current implementation forwards company_id: companyId directly to the API. If companyId is undefined, this parameter will be passed as undefined in the request. We need confirmation that the server-side API either ignores this key or handles it without errors. Depending on the API behavior, you might consider wrapping the parameter in a check (for example, including it only if defined) to prevent accidental transmission of an undefined value.

Location: components/freshdesk/freshdesk.app.mjs, lines 61-65
Suggestion: Verify whether the API rejects or safely ignores a parameter with an undefined value. If needed, update the code to conditionally include company_id only when companyId is defined (e.g., using a conditional object spread).

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

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: 2

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 15cc437 and e2016db.

📒 Files selected for processing (5)
  • components/asana/actions/search-tasks/search-tasks.mjs (3 hunks)
  • components/asana/package.json (1 hunks)
  • components/freshdesk/actions/create-contact/create-contact.mjs (2 hunks)
  • components/freshdesk/actions/create-ticket/create-ticket.mjs (3 hunks)
  • components/freshdesk/package.json (1 hunks)
🧰 Additional context used
🪛 GitHub Check: Lint Code Base
components/asana/actions/search-tasks/search-tasks.mjs

[warning] 13-13:
Component prop project must have a label. See https://pipedream.com/docs/components/guidelines/#props


[warning] 13-13:
Component prop project must have a description. See https://pipedream.com/docs/components/guidelines/#props

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (22)
components/freshdesk/package.json (1)

3-3: Version update is appropriate

The version increment from 0.1.0 to 0.1.1 correctly reflects the backward-compatible changes made to the Freshdesk components in this PR.

components/asana/package.json (1)

3-3: Version update is appropriate

The version increment from 0.7.1 to 0.7.2 correctly reflects the backward-compatible changes made to the Asana components in this PR.

components/freshdesk/actions/create-contact/create-contact.mjs (5)

2-2: Good addition of ConfigurationError import

Adding the ConfigurationError import from @pipedream/platform allows for more explicit error handling with clearer feedback to users.


8-8: Version increment is appropriate

The version increment from 0.0.2 to 0.0.3 correctly reflects the backward-compatible improvements made to error handling.


45-46: Improved code clarity

Explicitly including freshdesk in the destructuring makes the code more maintainable by clarifying which object methods are being called.


48-50: Good validation implementation

This validation ensures users provide at least one contact method (email or phone) before attempting to create a contact, preventing API errors and providing a better user experience with clear error messaging.


52-52: Improved code clarity

Explicitly referencing freshdesk.createContact improves code readability and maintenance.

components/freshdesk/actions/create-ticket/create-ticket.mjs (4)

7-7: Version increment is appropriate

The version increment from 0.0.3 to 0.0.4 correctly reflects the backward-compatible changes made to the component.


32-32: Improved flexibility

Making the priority field optional gives users more flexibility when creating tickets.


61-62: Simplified destructuring

Removing descriptionText from the destructuring correctly aligns with the removal of this property from the component.


34-38:

❓ Verification inconclusive

Subject field validation

The subject field appears to be required based on this code, but the AI summary suggests it was made optional. Consider adding "optional: true" if this field should be optional.


🏁 Script executed:

#!/bin/bash
# Check if the subject field is required in the Freshdesk API
curl -s https://developers.freshdesk.com/api/#create_ticket | grep -A 10 "Mandatory parameters"

Length of output: 97


Subject Field Configuration Verification

  • The current code defines the subject field as a string without the "optional: true" attribute, which implies it is required. However, the AI summary mentioned it was made optional.
  • The automated check via Freshdesk’s API documentation did not return any output regarding mandatory parameters. Please verify manually against the latest Freshdesk API guidelines.
  • If the subject field is indeed optional, update its configuration by adding "optional: true". Otherwise, document that it is required per the API requirements.
components/asana/actions/search-tasks/search-tasks.mjs (11)

3-3: Introduced ConfigurationError for improved error handling
Importing from "@pipedream/platform" aligns with the newly added validations.


9-9: Version bump to 0.3.2
This minor version increment appropriately reflects the new validations and parameter constraints.


38-38: Clarified dependency on Project for Section
This descriptive update helps users understand that defining a Project is needed to list Section options.


48-48: completedSince renamed from completed_since
Renaming to camelCase conforms to JavaScript naming standards while mapping correctly to Asana’s parameter requirements.


54-54: modifiedSince renamed from modified_since
Continuing the camelCase style ensures consistency across parameters.


62-64: Validate required search criteria
Throwing a ConfigurationError when none of Project, Section, or Assignee is provided ensures at least one filter is specified.


66-68: Disallow combining Assignee with Project/Section
Enforcing this restriction avoids ambiguous search queries.


70-73: Initialize request parameters
Populating params with completed_since and modified_since correctly matches Asana’s API fields.


81-81: Fallback to Project
Defaulting to project when neither assignee nor section is specified balances the search criteria.


85-85: Invoking this.asana.getTasks with params
Passing the constructed params object is consistent with the Asana API's requirements.


75-78:

✅ Verification successful

Set Assignee-related parameters
Including the workspace property is crucial for filtering by assignee. Verify that workspace is guaranteed to be present in common.props.


🏁 Script executed:

#!/bin/bash
# Description: Verify that `workspace` is declared in common.props for Asana
fd common.mjs | xargs -I {} grep -A 5 'workspace.*:' {}

Length of output: 1264


Workspace property verified for Asana integration

The code at lines 75–78 in components/asana/actions/search-tasks/search-tasks.mjs correctly assigns this.workspace to params.workspace when an assignee is provided. Our search through common.mjs confirms that a dedicated workspace property is present for Asana (as shown by the definition with label "Workspace", description "Gid of a workspace", and corresponding propDefinition). This ensures that filtering by assignee correctly leverages the workspace parameter.

No changes are needed.

lcaresia
lcaresia previously approved these changes Mar 28, 2025
@dannyroosevelt dannyroosevelt merged commit 4ef0ceb into master Apr 1, 2025
9 of 11 checks passed
@dannyroosevelt dannyroosevelt deleted the issue-16061 branch April 1, 2025 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Asana not passing team field, Freshdesk returning a 404

4 participants