Skip to content

Fix Airtable URL field asking for object input #14835

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 4 commits into from
Dec 4, 2024

Conversation

js07
Copy link
Contributor

@js07 js07 commented Dec 4, 2024

WHY

Additional props (e.g. in the Update Record action) with the URL Airtable field type are given a prop type of "object". Based on the Airtable docs, the type should be "string", not "object".

Context: https://pipedream-users.slack.com/archives/CMZG4EBJ9/p1733276186749089

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new viewId property for enhanced record retrieval in the listing action.
    • Added flexible search options with a new searchMethod property, allowing users to choose between searching by field and value or by formula.
  • Version Updates

    • Incremented version numbers for multiple components to reflect updates, including actions for creating, updating, and deleting records, as well as various sources.
  • Bug Fixes

    • Corrected the description for the fieldIds property to improve clarity in the new-or-modified-records source.

These updates enhance functionality and maintain the stability of existing features.

Copy link

vercel bot commented Dec 4, 2024

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) Dec 4, 2024 8:31pm
pipedream-docs ⬜️ Ignored (Inspect) Dec 4, 2024 8:31pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Dec 4, 2024 8:31pm

Copy link
Contributor

coderabbitai bot commented Dec 4, 2024

Walkthrough

The pull request includes updates to multiple files within the airtable_oauth component, primarily focusing on version increments across various action and source files. The changes involve updating version numbers from "0.0.6" to "0.0.7" or "0.0.8", with some files reflecting a version change to "0.0.9". Additionally, the list-records-in-view action introduces a new property viewId, and the search-records action enhances functionality with new properties for flexible search options. Other files maintain their existing logic and structure without further modifications.

Changes

File Change Summary
components/airtable_oauth/actions/create-comment/create-comment.mjs Version updated from "0.0.6" to "0.0.7".
components/airtable_oauth/actions/create-field/create-field.mjs Version updated from "0.0.6" to "0.0.7".
components/airtable_oauth/actions/create-multiple-records/create-multiple-records.mjs Version updated from "0.0.6" to "0.0.7".
components/airtable_oauth/actions/create-or-update-record/create-or-update-record.mjs Version updated from "0.0.7" to "0.0.8".
components/airtable_oauth/actions/create-single-record/create-single-record.mjs Version updated from "0.0.7" to "0.0.8".
components/airtable_oauth/actions/create-table/create-table.mjs Version updated from "0.0.6" to "0.0.7".
components/airtable_oauth/actions/delete-record/delete-record.mjs Version updated from "0.0.6" to "0.0.7".
components/airtable_oauth/actions/get-record-or-create/get-record-or-create.mjs Version updated from "0.0.7" to "0.0.8".
components/airtable_oauth/actions/get-record/get-record.mjs Version updated from "0.0.7" to "0.0.8".
components/airtable_oauth/actions/list-records-in-view/list-records-in-view.mjs Version updated from "0.0.6" to "0.0.7"; new property viewId added.
components/airtable_oauth/actions/list-records/list-records.mjs Version updated from "0.0.6" to "0.0.7".
components/airtable_oauth/actions/search-records/search-records.mjs Version updated from "0.0.8" to "0.0.9"; new properties searchMethod, searchFormula, fieldName, and value added.
components/airtable_oauth/actions/update-comment/update-comment.mjs Version updated from "0.0.6" to "0.0.7".
components/airtable_oauth/actions/update-field/update-field.mjs Version updated from "0.0.6" to "0.0.7".
components/airtable_oauth/actions/update-record/update-record.mjs Version updated from "0.0.7" to "0.0.8".
components/airtable_oauth/actions/update-table/update-table.mjs Version updated from "0.0.6" to "0.0.7".
components/airtable_oauth/common/constants.mjs URL field type reordered within FieldType enum.
components/airtable_oauth/common/utils.mjs FieldType.URL updated to return type "string" instead of "object".
components/airtable_oauth/package.json Version updated from "0.3.0" to "0.3.1".
components/airtable_oauth/sources/new-field/new-field.mjs Version updated from "0.0.6" to "0.0.7".
components/airtable_oauth/sources/new-modified-or-deleted-records-instant/new-modified-or-deleted-records-instant.mjs Version updated from "0.0.1" to "0.0.2".
components/airtable_oauth/sources/new-modified-or-deleted-records/new-modified-or-deleted-records.mjs Version updated from "0.0.6" to "0.0.7".
components/airtable_oauth/sources/new-or-modified-field/new-or-modified-field.mjs Version updated from "0.0.6" to "0.0.7".
components/airtable_oauth/sources/new-or-modified-records-in-view/new-or-modified-records-in-view.mjs Version updated from "0.0.6" to "0.0.7".
components/airtable_oauth/sources/new-or-modified-records/new-or-modified-records.mjs Version updated from "0.0.8" to "0.0.9"; corrected description for fieldIds.
components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs Version updated from "0.0.6" to "0.0.7".
components/airtable_oauth/sources/new-records/new-records.mjs Version updated from "0.0.6" to "0.0.7".

Suggested labels

bug, dependencies, javascript

Suggested reviewers

  • jcortes
  • michelle0927

🐰 Hopping through the code with glee,
Version updates, oh what a spree!
New fields and records, all in a row,
Airtable magic continues to grow!
With each little change, we dance and play,
Celebrating updates in a joyful way! 🌟


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

@js07 js07 marked this pull request as ready for review December 4, 2024 20:33
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 (2)
components/airtable_oauth/sources/new-or-modified-records/new-or-modified-records.mjs (1)

Line range hint 31-31: Fix typo in fieldIds description

There's a typo in the description: "spedific" should be "specific".

-      description: "Identifiers of spedific fields/columns to watch for updates",
+      description: "Identifiers of specific fields/columns to watch for updates",
components/airtable_oauth/actions/search-records/search-records.mjs (1)

Line range hint 89-102: Consider adding URL validation for URL fields

While the type-based formula generation is good, consider adding specific validation for URL fields to ensure the search value is a valid URL when the field type is URL.

Here's a suggested enhancement:

    let filterByFormula = this.searchFormula;
    if (!this.searchFormula) {
      const type = fieldTypeToPropType(field.type);
+     // Special handling for URL fields
+     if (field.type === FieldType.URL && this.value) {
+       try {
+         new URL(this.value); // Validate URL format
+       } catch (e) {
+         throw new Error(`Invalid URL format: ${this.value}`);
+       }
+     }
      filterByFormula = type === "string"
        ? `FIND("${this.value}", {${this.fieldName}})`
        : type === "boolean"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between e2445aa and 09c60ed.

📒 Files selected for processing (27)
  • components/airtable_oauth/actions/create-comment/create-comment.mjs (1 hunks)
  • components/airtable_oauth/actions/create-field/create-field.mjs (1 hunks)
  • components/airtable_oauth/actions/create-multiple-records/create-multiple-records.mjs (1 hunks)
  • components/airtable_oauth/actions/create-or-update-record/create-or-update-record.mjs (1 hunks)
  • components/airtable_oauth/actions/create-single-record/create-single-record.mjs (1 hunks)
  • components/airtable_oauth/actions/create-table/create-table.mjs (1 hunks)
  • components/airtable_oauth/actions/delete-record/delete-record.mjs (1 hunks)
  • components/airtable_oauth/actions/get-record-or-create/get-record-or-create.mjs (1 hunks)
  • components/airtable_oauth/actions/get-record/get-record.mjs (1 hunks)
  • components/airtable_oauth/actions/list-records-in-view/list-records-in-view.mjs (1 hunks)
  • components/airtable_oauth/actions/list-records/list-records.mjs (1 hunks)
  • components/airtable_oauth/actions/search-records/search-records.mjs (1 hunks)
  • components/airtable_oauth/actions/update-comment/update-comment.mjs (1 hunks)
  • components/airtable_oauth/actions/update-field/update-field.mjs (1 hunks)
  • components/airtable_oauth/actions/update-record/update-record.mjs (1 hunks)
  • components/airtable_oauth/actions/update-table/update-table.mjs (1 hunks)
  • components/airtable_oauth/common/constants.mjs (1 hunks)
  • components/airtable_oauth/common/utils.mjs (1 hunks)
  • components/airtable_oauth/package.json (1 hunks)
  • components/airtable_oauth/sources/new-field/new-field.mjs (1 hunks)
  • components/airtable_oauth/sources/new-modified-or-deleted-records-instant/new-modified-or-deleted-records-instant.mjs (1 hunks)
  • components/airtable_oauth/sources/new-modified-or-deleted-records/new-modified-or-deleted-records.mjs (1 hunks)
  • components/airtable_oauth/sources/new-or-modified-field/new-or-modified-field.mjs (1 hunks)
  • components/airtable_oauth/sources/new-or-modified-records-in-view/new-or-modified-records-in-view.mjs (1 hunks)
  • components/airtable_oauth/sources/new-or-modified-records/new-or-modified-records.mjs (1 hunks)
  • components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs (1 hunks)
  • components/airtable_oauth/sources/new-records/new-records.mjs (1 hunks)
✅ Files skipped from review due to trivial changes (20)
  • components/airtable_oauth/actions/get-record/get-record.mjs
  • components/airtable_oauth/actions/update-record/update-record.mjs
  • components/airtable_oauth/common/constants.mjs
  • components/airtable_oauth/actions/create-table/create-table.mjs
  • components/airtable_oauth/package.json
  • components/airtable_oauth/actions/create-single-record/create-single-record.mjs
  • components/airtable_oauth/actions/list-records/list-records.mjs
  • components/airtable_oauth/actions/update-comment/update-comment.mjs
  • components/airtable_oauth/sources/new-modified-or-deleted-records-instant/new-modified-or-deleted-records-instant.mjs
  • components/airtable_oauth/actions/create-field/create-field.mjs
  • components/airtable_oauth/actions/create-comment/create-comment.mjs
  • components/airtable_oauth/sources/new-or-modified-records-in-view/new-or-modified-records-in-view.mjs
  • components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs
  • components/airtable_oauth/sources/new-records/new-records.mjs
  • components/airtable_oauth/actions/delete-record/delete-record.mjs
  • components/airtable_oauth/actions/create-multiple-records/create-multiple-records.mjs
  • components/airtable_oauth/sources/new-or-modified-field/new-or-modified-field.mjs
  • components/airtable_oauth/actions/update-table/update-table.mjs
  • components/airtable_oauth/sources/new-field/new-field.mjs
  • components/airtable_oauth/actions/create-or-update-record/create-or-update-record.mjs
🔇 Additional comments (6)
components/airtable_oauth/actions/get-record-or-create/get-record-or-create.mjs (2)

9-9: LGTM: Version bump is appropriate

The version increment from "0.0.7" to "0.0.8" follows semantic versioning for bug fixes.


Line range hint 1-58: Verify the relevance of changes to PR objectives

The PR's main objective is to fix the Airtable URL field prop type, but this file doesn't contain any URL field related changes. Please verify if this file needs to be included in this PR.

Let's search for URL field related changes in the codebase:

components/airtable_oauth/common/utils.mjs (1)

42-42: Correct change to URL field type mapping

The change from "object" to "string" for FieldType.URL aligns with Airtable's documentation and is logically correct as URLs are string values.

Let's verify the impact of this change on existing implementations:

✅ Verification successful

Change to URL field type is safe to proceed

The change from "object" to "string" for FieldType.URL is safe based on the codebase analysis:

  1. The fieldTypeToPropType function is used in three places:

    • In search-records action for building search formulas, where URL fields will now use the string-based FIND formula, which is correct
    • In the app for filtering fields by type
    • In utils.mjs for generating prop definitions
  2. The change aligns with how URL fields are actually handled in the search functionality, where they're treated as string values in formulas.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any direct usage of URL fields in the codebase
rg -l "FieldType\.URL" --type js --type mjs

# Search for potential field type checks or URL field handling
rg -l "field\.type\s*===?\s*['\"]URL['\"]" --type js --type mjs

Length of output: 171


Script:

#!/bin/bash
# Search for any direct usage of URL fields in the codebase, including .mjs files
rg -l "FieldType\.URL" --type-add 'mjs:*.mjs' --type mjs --type js

# Search for potential field type checks or URL field handling
rg -l "field\.type\s*===?\s*['\"]URL['\"]" --type-add 'mjs:*.mjs' --type mjs --type js

# Look for any usage of fieldTypeToPropType function
rg -l "fieldTypeToPropType" --type-add 'mjs:*.mjs' --type mjs --type js

Length of output: 436


Script:

#!/bin/bash
# Check how fieldTypeToPropType is used in the files that import it
rg -A 5 "fieldTypeToPropType" --type-add 'mjs:*.mjs' --type mjs --type js

# Look at the implementation of search-records action to see if it handles URL fields
cat components/airtable_oauth/actions/search-records/search-records.mjs

Length of output: 8523

components/airtable_oauth/actions/search-records/search-records.mjs (1)

8-8: Version bump is appropriate

The increment to version 0.0.9 is appropriate given the change in URL field type handling.

components/airtable_oauth/actions/update-field/update-field.mjs (1)

8-8: Verify if version bump corresponds to URL field changes

The version bump to 0.0.7 is present, but the changes related to fixing the Airtable URL field prop type (from object to string) mentioned in the PR description are not visible in this file.

✅ Verification successful

Version bump is consistent with URL field type change

Looking at the code, I can confirm that the version bump is indeed related to the URL field type change. The constants.mjs file shows that the URL field type is correctly defined as a string type, and the utils.mjs file confirms that URL fields are properly mapped to string prop types in the fieldTypeToPropType function. This version bump appears to be part of a coordinated update across multiple components in the airtable_oauth integration.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for URL field type definitions in the codebase
rg -l "URL.*field.*type" --type js

# Search for recent changes related to URL fields
git log -G "URL.*field.*type" --since="1 month ago" --pretty=format:"%h %s" --patch

Length of output: 36


Script:

#!/bin/bash
# Let's try different search patterns to find URL field related code
rg -i "url.*field" --type js -A 2

# Also search for any field type definitions in the component
fd . components/airtable_oauth -e js -e mjs -x rg -l "field.*type"

# Look for changes in the component directory
fd . components/airtable_oauth -e js -e mjs -x rg -l "version.*0\.0\.[67]"

Length of output: 1688


Script:

#!/bin/bash
# Let's check the field type definitions in the common files and create-field action
cat components/airtable_oauth/common/constants.mjs
cat components/airtable_oauth/actions/create-field/create-field.mjs

# Also check the utils file for any field type handling
cat components/airtable_oauth/common/utils.mjs

# Check the app file for field type definitions
cat components/airtable_oauth/airtable_oauth.app.mjs

Length of output: 19744

components/airtable_oauth/actions/list-records-in-view/list-records-in-view.mjs (1)

Line range hint 13-23: LGTM: Well-structured viewId property definition

The addition of the viewId property is well-structured:

  • Properly uses propDefinition from common.props.airtable
  • Correctly extracts baseId and tableId from context
  • Includes withLabel for better UX

Let's verify the viewId property definition in the common props:

✅ Verification successful

LGTM: The viewId property definition is correctly implemented

The viewId property definition in the code matches the app's propDefinitions:

  • It correctly references the viewId from airtable_oauth.app.mjs
  • The property accepts baseId and tableId parameters as required by the app's viewId options function
  • The implementation properly passes the values needed for view lookup
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the viewId property definition in common props
# Expected: Should find the viewId property definition in common.props.airtable

# Search for viewId definition in common props
ast-grep --pattern 'viewId: {
  $$$
}'

# Search for any usage of this property
rg -l 'viewId.*propDefinition.*airtable'

Length of output: 83


Script:

#!/bin/bash
# Let's try a different approach to find the viewId definition and its usage

# Search for files containing "viewId" in the components/airtable_oauth directory
fd . components/airtable_oauth -t f -x rg -l "viewId"

# Search for common props file in airtable directory
fd common.* components/airtable_oauth

# Once we find the common props file, we'll examine its content
fd common.* components/airtable_oauth -x cat {}

# Search for any propDefinition usage with viewId
rg "viewId.*propDefinition" -A 5

Length of output: 4769


Script:

#!/bin/bash
# Let's check the airtable_oauth.app.mjs file since it's likely to contain the propDefinitions
cat components/airtable_oauth/airtable_oauth.app.mjs

# Also let's specifically look for viewId definition in this file
rg "viewId.*:" -A 10 components/airtable_oauth/airtable_oauth.app.mjs

Length of output: 14120

Copy link
Collaborator

@danhsiung danhsiung left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for finding and fixing this!

@js07 js07 merged commit 3ecb4ed into master Dec 4, 2024
11 checks passed
@js07 js07 deleted the fix-airtable-url-field-type branch December 4, 2024 20:44
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants