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

New Components - egnyte #15301

Merged
merged 6 commits into from
Jan 20, 2025
Merged

New Components - egnyte #15301

merged 6 commits into from
Jan 20, 2025

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Jan 14, 2025

Resolves #15293.

Note to QA: I wasn't able to get the webhooks endpoints to work without error, so I created the sources to use polling.

Summary by CodeRabbit

  • New Features

    • Added Egnyte integration with capabilities to:
      • Create folders
      • Upload files
      • Monitor folder and file changes
    • Implemented rate-limited API interactions for Egnyte
  • Improvements

    • Enhanced API request handling
    • Added structured error management for file and folder operations
  • Version Update

    • Bumped component version from 0.0.1 to 0.1.0

Copy link

vercel bot commented Jan 14, 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 Jan 16, 2025 7:46pm
pipedream-docs ⬜️ Ignored (Inspect) Jan 16, 2025 7:46pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jan 16, 2025 7:46pm

@michelle0927 michelle0927 added the ai-assisted Content generated by AI, with human refinement and modification label Jan 14, 2025
Copy link
Contributor

coderabbitai bot commented Jan 14, 2025

Walkthrough

This pull request introduces comprehensive functionality for the Egnyte integration, including new actions and sources for managing files and folders. The changes include creating a new module for creating folders, uploading files, implementing rate-limited API requests, and developing polling sources to detect new files and folders in Egnyte. The implementation adds methods to interact with the Egnyte API, manages dependencies, and provides structured error handling for various operations.

Changes

File Change Summary
components/egnyte/actions/create-folder/create-folder.mjs New module for creating folders in Egnyte
components/egnyte/actions/upload-file/upload-file.mjs New module for uploading files to Egnyte
components/egnyte/egnyte.app.mjs Added rate-limited API methods, removed authKeys, added _baseUrl, _makeRequest, getFolder, createFolder, and uploadFile methods
components/egnyte/package.json Updated version, added dependencies for platform, bottleneck, form-data, mime, and path
components/egnyte/sources/common/base.mjs New base module for monitoring folder updates
components/egnyte/sources/new-file-in-folder/new-file-in-folder.mjs New source for detecting new files in a folder
components/egnyte/sources/new-folder-added/new-folder-added.mjs New source for detecting new folder additions

Sequence Diagram

sequenceDiagram
    participant User
    participant EgnyteApp
    participant EgnyteAPI
    
    User->>EgnyteApp: Create Folder/Upload File
    EgnyteApp->>EgnyteAPI: Make Rate-Limited Request
    EgnyteAPI-->>EgnyteApp: Return Response
    EgnyteApp-->>User: Confirm Action
Loading

Assessment against linked issues

Objective Addressed Explanation
Create folder action
Upload file action
New file in folder polling source
Folder path specification

Possibly related PRs

Suggested labels

user submitted

Suggested reviewers

  • jcortes

Poem

🐰 In Egnyte's digital domain,
Folders dance, files take their lane,
Rate-limited requests, smooth and light,
A rabbit's code shines ever bright!
Integration magic unfurled! 🚀


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.

@michelle0927 michelle0927 marked this pull request as ready for review January 16, 2025 19:50
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: 7

🧹 Nitpick comments (5)
components/egnyte/egnyte.app.mjs (1)

49-56: Add content type validation for file uploads.

The uploadFile method should validate or specify content types to ensure proper file handling.

 uploadFile({
   folderPath, filename, ...opts
 }) {
   return this._makeRequest({
     method: "POST",
     path: `/fs-content/${folderPath}/${filename}`,
+    headers: {
+      'Content-Type': opts.contentType || 'application/octet-stream',
+    },
     ...opts,
   });
 }
components/egnyte/sources/new-file-in-folder/new-file-in-folder.mjs (1)

16-22: Consider adding more metadata fields for better event tracking.

The current metadata includes basic file information. Consider adding:

  • File size
  • File type/extension
  • Last modified timestamp
 generateMeta(file) {
   return {
     id: file.entry_id,
-    summary: `New file: ${file.name}`,
+    summary: `New file: ${file.name} (${file.size} bytes)`,
     ts: file.uploaded,
+    additional_info: {
+      size: file.size,
+      extension: file.name.split('.').pop(),
+      last_modified: file.last_modified,
+    },
   };
 }
components/egnyte/sources/new-folder-added/new-folder-added.mjs (2)

16-22: Align metadata structure with file source.

For consistency, consider adding similar additional metadata fields as suggested for the file source.

 generateMeta(folder) {
   return {
     id: folder.folder_id,
-    summary: `New folder: ${folder.name}`,
+    summary: `New folder: ${folder.name} (${folder.path})`,
     ts: folder.uploaded,
+    additional_info: {
+      path: folder.path,
+      parent_id: folder.parent_id,
+      last_modified: folder.last_modified,
+    },
   };
 }

7-8: Consider incrementing the version number.

The current version is set to "0.0.1". Since this is part of a new feature set, consider starting with "1.0.0".

-  version: "0.0.1",
+  version: "1.0.0",
components/egnyte/actions/upload-file/upload-file.mjs (1)

13-25: Add file size and type restrictions.

Consider adding props to restrict file size and allowed file types for better security and reliability.

   props: {
     egnyte,
     filePath: {
       type: "string",
       label: "File Path",
       description: "The path to a file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp)",
+      validate: (filePath) => {
+        const stats = fs.statSync(filePath);
+        if (stats.size > 100 * 1024 * 1024) // 100MB
+          throw new Error('File size exceeds 100MB limit');
+      },
     },
     folderPath: {
       type: "string",
       label: "Folder Path",
       description: "The full path to the folder where the file should be uploaded. Example: `/Shared/Documents",
     },
+    allowedMimeTypes: {
+      type: "string[]",
+      label: "Allowed File Types",
+      description: "List of allowed MIME types",
+      optional: true,
+    },
   },
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 67643a1 and f1166c4.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • components/egnyte/actions/create-folder/create-folder.mjs (1 hunks)
  • components/egnyte/actions/upload-file/upload-file.mjs (1 hunks)
  • components/egnyte/egnyte.app.mjs (1 hunks)
  • components/egnyte/package.json (2 hunks)
  • components/egnyte/sources/common/base.mjs (1 hunks)
  • components/egnyte/sources/new-file-in-folder/new-file-in-folder.mjs (1 hunks)
  • components/egnyte/sources/new-folder-added/new-folder-added.mjs (1 hunks)
⏰ 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/egnyte/egnyte.app.mjs (1)

3-7: Consider adjusting rate limits based on Egnyte's API documentation.

The current implementation limits to 2 requests per second (500ms minimum time). Verify this against Egnyte's API rate limits to ensure optimal throughput while maintaining compliance.

components/egnyte/package.json (1)

3-3: Consider using SemVer for version bump.

The version bump to 0.1.0 suggests new features. Ensure this follows semantic versioning principles based on the nature of changes.

✅ Verification successful

Version 0.1.0 is appropriate for this new component

This is an initial release of a new Egnyte integration package with multiple features (file/folder operations and webhooks). The 0.1.0 version correctly follows SemVer principles for a pre-1.0 component with substantial functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check commit history to verify the nature of changes
git log --oneline | grep -i "breaking\|feat\|fix" | head -n 5

Length of output: 0


Script:

#!/bin/bash
# Check the previous version and changes
git diff HEAD~1 components/egnyte/package.json

# Look for new files or significant changes in the component
git diff --name-status HEAD~1 components/egnyte/

# Check the contents of the component directory
fd . components/egnyte/ -t f

Length of output: 480


Script:

#!/bin/bash
# Check if this is a new component
git log --oneline components/egnyte/

# View package.json content
cat components/egnyte/package.json

Length of output: 555

@michelle0927 michelle0927 merged commit ac79b00 into master Jan 20, 2025
11 checks passed
@michelle0927 michelle0927 deleted the issue-15293 branch January 20, 2025 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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] egnyte
2 participants