Skip to content

[Components] retool - new components #16702

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

jcortes
Copy link
Collaborator

@jcortes jcortes commented May 16, 2025

WHY

Resolves #15138

Summary by CodeRabbit

  • New Features

    • Added actions to create users, create organization user attributes, and trigger workflows via API.
    • Introduced a new Retool app integration with enhanced API request handling.
  • Chores

    • Updated package version to 0.1.0.
    • Introduced shared constants for API endpoints.
  • Refactor

    • Replaced and improved the Retool app integration module.
  • Other

    • Removed internal configuration and ignore files no longer needed.

@jcortes jcortes self-assigned this May 16, 2025
Copy link

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

Copy link
Contributor

coderabbitai bot commented May 16, 2025

"""

Walkthrough

This update introduces three new Retool action modules: "Create User," "Create Organization User Attribute," and "Trigger Workflow," each enabling API-based operations within Retool. It also adds a common constants module and a new Retool app integration, while removing a .gitignore and an older TypeScript app definition. The package version is incremented.

Changes

Files/Paths Change Summary
components/retool/actions/create-user/create-user.mjs
components/retool/actions/create-organization-user-attribute/create-organization-user-attribute.mjs
components/retool/actions/trigger-workflow/trigger-workflow.mjs
Added new action modules for creating users, creating organization user attributes, and triggering workflows via API calls.
components/retool/common/constants.mjs Added a new module exporting API base URL and version path constants.
components/retool/retool.app.mjs Added a new Retool app integration module with HTTP utility methods.
components/retool/app/retool.app.ts Removed the previous TypeScript-based Retool app definition.
components/retool/.gitignore Removed .gitignore file, allowing previously ignored files to be tracked.
components/retool/package.json Updated package version from 0.0.1 to 0.1.0.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant RetoolAction
    participant RetoolApp
    participant RetoolAPI

    User->>RetoolAction: Provide input properties
    RetoolAction->>RetoolApp: Call post() with API endpoint and data
    RetoolApp->>RetoolAPI: Send HTTP POST request
    RetoolAPI-->>RetoolApp: Return API response
    RetoolApp-->>RetoolAction: Return response data
    RetoolAction-->>User: Output summary and result
Loading

Assessment against linked issues

Objective Addressed Explanation
Implement "trigger-workflow" action: trigger workflow by ID, allow optional input parameters (#15138)
Implement "create-user" action: create user with required email, firstName, lastName; optional active, metadata, userType (#15138)
Implement "create-organization-user-attribute" action: create attribute with required name, label, dataType; optional defaultValue (#15138)

Poem

A hop, a leap, new code in tow,
Retool actions ready to go!
Users and workflows, attributes too,
Constants aligned, a version anew.
The garden of code grows neat and bright—
🐇 Cheers to shipping features right!

"""

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/retool/actions/create-organization-user-attribute/create-organization-user-attribute.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 Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:163:49)

components/retool/actions/create-user/create-user.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 Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:163:49)

components/retool/common/constants.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 Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:163:49)

  • 2 others

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 9e4eb32 and 9a2abb5.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • components/retool/.gitignore (0 hunks)
  • components/retool/actions/create-organization-user-attribute/create-organization-user-attribute.mjs (1 hunks)
  • components/retool/actions/create-user/create-user.mjs (1 hunks)
  • components/retool/actions/trigger-workflow/trigger-workflow.mjs (1 hunks)
  • components/retool/common/constants.mjs (1 hunks)
  • components/retool/package.json (1 hunks)
  • components/retool/retool.app.mjs (1 hunks)
💤 Files with no reviewable changes (1)
  • components/retool/.gitignore
🚧 Files skipped from review as they are similar to previous changes (6)
  • components/retool/package.json
  • components/retool/common/constants.mjs
  • components/retool/actions/trigger-workflow/trigger-workflow.mjs
  • components/retool/retool.app.mjs
  • components/retool/actions/create-user/create-user.mjs
  • components/retool/actions/create-organization-user-attribute/create-organization-user-attribute.mjs
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this 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.

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

🧹 Nitpick comments (7)
components/retool/actions/create-organization-user-attribute/create-organization-user-attribute.mjs (3)

40-44: Consider specifying API version path for consistency.

Unlike the create-user.mjs component which explicitly uses VERSION_PATH.V2, this component doesn't specify a version path in the POST request. For consistency and forward compatibility, consider adding the version path.

 createOrgUserAttribute(args = {}) {
   return this.app.post({
+    versionPath: constants.VERSION_PATH.V2,
     path: "/user_attributes",
     ...args,
   });
 },

47-66: Consider adding error handling.

The run method would benefit from error handling to provide meaningful feedback when API calls fail.

 async run({ $ }) {
   const {
     createOrgUserAttribute,
     name,
     label,
     dataType,
     defaultValue,
   } = this;

-  const response = await createOrgUserAttribute({
-    $,
-    data: {
-      name,
-      label,
-      dataType,
-      defaultValue,
-    },
-  });
-  $.export("$summary", `Successfully created organization user attribute with ID \`${response.data.id}\``);
-  return response;
+  try {
+    const response = await createOrgUserAttribute({
+      $,
+      data: {
+        name,
+        label,
+        dataType,
+        defaultValue,
+      },
+    });
+    $.export("$summary", `Successfully created organization user attribute with ID \`${response.data.id}\``);
+    return response;
+  } catch (error) {
+    $.export("$summary", `Failed to create organization user attribute: ${error.message}`);
+    throw error;
+  }
 },

1-2: Import constants module for version path usage.

To implement the version path suggestion, you'll need to import the constants module.

 import app from "../../retool.app.mjs";
+import constants from "../../common/constants.mjs";
components/retool/actions/create-user/create-user.mjs (1)

71-85: Consider adding error handling to the run method.

The run method would benefit from error handling to provide meaningful feedback when API calls fail.

 async run({ $ }) {
   const {
     createUser,
     email,
     firstName,
     lastName,
     active,
     metadata,
     userType,
   } = this;

-  const response = await createUser({
-    $,
-    data: {
-      email,
-      first_name: firstName,
-      last_name: lastName,
-      active,
-      metadata,
-      user_type: userType,
-    },
-  });
-
-  $.export("$summary", `Successfully created user with ID \`${response.data.id}\`.`);
-  return response;
+  try {
+    const response = await createUser({
+      $,
+      data: {
+        email,
+        first_name: firstName,
+        last_name: lastName,
+        active,
+        metadata,
+        user_type: userType,
+      },
+    });
+
+    $.export("$summary", `Successfully created user with ID \`${response.data.id}\`.`);
+    return response;
+  } catch (error) {
+    $.export("$summary", `Failed to create user: ${error.message}`);
+    throw error;
+  }
 },
components/retool/retool.app.mjs (1)

23-23: Consider making the debug flag configurable.

The debug flag is currently hard-coded to true, which can be useful during development but might generate excessive logs in production. Consider making this configurable based on environment or allowing it to be passed as a parameter.

- debug: true,
+ debug: args.debug || false,
components/retool/actions/trigger-workflow/trigger-workflow.mjs (2)

30-42: Clarify how the data parameter is used in the request.

The data parameter is passed through the spread operator in args, but it's not clear how it will be used in the actual request. Consider making its usage more explicit to improve readability and maintainability.

triggerWorkflow({
  workflowId, apiKey, ...args
}) {
  return this.app.post({
    versionPath: constants.VERSION_PATH.V2,
    path: `/workflows/${workflowId}/startTrigger`,
    headers: {
      "Content-Type": "application/json",
      "X-Workflow-Api-Key": apiKey,
    },
+    data: args.data, // Explicitly specify that data is passed as the request body
    ...args,
  });
},

52-57: Consider validating input parameters.

The workflowId and apiKey are required parameters, but there's no additional validation beyond their type being "string". Consider adding validation to ensure they're not empty and meet any format requirements.

const response = await triggerWorkflow({
  $,
+ workflowId: workflowId?.trim() ? workflowId : $.flow.exit("Workflow ID cannot be empty"),
+ apiKey: apiKey?.trim() ? apiKey : $.flow.exit("API Key cannot be empty"),
- workflowId,
- apiKey,
  data,
});
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 852838a and 9e4eb32.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • components/retool/.gitignore (0 hunks)
  • components/retool/actions/create-organization-user-attribute/create-organization-user-attribute.mjs (1 hunks)
  • components/retool/actions/create-user/create-user.mjs (1 hunks)
  • components/retool/actions/trigger-workflow/trigger-workflow.mjs (1 hunks)
  • components/retool/app/retool.app.ts (0 hunks)
  • components/retool/common/constants.mjs (1 hunks)
  • components/retool/package.json (1 hunks)
  • components/retool/retool.app.mjs (1 hunks)
💤 Files with no reviewable changes (2)
  • components/retool/.gitignore
  • components/retool/app/retool.app.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
🔇 Additional comments (7)
components/retool/common/constants.mjs (1)

1-10: Well-structured API constants module.

This module effectively centralizes API endpoint constants for the Retool integration. Using constants for the base URL and version paths is a good practice for maintainability and consistency across components.

components/retool/package.json (1)

3-3: Appropriate version bump for new features.

The version update from 0.0.1 to 0.1.0 follows semantic versioning principles for adding new features (the Retool action components) without breaking changes.

components/retool/actions/create-organization-user-attribute/create-organization-user-attribute.mjs (1)

1-67: Well-structured Retool action component.

The component follows good practices with clear property definitions and documentation.

components/retool/actions/create-user/create-user.mjs (2)

52-58: Good use of version path constants.

Explicitly specifying the API version path using the constants is a good practice for maintainability and future compatibility.


73-80: Proper camelCase to snake_case property mapping.

Good job mapping JavaScript camelCase property names to the API's expected snake_case format (firstName → first_name, lastName → last_name, userType → user_type).

components/retool/retool.app.mjs (1)

4-35: Well-structured app definition with clean HTTP utility methods.

The app definition follows Pipedream's patterns with clear separation of concerns. The methods are modular, reusable, and make good use of the authentication context. The implementation enables consistent API interactions for all Retool actions.

components/retool/actions/trigger-workflow/trigger-workflow.mjs (1)

4-61: Well-structured action component for triggering Retool workflows.

The component provides a clean interface for triggering Retool workflows with appropriate props and documentation links. The implementation correctly leverages the app module for API interactions.

@jcortes jcortes force-pushed the retool-new-components branch from 9e4eb32 to 9a2abb5 Compare May 16, 2025 21:34
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.

[Components] retool
1 participant