Skip to content
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

🐛 Fix project connectors inside code #486

Merged
merged 2 commits into from
Jun 8, 2024
Merged

Conversation

naelob
Copy link
Member

@naelob naelob commented Jun 6, 2024

No description provided.

Copy link

changeset-bot bot commented Jun 6, 2024

⚠️ No Changeset found

Latest commit: 885efd9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jun 6, 2024

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

Name Status Preview Comments Updated (UTC)
panora-client-ts ❌ Failed (Inspect) Jun 6, 2024 11:52am

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Contributor

coderabbitai bot commented Jun 6, 2024

Walkthrough

The recent changes involve minor formatting adjustments in the connections-strategies.service.ts file, updates to the ProjectsService to handle active connectors for projects, and terminology updates in the contributors.mdx file from "vertical" to "category" for 3rd party services in Panora. These changes enhance code readability, functionality, and consistency in naming conventions without altering core logic or functionality.

Changes

Files Change Summary
packages/api/src/@core/connections-strategies/connections-strategies.service.ts Minor formatting adjustments, changed single quotes to double quotes in logging messages.
packages/api/src/@core/projects/projects.service.ts Updated to handle active connectors for projects, including updates to the project-connectors table.
docs/open-source/contributors.mdx Updated terminology from "vertical" to "category" for 3rd party services in Panora, including environment variables, service categorization, and metadata references.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant ProjectsService
    participant ConnectorsDatabase

    User->>ProjectsService: Request to update project
    ProjectsService->>ConnectorsDatabase: Fetch active connectors
    ConnectorsDatabase-->>ProjectsService: Return active connectors
    ProjectsService->>ConnectorsDatabase: Update project-connectors table
    ProjectsService-->>User: Return update confirmation
Loading

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

  • Enhanced createProject method to update project-connectors table with active connectors
  • Imported utilities from @panora/shared for dynamic property construction
  • Formatting adjustments in connections-strategies.service.ts (indentation, single quotes)

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 896faf6 and 33a52d2.

Files selected for processing (2)
  • packages/api/src/@core/connections-strategies/connections-strategies.service.ts (4 hunks)
  • packages/api/src/@core/projects/projects.service.ts (2 hunks)
Additional context used
Biome
packages/api/src/@core/connections-strategies/connections-strategies.service.ts

[error] 226-228: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause. (lint/correctness/noSwitchDeclarations)

The declaration is defined in this switch clause:

Unsafe fix: Wrap the declaration in a block.

GitHub Check: Build and Test (18.x)
packages/api/src/@core/connections-strategies/connections-strategies.service.ts

[warning] 88-88:
'value_' is assigned a value but never used


[warning] 348-348:
'updateCS' is assigned a value but never used


[warning] 375-375:
'value_' is assigned a value but never used

Additional comments not posted (4)
packages/api/src/@core/projects/projects.service.ts (2)

7-12: Ensure that the newly added imports are utilized effectively in the file.


53-72: The logic for handling active connectors has been added. This includes updating the project-connectors table based on the provided connectors array. Ensure that the updateData object is correctly populated and that all necessary fields are included in the database operation.

Verification successful

The updateData object in projects.service.ts is correctly initialized and populated with necessary fields before being used in the database operation. The initialization includes id_project_connector and id_project, and additional properties are added based on connector.vertical and connector.name.

  • packages/api/src/@core/projects/projects.service.ts:53: const updateData: any = {
  • packages/api/src/@core/projects/projects.service.ts:66: updateData[propertyName + connector.name] = true;
  • packages/api/src/@core/projects/projects.service.ts:72: data: updateData,
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the `updateData` object is correctly populated and that all necessary fields are included in the database operation.

# Test: Search for the `updateData` object usage. Expect: Correct population and inclusion of necessary fields.
rg --type typescript $'updateData'

Length of output: 68



Script:

#!/bin/bash
# Description: Verify that the `updateData` object is correctly populated and that all necessary fields are included in the database operation.

# Test: Search for the `updateData` object usage. Expect: Correct population and inclusion of necessary fields.
rg --type ts 'updateData'

Length of output: 1116

packages/api/src/@core/connections-strategies/connections-strategies.service.ts (2)

Line range hint 341-387: The logging statements have been updated to use double quotes, which is consistent with TypeScript best practices. However, ensure that these logs provide enough context for debugging and consider adding more descriptive messages or additional logging if necessary.


233-235: The usage of CONNECTORS_METADATA to dynamically fetch scopes based on provider and vertical is a good practice. However, ensure that the scopes property is always defined in CONNECTORS_METADATA to avoid potential runtime errors.

Verification successful

The search results indicate that the scopes property is defined in multiple places, particularly within the packages/shared/src/connectors/metadata.ts file. This suggests that the scopes property is indeed present in the CONNECTORS_METADATA.

  • packages/shared/src/connectors/metadata.ts: Multiple instances of scopes are defined here.

Given this information, it appears that the scopes property is consistently defined in the relevant metadata, which should prevent potential runtime errors related to undefined scopes.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the `scopes` property is always defined in `CONNECTORS_METADATA`.

# Test: Search for the `scopes` property definition in `CONNECTORS_METADATA`. Expect: Definition present.
rg --type typescript $'scopes'

Length of output: 64



Script:

#!/bin/bash
# Description: Verify that the `scopes` property is always defined in `CONNECTORS_METADATA`.

# Test: Search for the `scopes` property definition in `CONNECTORS_METADATA`. Expect: Definition present.
rg --type ts 'scopes'

Length of output: 15826

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

  • Updated terminology from 'vertical' to 'category'
  • Corrected file paths for metadata references

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

Outside diff range and nitpick comments (1)
docs/open-source/contributors.mdx (1)

Line range hint 92-92: Correct abbreviation usage.

- (oauth, api key, basic etc) which is built by the Panora team
+ (oauth, api key, basic, etc.) which is built by the Panora team

In American English, abbreviations like "etc." require a period. This change aligns with standard writing conventions.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 33a52d2 and 885efd9.

Files selected for processing (1)
  • docs/open-source/contributors.mdx (5 hunks)
Additional context used
LanguageTool
docs/open-source/contributors.mdx

[uncategorized] ~66-~66: Possible missing comma found. (AI_HYDRA_LEO_MISSING_COMMA)
Context: ...Ie: Slack, Hubspot, Jira, Shopify ..._ First choose wisely which category the 3rd pa...


[typographical] ~89-~89: Consider adding a comma after ‘Actually’ for more clarity. (RB_LY_COMMA)
Context: ...ng the integration has not been built. Actually an integration is built in 2 parts : -...


[style] ~92-~92: In American English, abbreviations like “etc.” require a period. (ETC_PERIOD)
Context: ...ntication part** (oauth, api key, basic etc) which is built by the Panora team - th...

Additional comments not posted (3)
docs/open-source/contributors.mdx (3)

86-86: Add a comma for clarity.

- Actually an integration is built in 2 parts :
+ Actually, an integration is built in 2 parts:

Adding a comma after "Actually" improves the readability and flow of the sentence.

Likely invalid or redundant comment.


77-78: Ensure the link is accessible.

Please run this script to ensure that the link provided in the documentation is accessible and correct.

Verification successful

The link to categories.ts in the documentation is accessible.

  • The file packages/shared/src/categories.ts exists at the specified path.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the accessibility of the link to categories.ts.

# Test: Check if the file exists at the specified path.
if [[ -f "packages/shared/src/categories.ts" ]]; then
  echo "The link to categories.ts is accessible."
else
  echo "The link to categories.ts is not accessible. Please update or fix the link."
fi

Length of output: 135


234-234: Verify the script functionality.

Please run this script to ensure that it functions correctly and integrates the new service without issues.

Comment on lines +28 to +31
**Each custom 3rd party environment variable must be of the form `PROVIDER_category_SOFTWAREMODE_ATTRIBUTE` where**

- `PROVIDER` is any 3rd party name
- `VERTICAL` is for example [CRM, TICKETING, MARKETINGAUTOMATION, ...]
- `category` is for example [CRM, TICKETING, MARKETINGAUTOMATION, ...]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify the environment variable format.

The explanation of the environment variable format is clear, but it might be helpful to provide a brief description or link to documentation on what each component (PROVIDER, category, SOFTWAREMODE, ATTRIBUTE) represents. This could improve understanding for new contributors.

@@ -64,7 +64,7 @@

_Ie: Slack, Hubspot, Jira, Shopify ..._

First choose wisely which vertical the 3rd party belongs to among these:
First choose wisely which category the 3rd party belongs to among these:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comma for clarity.

- Ie: Slack, Hubspot, Jira, Shopify ...
+ Ie: Slack, Hubspot, Jira, Shopify, ...

This minor punctuation addition improves the readability of the list.

Committable suggestion was skipped due to low confidence.

@naelob naelob merged commit 5c604a2 into main Jun 8, 2024
10 of 14 checks passed
@naelob naelob deleted the feat/fix-project-connectors branch July 27, 2024 18:27
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.

2 participants