-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[BUG] Airtable - Update Record: Asignee field #16192
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThis PR primarily increments version numbers for multiple Airtable OAuth action and source modules with no changes to their core functionality. In addition, it updates the asynchronous handling in the common record creation and update flows by replacing synchronous calls with Changes
Sequence Diagram(s)sequenceDiagram
participant C as Caller
participant CA as CommonActions (createRecord/updateRecord)
participant CU as CommonUtils (makeRecord)
participant MF as mapFieldTypes
participant BS as buildSingleCollaboratorField
C->>CA: call createRecord(ctx)
CA->>CU: await makeRecord(ctx)
CU->>MF: Request field types asynchronously
MF-->>CU: Return field type mapping
alt Field is SINGLE_COLLABORATOR
CU->>BS: Process collaborator field value
BS-->>CU: Return structured collaborator data
end
CU-->>CA: Return constructed record
CA-->>C: Return processed record
Assessment against linked issues
Suggested reviewers
Poem
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
components/airtable_oauth/actions/create-table/create-table.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/airtable_oauth/actions/create-comment/create-comment.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs components/airtable_oauth/actions/create-multiple-records/create-multiple-records.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 (5)
components/airtable_oauth/actions/update-field/update-field.mjs (1)
8-8: Version Bump: Updated to "0.0.10"The version update is straightforward and consistent with other module updates.
Note: In the
fieldIdproperty’s propDefinition (lines 13–16), the identifier"sortFieldId"is used. Please confirm that using"sortFieldId"instead of"fieldId"is intentional and correctly maps the user input to the expected field identifier during updates.components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs (1)
2-2: Optional: Evaluate Moment.js UsageThe module imports Moment.js (line 2) for timestamp handling. Although Moment.js is widely used, consider exploring lighter alternatives (such as Day.js) in the future if reducing bundle size or improving performance becomes a priority.
components/airtable_oauth/common/utils.mjs (3)
124-138: Good implementation of async record creation with field type handlingThe change to make
makeRecordan async function that handles special field types is appropriate. This improves the handling of collaborator fields by properly formatting them based on value type.Consider adding error handling for robustness:
async function makeRecord(ctx) { let record = {}; - const fieldTypes = await mapFieldTypes(ctx); + let fieldTypes = {}; + try { + fieldTypes = await mapFieldTypes(ctx); + } catch (err) { + console.error("Failed to fetch field types:", err); + // Proceed with empty fieldTypes object + } for (const key of Object.keys(ctx)) { // Rest of the function remains the same
140-152: Consider performance optimization for field type mappingThe
mapFieldTypesfunction makes an API call to retrieve table schema for every record creation, which could impact performance in high-volume scenarios.Consider implementing a caching mechanism to reduce API calls:
+ // Cache for field types by tableId to reduce API calls + const fieldTypesCache = {}; + async function mapFieldTypes(ctx) { const baseId = ctx.baseId?.value ?? ctx.baseId; const tableId = ctx.tableId?.value ?? ctx.tableId; + + // Return cached field types if available + const cacheKey = `${baseId}:${tableId}`; + if (fieldTypesCache[cacheKey]) { + return fieldTypesCache[cacheKey]; + } + const { tables } = await ctx.airtable.listTables({ baseId, }); const tableSchema = tables.find(({ id }) => id === tableId); + if (!tableSchema) { + throw new Error(`Table with ID ${tableId} not found in base ${baseId}`); + } const fieldTypes = {}; for (const field of tableSchema?.fields ?? []) { fieldTypes[field.name] = field.type; } + // Cache the result + fieldTypesCache[cacheKey] = fieldTypes; return fieldTypes; }
154-164: Good implementation for collaborator field handlingThe email validation and field builder for collaborator fields addresses the specific requirements of Airtable's API, which needs different formats depending on whether an email or ID is provided.
Add JSDoc comments to improve code documentation:
+ /** + * Validates if a string is an email address using a simple regex + * @param {string} str - String to validate + * @returns {boolean} True if string matches email pattern + */ const isEmail = (str) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(str); + /** + * Builds a collaborator field object for Airtable API + * For email addresses, creates an object with an email property + * For non-email values, assumes it's an ID and creates an object with an id property + * @param {string} value - Email address or ID + * @returns {object} Properly formatted collaborator field object + */ function buildSingleCollaboratorField(value) { return isEmail(value) ? { email: value, } : { id: value, }; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 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/actions.mjs(2 hunks)components/airtable_oauth/common/utils.mjs(1 hunks)components/airtable_oauth/package.json(2 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)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
🔇 Additional comments (26)
components/airtable_oauth/sources/new-records/new-records.mjs (1)
8-8: Version Update Consistency
The version number has been incremented to"1.0.2", which aligns with our coordinated release bump across similar Airtable modules. No functional changes were introduced in this file.components/airtable_oauth/sources/new-or-modified-field/new-or-modified-field.mjs (1)
8-9: Consistent Version Increment
The module’s version has been updated to"1.0.2", ensuring uniformity with other related modules. The core functionality and structure remain unchanged.components/airtable_oauth/sources/new-field/new-field.mjs (1)
8-8: Version Bump Confirmed
The version number has been updated to"1.0.2", which is consistent with the overall version update strategy seen across the project. There are no changes to the module’s behavior except the version bump.components/airtable_oauth/sources/new-or-modified-records/new-or-modified-records.mjs (1)
9-9: Validated Version Update
The version property is now set to"1.0.2". This update is in line with the changes implemented in similar modules. All properties (including thepropsandmethods) continue to function as expected.components/airtable_oauth/sources/new-or-modified-records-in-view/new-or-modified-records-in-view.mjs (1)
9-9: Record-in-View Version Bump
The version has been incremented from"0.0.11"to"0.0.12", which is clearly consistent with the coordinated version updates across the codebase. Additionally, the asynchronous implementation of therunmethod is well-structured and correctly awaits asynchronous operations.components/airtable_oauth/sources/new-modified-or-deleted-records-instant/new-modified-or-deleted-records-instant.mjs (1)
11-11: Version Update Confirmation
The version for this source module has been updated to"0.1.2", which is consistent with other related modules. No changes to functionality were made.components/airtable_oauth/actions/list-records/list-records.mjs (1)
9-9: Version Increment Validation
The version number is updated to"0.0.10". This small version bump aligns with the coordinated versioning effort across Airtable OAuth actions.components/airtable_oauth/actions/get-record/get-record.mjs (1)
9-9: Consistent Version Update
The version has changed to"0.0.11". Since no functionality was modified beyond this, please ensure that any external dependencies on versioning are updated accordingly.components/airtable_oauth/actions/update-record/update-record.mjs (1)
9-9: Synchronized Version Bump
The version is updated to"0.0.11", consistent with changes across related modules. The ESLint comments indicate property labeling conventions, which appear acceptable for this context.components/airtable_oauth/actions/create-field/create-field.mjs (1)
8-8: Version Update Verification
The module’s version has been incremented to"0.1.2". All changes in this file are limited to versioning, and the field creation logic remains unchanged.components/airtable_oauth/actions/create-table/create-table.mjs (1)
7-7: Version Update: Consistent Version BumpThe
versionproperty has been updated to"0.0.10", which aligns with the coordinated versioning effort across similar Airtable OAuth modules. No functionality or logic has been modified.components/airtable_oauth/actions/list-records-in-view/list-records-in-view.mjs (1)
9-9: Version Update: Consistent Version BumpThe module’s version has been updated to
"0.0.10". This change is straightforward and maintains consistency with the versioning updates in other modules.components/airtable_oauth/actions/delete-record/delete-record.mjs (1)
8-8: Version Update: Consistent Version BumpThe version number is now set to
"0.0.10", ensuring uniformity with the rest of the Airtable OAuth components. There are no other changes affecting functionality.components/airtable_oauth/actions/create-single-record/create-single-record.mjs (1)
9-9: Version Update: Consistent Version BumpThe version has been incremented to
"0.0.11". This update follows the overall versioning progression seen across other modules in the codebase.components/airtable_oauth/actions/get-record-or-create/get-record-or-create.mjs (1)
9-9: Version Update: Consistent Version BumpThe version number is now updated to
"0.0.12", reflecting the advancing version scheme adopted in this set of modules. The change is non-functional and solely for version tracking purposes.components/airtable_oauth/actions/search-records/search-records.mjs (1)
8-8: Version Bump: Updated to "0.0.12"The version number update aligns with the overall coordinated release strategy for Airtable OAuth modules. There are no changes to functionality, but please ensure that the related documentation and release notes reflect this update.
components/airtable_oauth/actions/create-comment/create-comment.mjs (1)
7-7: Version Bump: Updated to "0.0.10"This version bump is consistent with similar updates across related action modules. No functional modifications are introduced.
components/airtable_oauth/actions/update-comment/update-comment.mjs (1)
7-7: Version Bump: Updated to "0.0.10"The version increment aligns with the coordinated changes seen in other modules. The core functionality remains intact.
components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs (1)
9-9: Version Bump: Updated to "0.0.11"The version update is consistent with the coordinated module updates across the project. The source logic and asynchronous event emission remain unchanged.
components/airtable_oauth/actions/create-or-update-record/create-or-update-record.mjs (1)
9-9: Version Update is Consistent
The version bump from the previous version (presumably "0.1.1") to "0.1.2" is a straightforward non-functional change that aligns with the coordinated versioning updates across this component.components/airtable_oauth/actions/create-multiple-records/create-multiple-records.mjs (1)
12-12: Version Bump for Multiple Records Action
Updating the version to "0.0.10" is a non-functional change that ensures consistent versioning with related modules. No further modifications are needed.components/airtable_oauth/actions/update-table/update-table.mjs (1)
7-7: Consistent Version Increment
The version update to "0.0.10" reflects a coordinated versioning strategy across modules. Since the change is limited to the version field, there is no impact on functionality.components/airtable_oauth/sources/new-modified-or-deleted-records/new-modified-or-deleted-records.mjs (1)
9-9: Version Increment in Source Module
Raising the version to "0.0.11" is consistent with the overall update across related modules and does not alter the source’s behavior.components/airtable_oauth/package.json (2)
2-4: Package Version Bump
The upgrade of the package version from "0.4.3" to "0.4.4" is clear and follows the coordinated versioning efforts. This update is non-functional and primarily for release tracking.
16-16: Dependency Upgrade for @pipedream/platform
Changing the dependency from an earlier version to "^3.0.3" ensures that the component leverages the latest features and improvements provided by the platform. It is advisable to verify that this upgrade is fully compatible with all current functionality, though no issues are apparent from the diff.components/airtable_oauth/common/actions.mjs (1)
36-36: Good change - proper async handling addedThe addition of
awaitis necessary sincemakeRecordis now asynchronous. This ensures the record is fully constructed before validation occurs.
GTFalcao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Resolves #16183
Summary by CodeRabbit