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

feat: update google-drive sync template to support more file formats #2665

Closed

Conversation

homanp
Copy link

@homanp homanp commented Sep 2, 2024

Describe your changes

Fixes #2661

Checklist before requesting a review (skip if just adding/editing APIs & templates)

  • I added tests, otherwise the reason is:
  • I added observability, otherwise the reason is:
  • I added analytics, otherwise the reason is:

Summary by CodeRabbit

  • New Features

    • Enhanced file synchronization with Google Drive by introducing a refined filtering process for supported MIME types.
    • Improved error handling for unsupported file types to ensure smoother processing.
  • Bug Fixes

    • Resolved issues related to metadata handling and file processing logic, ensuring only acceptable file types are processed.

Copy link

coderabbitai bot commented Sep 2, 2024

Walkthrough

The changes made in the integration-templates/google-drive/syncs/documents.ts file enhance the handling of Google Drive files by updating the MIME type mappings and improving the filtering process for supported file types. The modifications streamline the logic for processing documents and spreadsheets, ensuring more robust error handling and clearer code structure.

Changes

File Path Change Summary
integration-templates/google-drive/syncs/documents.ts Renamed mimeTypeMapping to structuredMimeTypeMapping and added whiteListedMimeTypes for filtering. Updated error handling and processing logic for files.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GoogleDrive
    participant SyncService

    User->>SyncService: Request Sync
    SyncService->>GoogleDrive: Fetch Files
    GoogleDrive-->>SyncService: Return File List
    SyncService->>SyncService: Filter Files by MIME Type
    SyncService->>SyncService: Process Supported Files
    SyncService-->>User: Sync Complete
Loading

Assessment against linked issues

Objective Addressed Explanation
Google Drive sync should include Google Sheets files (#2661)

🐇 In the meadow, I hop and play,
With files and sheets, we sync away!
MIME types now dance, all neat and bright,
Processing files, oh what a delight!
Hooray for changes, let’s cheer and sing,
For every document, joy they bring! 🎉


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

@homanp homanp changed the title Update google-drive sync template to support more file formats feat: update google-drive sync template to support more file formats Sep 2, 2024
Copy link

@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 2ffec40 and 2d498f7.

Files selected for processing (1)
  • integration-templates/google-drive/syncs/documents.ts (5 hunks)
Additional comments not posted (6)
integration-templates/google-drive/syncs/documents.ts (6)

15-19: LGTM!

The changes to the structuredMimeTypeMapping constant are approved. The additional MIME types improve the handling of different file types.


22-33: LGTM!

The introduction of the whiteListedMimeTypes constant is approved. It improves the clarity and maintainability of the code by maintaining a set of acceptable MIME types for filtering files.


39-39: LGTM!

The change to use double quotes for the error message is approved. It improves consistency in the code.


69-81: LGTM!

The changes to the file processing logic are approved. Utilizing the whiteListedMimeTypes set for filtering files simplifies the conditional checks and improves maintainability. Passing the file's MIME type to the fetchDocumentContent function ensures that the appropriate export type is used.


107-112: LGTM!

The changes to skip unsupported file types and log the skipped files are approved. This ensures that only supported file types are processed and provides better observability.


Line range hint 141-170: LGTM!

The changes to the fetchDocumentContent function are approved. Utilizing the structuredMimeTypeMapping for determining the export MIME type improves the handling of different file types. Logging and skipping unsupported MIME types prevents unnecessary processing and provides better error handling.

Copy link
Collaborator

@TBonnin TBonnin left a comment

Choose a reason for hiding this comment

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

thank you for your contribution @homanp
Can you revert the formatting changes please? Otherwise it looks good, I only made one comment

integration-templates/google-drive/syncs/documents.ts Outdated Show resolved Hide resolved
khaliqgant pushed a commit that referenced this pull request Sep 17, 2024
## Describe your changes

- Improve `google-drive` integration templates
- Follow up of [2665](#2665)

## Issue ticket number and link

[EXT-145](https://linear.app/nango/issue/EXT-145/refractor-google-drive-integration)
@khaliqgant
Copy link
Member

@hassan254-prog what should happen with this PR? I see you made a pr that referenced this one? Did that incorporate these changes?

@hassan254-prog
Copy link
Contributor

@hassan254-prog what should happen with this PR? I see you made a pr that referenced this one? Did that incorporate these changes?

Yes, the merged PR incorporated the changes. We now have a sync that fetches the metadata and an action that fetches the content of the document.

@khaliqgant
Copy link
Member

@hassan254-prog what should happen with this PR? I see you made a pr that referenced this one? Did that incorporate these changes?

Yes, the merged PR incorporated the changes. We now have a sync that fetches the metadata and an action that fetches the content of the document.

Thanks, closing this!

@khaliqgant khaliqgant closed this Sep 26, 2024
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.

Google Drive sync does not take into account Google Sheets files
5 participants