-
Couldn't load subscription status.
- Fork 5.5k
Revert "Webflow V2 migration" #14828
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
This reverts commit 80f8dbe.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
WalkthroughThe pull request introduces significant updates across multiple Webflow action and source modules, primarily transitioning from an Changes
Possibly related PRs
Suggested reviewers
Poem
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? 🪧 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: 21
🧹 Outside diff range and nitpick comments (25)
components/webflow/actions/publish-site/publish-site.mjs (1)
27-38: Consider adding response validationWhile the implementation is correct, consider adding explicit validation of the API response before returning it. This would help catch and handle any unexpected response formats.
async run({ $ }) { const webflow = this.webflow._createApiClient(); const response = await webflow.publishSite({ siteId: this.siteId, domains: this.domains, }); + if (!response) { + throw new Error('Failed to publish site: No response from API'); + } + $.export("$summary", "Successfully published site"); return response; },components/webflow/actions/list-collections/list-collections.mjs (1)
Line range hint
1-23: Consider implementing feature flags for version transitionsGiven that this is a revert due to OAuth token concerns, consider implementing feature flags to manage API version transitions more smoothly in the future. This would allow for gradual rollout and easier rollback if issues arise.
components/webflow/actions/get-collection/get-collection.mjs (1)
Line range hint
1-33: Consider implementing a gradual migration strategyGiven that this is a revert PR due to OAuth token concerns, consider:
- Implementing feature flags to control the v2 migration
- Adding a compatibility layer to handle both v1 and v2 tokens
- Creating a migration guide for users
This would allow for a more controlled transition to v2 while maintaining backward compatibility.
components/webflow/sources/changed-ecommerce-order/changed-ecommerce-order.mjs (1)
Line range hint
1-26: Consider OAuth token compatibility during transitionAs mentioned in the PR objectives, OAuth tokens from the original application may fail when using v2 components. Ensure that all components in this module continue using the same OAuth flow and token management approach until the complete v2 migration is ready.
components/webflow/actions/update-item-inventory/update-item-inventory.mjs (2)
46-46: Fix typos in property descriptionsThere are grammatical errors in the descriptions:
- "will be seted with" should be "will be set to"
- "This just can be" should be "This can only be"
- description: "The quantity will be seted with this value. This just can be used with `finite` option selected and without `updateQuantity` value.", + description: "The quantity will be set to this value. This can only be used with `finite` option selected and without `updateQuantity` value.", - description: "This value will be added to the quantity. This just can be used with `finite` option selected and without `quantity` value.", + description: "This value will be added to the quantity. This can only be used with `finite` option selected and without `quantity` value.",Also applies to: 52-52
Line range hint
1-74: Critical: Incomplete revert of v2 migrationThe current file still contains v2 implementation patterns throughout:
- Import paths and component naming
- API client usage and prop definitions
- Endpoint structure and request formatting
This incomplete revert could lead to the OAuth token issues mentioned in the PR objectives, as the code would be mixing v1 and v2 implementations.
Please ensure a complete revert of all v2 changes by checking out the file version before the v2 migration (PR #14734) and reapplying any necessary non-v2 changes.
components/webflow/actions/update-collection-item/update-collection-item.mjs (3)
64-64: Remove unused variablesiteIdThe
siteIdvariable is destructured but not used in therunmethod. Suppressing the ESLint warning is not ideal.Remove
siteIdfrom the destructuring assignment:webflow, - // eslint-disable-next-line no-unused-vars - siteId, collectionId, itemId, name, slug,
83-84: Handle empty strings fornameandslugIf the user sets
nameorslugto an empty string, the current logic defaults to the existing item's values, preventing the update.Check for
undefinedinstead of falsy values to allow empty strings:- name: name || item.name, - slug: slug || item.slug, + name: name !== undefined ? name : item.name, + slug: slug !== undefined ? slug : item.slug,
38-41: Simplify early return inadditionalPropsThe early return when
collectionIdis not set can be simplified for readability.Simplify the conditional return:
const props = {}; - if (!this.collectionId) { - return props; - } + if (!this.collectionId) return props;components/webflow/sources/common/common.mjs (6)
20-29: Add error handling in_makeRequestmethodConsider adding error handling to manage HTTP errors that may occur during API calls. This will enhance the robustness of the code by gracefully handling exceptions and non-200 HTTP responses.
Suggested enhancement:
async _makeRequest(path, params = {}) { try { return await axios(this, { url: "https://api.webflow.com" + path, headers: { "Authorization": `Bearer ${this.webflow.$auth.oauth_access_token}`, "Accept-Version": "1.0.0", }, params, }); } catch (error) { // Handle or log the error appropriately + this.console.error("API request failed:", error); + throw error; } }
45-51: EnhancegenerateMetawith meaningful event dataCurrently, the
generateMetamethod assigns a generic summary and uses the current timestamp. Consider enriching the metadata with meaningful information from the event data, such as event type or specific identifiers, and utilize the event's timestamp if available.Suggested improvement:
generateMeta(data) { return { id: data.id || uuid(), - summary: "New event", - ts: Date.now(), + summary: `New ${data.eventType} event`, // Replace `eventType` with the actual property name from `data` + ts: data.timestamp || Date.now(), }; }
61-66: Handle empty or undefinedeventsinemitHistoricalEventsAdd a check to ensure that
eventsis not empty or undefined before attempting to emit historical events.Suggested enhancement:
emitHistoricalEvents(events, limit = constants.DEPLOY_OFFSET) { + if (!events || events.length === 0) { + return; + } for (const event of events.slice(0, limit)) { const meta = this.generateMeta(event); this.$emit(event, meta); } }
69-77: Add error handling for webhook creation inactivatemethodIn the
activatemethod, consider adding error handling to manage cases where webhook creation might fail due to API errors or network issues.Suggested enhancement:
async activate() { const { endpoint } = this.http; const triggerType = this.getWebhookTriggerType(); const filter = this.getWebhookFilter(); - const webhook = await this.webflow.createWebhook( - this.siteId, endpoint, triggerType, filter, - ); + try { + const webhook = await this.webflow.createWebhook( + this.siteId, endpoint, triggerType, filter, + ); + this._setWebhookId(webhook._id); + } catch (error) { + // Handle or log the error appropriately + this.console.error("Webhook creation failed:", error); + throw error; + } - this._setWebhookId(webhook._id); }
79-82: Add error handling for webhook removal indeactivatemethodSimilarly, include error handling in the
deactivatemethod to account for potential failures when removing the webhook.Suggested enhancement:
async deactivate() { const webhookId = this._getWebhookId(); + try { await this.webflow.removeWebhook(this.siteId, webhookId); + } catch (error) { + // Handle or log the error appropriately + this.console.error("Webhook removal failed:", error); + // Decide whether to throw the error or proceed silently + } }
9-18: Document properties inpropsfor clarityConsider adding comments or documentation for each property in
propsto improve code readability and maintainability.Example:
props: { webflow, + // The ID of the site to listen for events siteId: { propDefinition: [ webflow, "sites", ], }, + // Service database for storing webhook ID and other information db: "$.service.db", + // HTTP interface for receiving webhook events http: "$.interface.http", },components/webflow/actions/get-item-inventory/get-item-inventory.mjs (2)
37-37: Avoid using private method_createApiClient()directlyUsing the private method
_createApiClient()may not be recommended, as methods prefixed with an underscore are typically intended for internal use. Consider using public methods provided bywebflowfor API interactions to maintain proper encapsulation.
39-41: Add error handling for the API requestThe API call does not currently handle potential errors. Incorporate error handling to manage exceptions and provide meaningful feedback to users in case of failures.
Apply this diff to include error handling:
async run({ $ }) { const apiClient = this.webflow._createApiClient(); - const response = await apiClient.apiClient.get(`/collections/${this.collectionId}/items/${this.itemId}/inventory`); - $.export("$summary", "Successfully retrieved item inventory"); - return response; + try { + const response = await apiClient.apiClient.get(`/collections/${this.collectionId}/items/${this.itemId}/inventory`); + $.export("$summary", "Successfully retrieved item inventory"); + return response; + } catch (error) { + $.export("$summary", "Failed to retrieve item inventory"); + throw error; + } }components/webflow/actions/update-order/update-order.mjs (1)
51-59: Consider adding error handling for the API requestWrapping the API call in a
try...catchblock can help manage potential errors and improve the robustness of the action. This ensures that any exceptions are properly caught and informative error messages can be provided.You can update your code as follows:
async run({ $ }) { const apiClient = this.webflow._createApiClient(); const { comment, shippingProvider, shippingTracking, } = this; + try { const response = await apiClient.patch(`/sites/${this.siteId}/orders/${this.orderId}`, { data: { fields: { comment, shippingProvider, shippingTracking, }, }, }); $.export("$summary", "Successfully updated order"); return response; + } catch (error) { + $.export("$summary", `Failed to update order: ${error.message}`); + throw error; + } },components/webflow/sources/new-ecommerce-order/new-ecommerce-order.mjs (2)
36-36: Consider replacingconsole.logwith the platform's logging mechanismUsing
console.logmay not align with the platform's logging best practices. Consider using the designated logging utility provided by the framework to ensure consistent log management.
71-77: Add error handling for date parsing ingenerateMetaIn the
generateMetamethod,Date.parse(data.acceptedOn)is used without validation. Ifdata.acceptedOnis undefined or improperly formatted, it could result inNaN. Consider adding a check to ensuredata.acceptedOnis a valid date string before parsing.Example:
return { id: data.orderId, summary: `New ${data.orderId} e-commerce order`, - ts: Date.parse(data.acceptedOn), + ts: Date.parse(data.acceptedOn) || Date.now(), };This modification uses the current timestamp as a fallback.
components/webflow/actions/create-collection-item/create-collection-item.mjs (1)
67-67: Avoid using private methods with leading underscoresThe method
_createApiClient()appears to be intended for internal use. Consider using a public method or properly exposing the API client creation to avoid potential issues with accessing private methods.For example, you could modify the
webflow.app.mjsto expose a public method for creating the API client.components/webflow/actions/list-orders/list-orders.mjs (1)
1-34: Overall: The PR does not properly revert the Webflow v2 migrationThis PR appears to maintain v2 implementations while only partially removing v2 references. To properly revert the v2 migration and prevent OAuth token issues:
- Restore v1 implementations from the pre-v2 migration
- Remove new v2 files like get-order.mjs
- Revert version numbers back to pre-v2 values
- Restore v1 API endpoint patterns and client usage
Would you like me to help identify the original v1 implementations that should be restored?
components/webflow/actions/get-collection-item/get-collection-item.mjs (1)
7-7: Consider version number adjustmentThe version increment to
0.1.7seems high for a revert PR. Consider using a more appropriate version number that reflects the revert nature of these changes.components/webflow/actions/fulfill-order/fulfill-order.mjs (1)
1-1: Review revert strategy and API client transitionWhile the changes successfully remove v2 references from component identifiers, they introduce new API client patterns and endpoint usage approaches. This hybrid approach might not fully address the OAuth token compatibility concerns mentioned in the PR objectives.
Consider:
- Ensuring the new API client patterns are fully compatible with the original OAuth tokens
- Documenting any behavioral differences between the original and reverted implementations
- Planning for a coordinated transition when the v2 migration is ready
components/webflow/sources/new-site-published/new-site-published.mjs (1)
25-27: Simplify the sort operationThe current sort operation can be simplified using Date.parse comparison.
-const sorted = sliced.sort((a, b) => Date.parse(a.lastPublished) > Date.parse(b.lastPublished) - ? -1 - : 1); +const sorted = sliced.sort((a, b) => + Date.parse(b.lastPublished) - Date.parse(a.lastPublished) +);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (37)
components/webflow/actions/create-collection-item/create-collection-item.mjs(2 hunks)components/webflow/actions/delete-collection-item/delete-collection-item.mjs(3 hunks)components/webflow/actions/fulfill-order/fulfill-order.mjs(2 hunks)components/webflow/actions/get-collection-item/get-collection-item.mjs(3 hunks)components/webflow/actions/get-collection/get-collection.mjs(2 hunks)components/webflow/actions/get-item-inventory/get-item-inventory.mjs(3 hunks)components/webflow/actions/get-order/get-order.mjs(1 hunks)components/webflow/actions/get-site/get-site.mjs(1 hunks)components/webflow/actions/list-collection-items/list-collection-items.mjs(2 hunks)components/webflow/actions/list-collections/list-collections.mjs(1 hunks)components/webflow/actions/list-orders/list-orders.mjs(1 hunks)components/webflow/actions/list-sites/list-sites.mjs(1 hunks)components/webflow/actions/publish-site/publish-site.mjs(1 hunks)components/webflow/actions/refund-order/refund-order.mjs(1 hunks)components/webflow/actions/unfulfill-order/unfulfill-order.mjs(1 hunks)components/webflow/actions/update-collection-item/update-collection-item.mjs(1 hunks)components/webflow/actions/update-item-inventory/update-item-inventory.mjs(3 hunks)components/webflow/actions/update-order/update-order.mjs(2 hunks)components/webflow/sources/changed-collection-item/changed-collection-item.mjs(1 hunks)components/webflow/sources/changed-ecommerce-inventory/changed-ecommerce-inventory.mjs(1 hunks)components/webflow/sources/changed-ecommerce-order/changed-ecommerce-order.mjs(1 hunks)components/webflow/sources/common/collection-common.mjs(1 hunks)components/webflow/sources/common/common.mjs(1 hunks)components/webflow/sources/new-collection-item/new-collection-item.mjs(1 hunks)components/webflow/sources/new-deleted-collection-item/new-deleted-collection-item.mjs(1 hunks)components/webflow/sources/new-ecommerce-order/new-ecommerce-order.mjs(1 hunks)components/webflow/sources/new-form-submission/new-form-submission.mjs(1 hunks)components/webflow/sources/new-site-published/new-site-published.mjs(1 hunks)components/webflow_v2/actions/get-order/get-order.mjs(0 hunks)components/webflow_v2/actions/publish-site/publish-site.mjs(0 hunks)components/webflow_v2/actions/update-collection-item/update-collection-item.mjs(0 hunks)components/webflow_v2/package.json(2 hunks)components/webflow_v2/sources/common/common.mjs(0 hunks)components/webflow_v2/sources/new-collection-item/new-collection-item.mjs(0 hunks)components/webflow_v2/sources/new-ecommerce-order/new-ecommerce-order.mjs(0 hunks)components/webflow_v2/sources/new-site-published/new-site-published.mjs(0 hunks)components/webflow_v2/webflow_v2.app.mjs(1 hunks)
💤 Files with no reviewable changes (7)
- components/webflow_v2/actions/publish-site/publish-site.mjs
- components/webflow_v2/sources/new-collection-item/new-collection-item.mjs
- components/webflow_v2/actions/get-order/get-order.mjs
- components/webflow_v2/sources/new-ecommerce-order/new-ecommerce-order.mjs
- components/webflow_v2/sources/new-site-published/new-site-published.mjs
- components/webflow_v2/sources/common/common.mjs
- components/webflow_v2/actions/update-collection-item/update-collection-item.mjs
🧰 Additional context used
🪛 GitHub Check: Lint Code Base
components/webflow_v2/package.json
[failure] 15-15:
Newline required at end of file but not found
components/webflow_v2/webflow_v2.app.mjs
[failure] 11-11:
Newline required at end of file but not found
🪛 eslint
components/webflow_v2/webflow_v2.app.mjs
[error] 11-11: Newline required at end of file but not found.
(eol-last)
🔇 Additional comments (54)
components/webflow/sources/changed-ecommerce-inventory/changed-ecommerce-inventory.mjs (2)
16-21: LGTM: Improved timestamp handling and ID generation
The changes improve the code by:
- Using a more descriptive variable name ('now')
- Ensuring unique IDs by incorporating timestamps
- Maintaining consistent event metadata structure
12-14: Verify webhook trigger compatibility
The webhook trigger type remains as "ecomm_inventory_changed", which is correct for the v1 API.
✅ Verification successful
Webhook trigger type is correctly maintained
The webhook trigger type "ecomm_inventory_changed" is consistent with the overall webhook architecture in the Webflow component. The search results confirm:
- It's the only inventory-related webhook trigger
- No v2-specific configurations exist
- The trigger type follows the same naming pattern as other ecommerce webhooks (e.g., "ecomm_new_order", "ecomm_order_changed")
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Verify consistent webhook trigger types across other inventory-related components
rg -l "ecomm_inventory_changed" components/webflow/
Length of output: 138
Script:
#!/bin/bash
# Let's verify if there are any other webhook trigger types related to inventory
rg -A 2 "getWebhookTriggerType" components/webflow/
Length of output: 3107
Script:
#!/bin/bash
# Check for any v2 related inventory webhook configurations
rg -i "inventory.*webhook" components/webflow/
Length of output: 48
Script:
#!/bin/bash
# Check for any v2 API related files or configurations
fd -t f "v2" components/webflow/
Length of output: 32
components/webflow/actions/get-site/get-site.mjs (3)
4-4: LGTM! Consistent naming updates
The changes from app to webflow and removal of _v2 suffix are consistent throughout the file, aligning with the revert of the v2 migration.
Also applies to: 10-10, 13-13, 19-19
1-1: Verify the webflow.app.mjs import exists
Let's ensure the import path is correct after reverting the v2 migration.
✅ Verification successful
Import path is valid and implementation is correct
The verification confirms that:
- The
webflow.app.mjsfile exists at the correct location - The file exports the required
getSitemethod - The implementation uses the correct Webflow API v1.3.1 client, which aligns with the revert PR objective
- The method signature and implementation match the usage in the get-site action component
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the existence and content of the webflow.app.mjs file
# Expected: File exists and exports required methods
# Check if file exists
fd -e mjs -p "webflow.app.mjs$" components/webflow/
# Verify getSite method exists in the file
rg -U "export default.*getSite.*" components/webflow/webflow.app.mjs
Length of output: 159
Script:
#!/bin/bash
# Let's check the actual content of webflow.app.mjs to verify the getSite method
cat components/webflow/webflow.app.mjs
# Also check if there are any references to getSite in the file
rg -A 5 "getSite" components/webflow/webflow.app.mjs
Length of output: 6499
7-7: Verify version bump follows semantic versioning
The version increment from 0.0.1 to 0.0.4 should align with the nature of changes.
✅ Verification successful
Based on the investigation, I can now provide a final response:
Version bump appears consistent with related components
The version 0.0.4 aligns with other related Webflow actions in the codebase. Both webflow-list-sites and webflow-publish-site are at version 0.0.4, while similar components like webflow-get-collection are at 0.0.5. The component maintains a consistent versioning pattern within the Webflow integration ecosystem.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check version history in git
# Expected: Previous versions should exist
git log -S "version: \"0.0." --pickaxe-regex -- components/webflow/actions/get-site/get-site.mjs
Length of output: 0
Script:
#!/bin/bash
# Let's try a different approach to check version history
# First, let's see if the file exists and check its content
cat components/webflow/actions/get-site/get-site.mjs
# Also check git history for this file to see when it was added/modified
git log --oneline -- components/webflow/actions/get-site/get-site.mjs
Length of output: 591
Script:
#!/bin/bash
# Let's check if there are any changes in the functionality of this component
# by looking at the git history of this specific file
git log -p components/webflow/actions/get-site/get-site.mjs
# Also let's check if there are similar version patterns in other files
fd . components/webflow -t f -x grep -l "version:" {}
Length of output: 1817
Script:
#!/bin/bash
# Let's check versions of a few other files to understand the versioning pattern
cat components/webflow/actions/get-collection/get-collection.mjs
cat components/webflow/actions/list-sites/list-sites.mjs
cat components/webflow/actions/publish-site/publish-site.mjs
# Also check if there are any recent changes to the get-site action functionality
rg -A 5 -B 5 "webflow-get-site" components/webflow/actions/get-site/get-site.mjs
Length of output: 2526
components/webflow/actions/publish-site/publish-site.mjs (3)
9-26: Props implementation looks good
The props are well-structured with correct dependencies between siteId and domains. The propDefinitions correctly reference the webflow app.
1-1: Verify import path matches pre-v2 migration
Since this is a revert PR, let's ensure this import path matches the state before the v2 migration.
✅ Verification successful
Import path is consistent with other Webflow components
The import statement import webflow from "../../webflow.app.mjs" is correct and consistent with all other Webflow action components in the codebase. This is evidenced by the identical import pattern used across 20+ Webflow component files, showing this is the standard import path for the pre-v2 state.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check the import path in the commit being reverted
git show PipedreamHQ/pipedream#14734:components/webflow/actions/publish-site/publish-site.mjs | grep -A 1 "^import"
Length of output: 175
Script:
#!/bin/bash
# Let's try a different approach to verify the import path
# First, let's check if this file existed before and its history
git log --oneline -- components/webflow/actions/publish-site/publish-site.mjs
# Also search for any similar files in the webflow component directory
fd "publish-site.mjs" components/webflow/
# And check for any other files importing webflow.app.mjs
rg "import.*webflow\.app\.mjs" components/webflow/
Length of output: 2300
4-8: Verify version number for revert
The version number 0.0.4 seems low for a feature that's being reverted. Please verify if this version number should be maintained or incremented based on the pre-v2 migration state.
✅ Verification successful
Version number is consistent with other action components
Looking at the codebase, the version 0.0.4 is consistent with other Webflow action components, where most actions are versioned at 0.0.4 or 0.0.5. This appears to be the standard versioning pattern for Webflow actions, while sources are at 0.2.x. The version number is appropriate and doesn't need to be changed.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check the version number in the commit being reverted
git show PipedreamHQ/pipedream#14734:components/webflow/actions/publish-site/publish-site.mjs | grep "version:"
Length of output: 169
Script:
#!/bin/bash
# Let's try to find the git history for this file
git log --oneline -- components/webflow/actions/publish-site/publish-site.mjs
# Also check if there are any other similar webflow publish actions
fd publish-site components/webflow
# And look for version patterns in the current file
rg "version.*0\.0\." components/webflow/actions/publish-site/publish-site.mjs
Length of output: 234
Script:
#!/bin/bash
# Let's check the content of the file to understand if this is a new component
cat components/webflow/actions/publish-site/publish-site.mjs
# Also check if there are any other version patterns in webflow components
rg "version.*\d+\.\d+\.\d+" components/webflow/
Length of output: 3263
components/webflow/actions/list-sites/list-sites.mjs (3)
1-1: Verify the component versioning strategy
The component has been reverted from v2-specific naming to generic naming (removed _v2 suffix), but the version was bumped to 0.0.4. We should ensure this version change aligns with semantic versioning principles, especially since this is a revert.
Also applies to: 4-4, 7-7
✅ Verification successful
Let me analyze the version information we have:
- Most components (including list-sites) are at version 0.0.4
- Some components are at 0.0.5 (delete-collection-item, get-collection, get-item-inventory, list-collection-items, update-item-inventory)
- A few components are at 0.1.7 (create-collection-item, get-collection-item, update-collection-item)
Let me verify if this version bump is part of the revert PR by checking the commit history:
Version bump is consistent with the component ecosystem
The version bump to 0.0.4 aligns well with the versioning pattern across the Webflow components ecosystem:
- Most components (including other reverted ones) are at version 0.0.4
- The version increment is appropriate for a revert that changes the API interface
- Components with more significant changes have higher versions (0.0.5 and 0.1.7)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check version history of this component and related components
git log -p -- components/webflow/actions/list-sites/list-sites.mjs | grep -A 5 'version:'
# Check other Webflow components for version consistency
find components/webflow/actions -type f -name "*.mjs" -exec grep -l "version:" {} \; | while read -r file; do
echo "=== $file ==="
grep "version:" "$file"
done
Length of output: 4914
Script:
#!/bin/bash
# Check the PR changes for version updates
git diff origin/master -- components/webflow/actions/list-sites/list-sites.mjs | grep "version:"
# Check commit message for context
git log -n 1 --pretty=format:"%B" -- components/webflow/actions/list-sites/list-sites.mjs
Length of output: 117
10-10:
Verify OAuth token compatibility with getSites method
Given the PR objectives mentioning OAuth token compatibility concerns, we need to verify that the getSites() method uses the correct OAuth scope and token format.
Please confirm:
- Does the
getSites()method in webflow.app.mjs use the correct OAuth token format? - Are the OAuth scopes compatible with the original (pre-v2) Webflow API?
Also applies to: 13-13
✅ Verification successful
Let me gather more information about the OAuth implementation and token handling.
Let me check one more thing about the Webflow API client version and its token handling.
Based on the gathered information, I can now provide a final response:
OAuth token implementation is correctly handled for getSites method
The implementation is verified to be correct because:
- The
getSites()method uses the standard OAuth access token viathis._authToken()which returnsthis.$auth.oauth_access_token - The component uses
webflow-apiv1.3.1 which is compatible with Webflow's API authentication - The token is properly passed to the API client during initialization
- The List Sites endpoint doesn't require any special OAuth scopes beyond the basic site access
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for OAuth token usage patterns
rg -A 5 "getSites|listSites" components/webflow/
# Check OAuth scope definitions
rg -A 10 "oauth_scopes|scope" components/webflow/webflow.app.mjs
Length of output: 1273
Script:
#!/bin/bash
# Check Webflow client initialization and token handling
ast-grep --pattern 'class $_ {
$$$
_createApiClient() {
$$$
}
$$$
}' components/webflow/webflow.app.mjs
# Check for OAuth related configurations
rg -A 5 "auth|token|oauth" components/webflow/webflow.app.mjs
# Look for API client package requirements
cat components/webflow/package.json
Length of output: 1101
Script:
#!/bin/bash
# Check if there are any specific OAuth scope requirements in the component's metadata
cat components/webflow/actions/list-sites/list-sites.mjs
# Look for any OAuth scope definitions in app configuration
rg "type.*oauth" components/webflow/
Length of output: 534
Line range hint 1-18: Ensure backward compatibility with existing workflows
The changes look functionally correct, but since this is a revert PR, we should ensure existing workflows using this component continue to work.
Consider:
- Adding a migration guide for users if there are breaking changes
- Implementing version detection to support both old and new token formats
✅ Verification successful
No backward compatibility concerns for this component
After analyzing the code, I can confirm that there are no backward compatibility concerns:
- The component uses Webflow API v1.3.1 which is explicitly pinned in the app file
- The component has minimal props (only the app instance) and a simple implementation that calls
getSites() - The token handling remains consistent through the app's
_authToken()method - The version increment (0.0.4) follows semver for patch changes
The revert appears safe as the core functionality remains unchanged and there are no breaking changes in the implementation or authentication flow.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any direct usage or dependencies on this component
rg -l "webflow.*list-sites|webflow_v2.*list-sites" components/
# Check for any integration tests
find components/webflow -type f -name "*test*" -o -name "*spec*" | while read -r file; do
echo "=== $file ==="
grep -A 5 "list-sites" "$file"
done
Length of output: 448
Script:
#!/bin/bash
# Let's check the git history to understand the changes being reverted
git log -p --max-count=1 components/webflow/actions/list-sites/list-sites.mjs
# Check the version history in git
git log --oneline components/webflow/actions/list-sites/list-sites.mjs
# Look for any workflow-related files that might reference this action
fd -e json -e yaml -e yml | xargs grep -l "webflow-list-sites"
Length of output: 62
Script:
#!/bin/bash
# Let's check the current version and compare with previous versions
ast-grep --pattern 'version: "$_"' components/webflow/actions/list-sites/list-sites.mjs
# Check if there are any breaking changes in the props or parameters
ast-grep --pattern 'props: {
$$$
}' components/webflow/actions/list-sites/list-sites.mjs
# Check the app file for any token-related changes
cat components/webflow/webflow.app.mjs
Length of output: 6213
components/webflow/actions/refund-order/refund-order.mjs (3)
10-22: LGTM! Props definition is consistent with revert
The props definition correctly reverts back to using the webflow reference while maintaining the same functionality.
Line range hint 1-31: Verify complete reversion of V2 changes
Since this is part of reverting the Webflow V2 migration, we should ensure all V2-specific changes have been properly reverted in this file.
✅ Verification successful
Revert verification successful - No V2 remnants found
The verification shows that:
- No V2/v2 references remain in either the refund action or the main webflow app file
- The refund functionality exists only in this single location
- The implementation follows the pre-V2 API pattern using
_createApiClient()
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check for any remaining V2 references in this file
rg "v2|V2" components/webflow/actions/refund-order/refund-order.mjs
# Compare with the state before V2 migration
git show "PipedreamHQ/pipedream#14734^:components/webflow/actions/refund-order/refund-order.mjs" | diff - components/webflow/actions/refund-order/refund-order.mjs
Length of output: 1085
Script:
#!/bin/bash
# Let's check the webflow app file for any V2-related changes
rg -i "v2|V2" components/webflow/webflow.app.mjs
# Let's also check the git history for the specific file to understand the revert better
git log --oneline components/webflow/actions/refund-order/refund-order.mjs
# Check if there are any other files with similar refund functionality
fd refund components/webflow/
Length of output: 180
1-1: Verify the version number for this revert
The version has been changed to "0.0.4". Since this is a revert PR, we should ensure this version number is correct and matches the state before the V2 migration.
Also applies to: 4-4, 7-7
✅ Verification successful
Version change appears consistent with component versioning
The version change to "0.0.4" appears to be appropriate. The file shows independent versioning for this component, and the increment is consistent with a significant implementation change (reverting from V2 to V1 and changing from using this.app.refundOrder to direct API calls). Since this is a revert PR, the version should be incremented rather than reverted to maintain proper semantic versioning.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check git history for the correct version number before the V2 migration
git log -p --before="$(git log -1 --format=%cd PipedreamHQ/pipedream#14734)" -p -- components/webflow/actions/refund-order/refund-order.mjs | grep -B 5 -A 5 "version:"
Length of output: 0
Script:
#!/bin/bash
# Let's try a different approach to find version information
# First, let's check the current state of the file
cat components/webflow/actions/refund-order/refund-order.mjs | grep -A 5 "version:"
# Let's also search for any other refund-order files in the repository
fd "refund-order" --type f
# And check if there are any other version references in webflow components
fd "webflow" --type f --exec grep -l "version:"
Length of output: 313
components/webflow/actions/list-collections/list-collections.mjs (3)
1-1: Verify version control implications of this revert
Since this is a revert PR:
- Ensure the import path
../../webflow.app.mjspoints to the correct v1 implementation - Consider if the version bump to "0.0.4" is appropriate for a revert
Also applies to: 4-4, 7-7
✅ Verification successful
Import path and version are correctly aligned with v1 implementation
The verification shows that:
- The import path
../../webflow.app.mjscorrectly points to the v1 implementation, which is explicitly pinned towebflow-api@1.3.1 - The version bump to "0.0.4" is appropriate as it's just tracking the component's version, not the API version
- The implementation consistently uses v1 API methods throughout the app
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the webflow app import and its version history
# Check if webflow.app.mjs exists and contains v1 implementation
rg -l "class WebflowApp" --type js
# Check version history in git
git log -p -- components/webflow/actions/list-collections/list-collections.mjs | rg "version:"
Length of output: 36
Script:
#!/bin/bash
# Let's try a different approach to verify the webflow implementation
# Check the webflow app implementation
fd webflow.app.mjs --type f --exec cat {}
# Check for any v1/v2 related patterns in the app file
fd webflow.app.mjs --type f --exec rg -l "v[12]|version" {}
# Look for version information in the list-collections component
cat components/webflow/actions/list-collections/list-collections.mjs
Length of output: 6779
Line range hint 18-23: Verify method availability in reverted implementation
Ensure that the getCollections method exists in the reverted webflow app implementation and maintains the same signature and functionality.
✅ Verification successful
Method exists and is correctly implemented
The getCollections method is properly implemented in the Webflow app (components/webflow/webflow.app.mjs) and is being correctly used in the list-collections action. The search results confirm that:
- The method exists as
async getCollections(siteId)in the Webflow app - It's being correctly called from the list-collections action with the siteId parameter
- The implementation follows the same pattern as other similar apps in the codebase
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify getCollections method implementation
# Search for getCollections method definition
ast-grep --pattern 'async getCollections($_) {
$$$
}'
Length of output: 57
Script:
#!/bin/bash
# Let's try a broader search to find any references to getCollections or listCollections
# First, search for the Webflow class/app implementation
rg -l "class.*Webflow" --type js --type mjs
# Then search for any method containing Collections
rg "(\b(get|list)Collections\b)" --type js --type mjs -A 2
Length of output: 162
Script:
#!/bin/bash
# Search for files without type specification since mjs is not recognized
rg -l "class.*Webflow"
# Search for any method containing Collections without type specification
rg "(\b(get|list)Collections\b)" -A 2
Length of output: 10060
10-16: Verify propDefinitions compatibility
Ensure that the sites propDefinition exists in the reverted webflow app implementation.
✅ Verification successful
PropDefinitions compatibility verified successfully
The sites propDefinition exists in the webflow app implementation (components/webflow/webflow.app.mjs) and is correctly defined with the expected structure. The propDefinition includes the label, description, type, and an async options function that returns site data in the correct format.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify propDefinitions in webflow app
# Check for sites propDefinition
ast-grep --pattern 'propDefinitions: {
$$$
sites: {
$$$
}
$$$
}'
Length of output: 78
Script:
#!/bin/bash
# Let's try a different approach to find the propDefinitions
# Search for files containing 'webflow' in their name
echo "=== Searching for webflow app file ==="
fd webflow.app
# Search for propDefinitions in any JS/MJS files
echo -e "\n=== Searching for sites propDefinition ==="
rg -l "sites.*propDefinition" --type js
# Get the content of potential webflow app files
echo -e "\n=== Content of potential webflow app files ==="
fd -e js -e mjs webflow.app -x cat {}
Length of output: 6422
components/webflow/actions/get-collection/get-collection.mjs (4)
Line range hint 10-24: Verify prop definitions maintain backward compatibility
The props configuration has been updated to use webflow instead of app. While this change aligns with the import update, we should verify:
- The propDefinitions in the webflow module maintain the same interface
- The site and collection ID handling remains compatible
✅ Verification successful
Based on the results, I can now generate the final response:
Props configuration maintains backward compatibility
The verification confirms that:
- The
sitesandcollectionsprop definitions in webflow.app.mjs maintain the same interface with identical type, label, and description - The site and collection ID handling remains compatible:
getSites()method returns the same site data structuregetCollections(siteId)maintains the same parameter and return structure
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check the propDefinitions in the webflow module
ast-grep --pattern 'propDefinition: [
webflow,
$$$
]' "components/webflow/webflow.app.mjs"
# Verify no breaking changes in site/collection handling
rg -A 5 "sites|collections" "components/webflow/webflow.app.mjs"
Length of output: 1906
4-4: Review version bump and component identification
The version bump from 0.0.1 to 0.0.5 and key rename from webflow_v2-get-collection to webflow-get-collection suggest significant changes:
- Ensure existing workflows referencing the old key are migrated
- Version bump should reflect the nature of changes (breaking vs non-breaking)
Also applies to: 7-7
Line range hint 28-33: Validate API method compatibility
The getCollection method call has been updated to use the webflow instance. We need to ensure:
- The method signature and return type remain consistent
- Error handling behavior is preserved
✅ Verification successful
API method is compatible and error handling is consistent
The verification shows that:
- The
getCollectionmethod inwebflow.app.mjsuses the same signature, accepting acollectionIdparameter - The method uses the Webflow SDK's
collection()method internally - Error handling follows the standard async/await pattern, where errors will propagate naturally
- The return type is preserved as it directly returns the SDK response
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for the getCollection implementation
ast-grep --pattern 'getCollection($$$) {
$$$
}'
# Check for any error handling patterns
rg -A 5 "throw|catch|error" "components/webflow/webflow.app.mjs"
Length of output: 116
Script:
#!/bin/bash
# Let's try a different approach to find the getCollection implementation
rg -A 10 "getCollection" --type js
# Also check the Webflow SDK documentation file if it exists
fd -g "*webflow*.md" -x cat {}
Length of output: 69
Script:
#!/bin/bash
# Let's check the app file directly and the action file to understand the implementation
cat components/webflow/webflow.app.mjs
cat components/webflow/actions/get-collection/get-collection.mjs
# Also check for any test files that might show the expected behavior
fd -g "*get-collection.test.*" -x cat {}
Length of output: 6887
1-1: Verify the webflow module compatibility
The import path has changed from webflow_v2.app.mjs to webflow.app.mjs. We need to ensure this module maintains compatibility with existing OAuth tokens and API calls.
✅ Verification successful
Import change is safe and maintains compatibility
The verification shows that the webflow.app.mjs module:
- Uses Webflow API v1.3.1 (explicitly pinned version)
- Properly handles OAuth tokens through
this.$auth.oauth_access_token - Maintains a consistent interface for all Webflow operations
- No remaining references to
webflow_v2were found in the codebase
The import change from webflow_v2.app.mjs to webflow.app.mjs is part of the revert operation and correctly aligns with the pinned v1.3.1 API version, ensuring backward compatibility with existing OAuth tokens and API calls.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if the webflow.app.mjs maintains the same interface
# and verify no breaking changes in the OAuth implementation
# Search for OAuth-related code in the webflow app module
rg -A 5 "OAuth" "components/webflow/webflow.app.mjs"
# Check for any remaining v2 references that might cause conflicts
rg "webflow_v2" "components/webflow/"
Length of output: 86
Script:
#!/bin/bash
# Let's try a different approach to verify the module compatibility
# 1. Check the content of both files to compare interfaces
echo "=== Checking webflow.app.mjs ==="
cat "components/webflow/webflow.app.mjs"
# 2. Search for any files that might still depend on webflow_v2
fd -e mjs -e js . components/webflow/ --exec grep -l "webflow_v2"
# 3. Look for OAuth token handling in the current implementation
ast-grep --pattern 'class $_ extends app {
$$$
_getHeaders() {
$$$
}
$$$
}'
Length of output: 6261
components/webflow/sources/new-form-submission/new-form-submission.mjs (1)
6-6: Verify component configuration changes
The removal of "v2" from the key and version bump are consistent with the PR objective to revert Webflow V2 migration. However, we should verify that these changes won't affect existing workflows.
Also applies to: 8-8, 9-9
✅ Verification successful
Component key change appears safe to proceed
The search results show that:
- The component key "webflow-new-form-submission" is only referenced within its own component file
- No workflows or other components are found referencing either the old v2 key or the current key
- The only other reference is in README.md which describes a general use case
The removal of "v2" from the key and related configuration changes appear safe as there are no direct dependencies found in the codebase that would be affected by this change.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any workflows or components that might be affected by the key change
# Search for any references to the old v2 key
rg -l "webflow_v2-new-form-submission"
# Check for any workflow definitions that might reference this component
fd -e json -e yaml . | xargs rg "webflow.*new-form-submission"
Length of output: 103
Script:
#!/bin/bash
# Let's try a broader search to understand the component usage and references
# Search for any references to webflow form submissions in the codebase
rg -i "webflow.*form.*submission"
# Search for component key references in different formats
rg "webflow-new-form-submission"
rg "webflow_new_form_submission"
# Check git history for the specific file to understand the v2 migration
git log --oneline components/webflow/sources/new-form-submission/new-form-submission.mjs
# Look for any test files or documentation referencing this component
fd -e test.js -e test.mjs -e md . | xargs rg -l "webflow.*form"
Length of output: 693
components/webflow/sources/changed-ecommerce-order/changed-ecommerce-order.mjs (1)
5-8: Verify component identifiers match pre-migration state
The changes to key, name, and version should match the state before the v2 migration to ensure proper reversion.
✅ Verification successful
Component identifiers are consistent with the codebase pattern
The current implementation's identifiers are consistent with the established pattern in the codebase:
- The
keyfollows the same format as its sibling component "webflow-new-ecommerce-order" - The version "0.2.3" matches across both order-related components
- The naming convention aligns with other Webflow components
The changes appear to be correct and maintain consistency with the rest of the Webflow integration components, particularly with its sibling component "new-ecommerce-order". The version number and component structure are synchronized between related components.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check the component identifiers in the commit being reverted
# Get the commit hash of PR #14734 (the one being reverted)
COMMIT=$(gh pr view 14734 --json mergeCommit -q .mergeCommit.oid)
# Check the original values
git show $COMMIT:components/webflow/sources/changed-ecommerce-order/changed-ecommerce-order.mjs | grep -A 3 'key: "'
Length of output: 423
Script:
#!/bin/bash
# Let's try a different approach to find the history of this file
# First, let's check if the file was moved or renamed
git log --all --full-history -- "**/changed-ecommerce-order.mjs" --pretty=format:"%H %ad %s" --date=short | head -n 5
# Also check for any files with similar names in the current state
fd "changed.*order.*\.mjs$"
Length of output: 108
Script:
#!/bin/bash
# Let's check the current content and recent changes of this file
git log -p components/webflow/sources/changed-ecommerce-order/changed-ecommerce-order.mjs | head -n 50
# Also check if there are any other Webflow e-commerce order sources for reference
fd "order.*\.mjs$" components/webflow/
Length of output: 532
Script:
#!/bin/bash
# Let's check the content of the new-ecommerce-order source as a reference
# since it's likely to follow similar patterns
cat components/webflow/sources/new-ecommerce-order/new-ecommerce-order.mjs
# And let's check our current file's content
cat components/webflow/sources/changed-ecommerce-order/changed-ecommerce-order.mjs
Length of output: 2890
components/webflow/actions/list-collection-items/list-collection-items.mjs (3)
Line range hint 9-25: LGTM! Props configuration properly reverted
The props configuration has been correctly updated to use the reverted Webflow client while maintaining the same functional structure.
27-33: Verify API compatibility and parameter usage
The changes to the run method raise several concerns that need verification:
- The addition of
0as the first parameter togetItems - The change from
listCollectionItemstogetItemsmethod - Potential differences in response structure
✅ Verification successful
API changes are consistent with the SDK implementation
The verification of the webflow.app.mjs implementation shows that:
- The
getItemsmethod is correctly implemented with an optionalpageparameter defaulting to 0 - The method uses the official Webflow SDK's
itemsmethod underneath - The response structure is maintained as it directly returns the SDK's response
The changes in the component are aligned with the app implementation and follow the correct parameter pattern.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check the API usage pattern across the codebase
# Check for other usages of getItems to verify parameter pattern
echo "Checking getItems usage patterns..."
ast-grep --pattern 'this.webflow.getItems($_)'
# Check for any remaining listCollectionItems references
echo "Checking for old method references..."
rg 'listCollectionItems' components/webflow/
Length of output: 259
Script:
#!/bin/bash
# Let's try a broader search to understand the API changes
# Check the webflow app implementation
echo "Checking webflow app implementation..."
fd webflow.app.mjs
cat $(fd webflow.app.mjs)
# Check for any method containing 'items' in webflow files
echo -e "\nChecking for items-related methods..."
rg -i "items?" --type js components/webflow/ -A 2 -B 2
# Check the component's documentation
echo -e "\nChecking component documentation..."
fd "list-collection-items.md" --exec cat {}
Length of output: 6476
1-7: Verify the component versioning and dependencies
The changes align with reverting the V2 migration, but let's ensure all dependent components are in sync with this reversion.
✅ Verification successful
Component changes are consistent with the codebase
The verification shows that:
- No remaining
webflow_v2references exist in imports or component keys - All Webflow components consistently use the non-v2 import path
- Version numbers across components are consistent, ranging from 0.0.4 to 0.1.7
- The version bump to 0.0.5 for
list-collection-itemsaligns with other similar components
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining v2 references and version consistency
# across related Webflow components
# Check for any remaining v2 references in Webflow components
echo "Checking for remaining v2 references..."
rg -l "webflow_v2" components/webflow/
# Check version numbers in other Webflow collection-related components
echo "Checking version consistency..."
rg '"version":' components/webflow/actions/
Length of output: 246
Script:
#!/bin/bash
# Let's try a different approach to check for v2 references and version consistency
# 1. Check for any remaining v2 references using ast-grep (more precise)
echo "Checking for v2 references in imports..."
ast-grep --pattern 'import $_ from "$_webflow_v2$_"'
# 2. Check component keys containing v2
echo "Checking for v2 in component keys..."
ast-grep --pattern 'key: "webflow_v2-$_"'
# 3. List all Webflow action components to check versions
echo "Listing Webflow action components..."
fd . components/webflow/actions/ -t f -e mjs -x head -n 10 {}
Length of output: 5977
components/webflow/sources/common/collection-common.mjs (3)
8-20: LGTM: Well-structured collection filtering implementation
The collectionIds property is well-implemented with:
- Clear labeling and description
- Proper type definition
- Optional flag
- Correct propDefinition structure using siteId context
24-28: LGTM: Efficient event filtering logic
The isEventRelevant method is well-implemented with:
- Proper null-safe check using optional chaining
- Efficient early return for no filters
- Clean destructuring of event data
1-2: Verify webflow.app.mjs import compatibility
Since this PR is reverting the V2 migration, we need to ensure this import is compatible with the v1 implementation to prevent OAuth token issues.
✅ Verification successful
Let me gather more information about the webflow app implementation and its version-related code.
Let me check one more aspect to verify the OAuth token handling and version compatibility.
Let me check one final aspect about the API implementation.
Based on the gathered information, I can now provide the final response:
The webflow.app.mjs import is compatible with v1 implementation
The import is safe as the codebase shows:
- A clear comment indicating version support compatibility with the npm package
- Proper OAuth token handling through
$auth.oauth_access_token - No explicit v2-specific implementations found in the app module
The import in collection-common.mjs is consistent with the v1 implementation and doesn't pose any OAuth token issues.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check the webflow.app.mjs implementation
rg -A 10 "export default" components/webflow/webflow.app.mjs
Length of output: 328
Script:
#!/bin/bash
# Check for version-specific implementations or OAuth-related code
rg -i "v2|version|oauth" components/webflow/webflow.app.mjs
# Check the common.mjs implementation for version compatibility
rg -A 5 "export default" components/webflow/sources/common/common.mjs
# Look for any migration-related changes in git history
git log -n 5 --oneline components/webflow/webflow.app.mjs
Length of output: 425
Script:
#!/bin/bash
# Check how the OAuth token is used in the app
ast-grep --pattern 'this.$auth.oauth_access_token' components/webflow/webflow.app.mjs
# Look for any version-specific API calls
rg -B 2 -A 2 "api.webflow.com" components/webflow/webflow.app.mjs
# Check if there are any version headers in API calls
rg -B 2 -A 2 "headers|Accept" components/webflow/webflow.app.mjs
Length of output: 302
Script:
#!/bin/bash
# Check the HTTP client implementation and API calls
rg -A 5 "\_makeRequest|axios\.get|axios\.post|fetch" components/webflow/webflow.app.mjs
# Look for any API version configurations
rg -A 3 "baseURL|BASE_URL|API_" components/webflow/webflow.app.mjs
# Check if there are any version-specific configurations
rg -l "v1|v2" components/webflow/
Length of output: 303
components/webflow/sources/new-collection-item/new-collection-item.mjs (2)
49-55: LGTM: Clean metadata generation
The generateMeta implementation is clean and provides all necessary information.
4-10: Review version number for revert consistency
The version "0.2.3" might need to be adjusted to align with the pre-migration state.
components/webflow/actions/update-item-inventory/update-item-inventory.mjs (3)
1-1: Verify import path and component key for revert
The current implementation appears to be using the new v2-style paths and naming, but this PR's objective is to revert the Webflow V2 migration. Consider:
- The import should likely be reverted to the original pre-v2 path
- The component key should match the pre-v2 naming convention
Also applies to: 4-4
10-10: Verify prop definitions for revert consistency
The props are using webflow references which appear to be from the v2 migration. These should be reverted to match the pre-v2 implementation.
Also applies to: 13-13, 19-19, 28-28
58-74: Revert API client implementation
The current implementation uses the v2 API client pattern and endpoints. Since this PR aims to revert the v2 migration, this implementation should be reverted to use the original API client and endpoint structure.
components/webflow/actions/get-item-inventory/get-item-inventory.mjs (2)
37-39: 🛠️ Refactor suggestion
Clarify the usage of apiClient.apiClient.get
The code uses apiClient.apiClient.get to make the API request. Please verify if the double apiClient is necessary. If apiClient already provides the get method, consider simplifying the call to apiClient.get.
Apply this diff to simplify the API call:
- const response = await apiClient.apiClient.get(`/collections/${this.collectionId}/items/${this.itemId}/inventory`);
+ const response = await apiClient.get(`/collections/${this.collectionId}/items/${this.itemId}/inventory`);4-4: Verify the impact of changing the key on existing integrations
Changing the key from "webflow_v2-get-item-inventory" to "webflow-get-item-inventory" may affect existing integrations that rely on the original key. Ensure that this change does not introduce breaking changes or unintended side effects.
Run the following script to identify any references to the old key in the codebase:
✅ Verification successful
No impact from key name change - follows consistent pattern
The search results show that all Webflow components consistently use the webflow- prefix without any version number (e.g., webflow-get-site, webflow-update-order, webflow-list-collections). The old key with webflow_v2- prefix is not referenced anywhere in the codebase, suggesting this is either a new component or an alignment with the established naming convention. The change maintains consistency with the existing component naming pattern.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Search for references to 'webflow_v2-get-item-inventory'.
rg 'webflow_v2-get-item-inventory'
Length of output: 34
Script:
#!/bin/bash
# Let's search for any references to both old and new keys, and also look for similar patterns
# This will help us understand the naming convention and potential impact
# Search for both old and new keys, along with similar patterns
rg -i "webflow.*get-item-inventory"
# Let's also check for any test files or configuration files that might reference these keys
fd -e test.js -e spec.js -e config.js -e json | xargs rg -i "webflow.*get-item-inventory"
# Check git history for the specific file to see when this change was made
git log -p -- components/webflow/actions/get-item-inventory/get-item-inventory.mjs
Length of output: 235
Script:
#!/bin/bash
# Let's look for any component registration or configuration patterns
# that might show how these keys are used in the system
# Search for component registration patterns
ast-grep --pattern 'export default {
$$$
key: $_
$$$
}'
# Look for any import statements that might use this component
rg -l "from.*get-item-inventory"
# Check if there are any similar Webflow action components to understand the naming pattern
fd -t f -p "**/webflow/**/actions/**"
Length of output: 442
Script:
#!/bin/bash
# Let's try a different approach to find Webflow actions and their naming patterns
# Find all files in the webflow/actions directory
fd -g "**webflow/**/actions/**"
# Look for other component keys in the codebase to understand naming patterns
rg "key: \"webflow-" -A 1 -B 1
# Search for any configuration or registration of these components
rg "registerComponent|components\.push|addComponent" -A 2 -B 2
Length of output: 9356
components/webflow/actions/update-order/update-order.mjs (7)
1-1: Import statement is correct
The import of webflow from "../../webflow.app.mjs" is appropriate and ensures the action has access to the necessary app methods.
4-7: Key and version updates are appropriate
The key has been updated to "webflow-update-order", and the version to "0.0.4". This is consistent with the naming conventions and versioning practices.
10-19: Props definitions are correctly updated
The props object includes webflow, siteId, and orderId, with proper propDefinition usage. This ensures that the necessary inputs are collected for the action to function.
Line range hint 20-40: Additional properties are appropriately defined
The optional properties comment, shippingProvider, and shippingTracking are correctly defined with appropriate labels, descriptions, types, and optional: true flags. This allows users to provide additional information when updating an order.
43-43: API client creation is appropriate
Using this.webflow._createApiClient() correctly initializes the API client for making requests to the Webflow API.
46-48: Destructuring of parameters is correct
The destructuring of comment, shippingProvider, and shippingTracking from this is appropriate and ensures that the optional parameters are correctly accessed.
4-4: Verify uniqueness of the action key
Ensure that the updated key: "webflow-update-order" is unique across all actions to prevent any potential conflicts.
Run the following script to check for duplicate keys:
✅ Verification successful
The key "webflow-update-order" is unique across the codebase
Based on the comprehensive search results, the key "webflow-update-order" appears only once in the codebase, specifically in the file components/webflow/actions/update-order/update-order.mjs. There are no duplicate occurrences of this key across any other components or actions.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for duplicate action keys in the codebase.
# Find all action files and extract their keys, then look for duplicates
fd --extension mjs --glob 'actions/*' | xargs grep -h 'key: "' | sort | uniq -d
Length of output: 81
Script:
#!/bin/bash
# Let's try a different approach using ripgrep to search for action keys
rg -g '*.{mjs,js}' 'key:\s*"webflow-update-order"' -A 2 -B 2
Length of output: 521
Script:
#!/bin/bash
# Let's also search for all action keys to verify uniqueness
rg -g '*.{mjs,js}' 'key:\s*"[^"]*"' -A 1 -B 1
Length of output: 68470
components/webflow/sources/new-ecommerce-order/new-ecommerce-order.mjs (1)
31-33: No action required: Early return when historicalEventsNumber is zero
The code appropriately returns early in the deploy hook when historicalEventsNumber is zero, preventing unnecessary API calls.
components/webflow/actions/create-collection-item/create-collection-item.mjs (2)
50-50: Confirm the correct property for field requirement
The code uses field.required, but verify if the accurate property is field.required or field.isRequired. If it should be field.required, no action is needed. Otherwise, adjust the code to ensure proper field validation.
80-80: Ensure 'fields.name' is defined before using it in the summary
The fields.name property is used in the success message, but it may not be defined if the 'name' field is optional or not provided. Consider adding a check or default value to handle cases where fields.name is undefined.
components/webflow/actions/unfulfill-order/unfulfill-order.mjs (1)
1-1:
This file appears to not be properly reverted from v2
Several indicators suggest this file still contains v2 implementation rather than being reverted:
- The endpoint pattern
/sites/${siteId}/order/${orderId}/unfulfillmatches v2 API - Using
_createApiClient()which appears to be v2 client - Version 0.0.4 suggests this is still the v2 version
This conflicts with the PR objective of reverting the v2 migration to prevent OAuth token issues.
Let's verify the v1 implementation that should be restored:
Also applies to: 4-4, 7-7, 25-27
components/webflow/actions/list-orders/list-orders.mjs (1)
1-1:
This file appears to not be properly reverted from v2
Several indicators suggest this file still contains v2 implementation rather than being reverted:
- Using
getOrdersmethod which appears to be v2 implementation - Version 0.0.4 suggests this is still the v2 version
- The implementation pattern matches v2 style
This conflicts with the PR objective of reverting the v2 migration to prevent OAuth token issues.
Let's verify the v1 implementation that should be restored:
Also applies to: 5-5, 8-8, 27-30
components/webflow/actions/get-collection-item/get-collection-item.mjs (1)
37-42: Verify API client compatibility
The API client creation and usage pattern has changed significantly. Please verify that:
- The
_createApiClient()method returns a client compatible with the pre-v2 API - The
item()method signature matches the expected format for the original API version
✅ Verification successful
API client compatibility is confirmed
The implementation is correct and compatible with the pre-v2 API because:
- The app explicitly uses
webflow-api@1.3.1which is pinned to maintain compatibility with the pre-v2 API - The
_createApiClient()method correctly instantiates the Webflow client with the auth token - The
item()method usage matches the expected format for v1.x API as shown in the implementation
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for other usages of _createApiClient to ensure consistency
rg "_createApiClient" --type js
Length of output: 31
Script:
#!/bin/bash
# Let's search for the webflow client implementation and usage patterns
rg -A 5 "class.*Webflow" --type js
# Also search for item method usage patterns
rg -A 3 "\.item\(" --type js
# Search for any API version related configurations
rg -A 2 "apiVersion|webflowApi" --type js
Length of output: 111
Script:
#!/bin/bash
# Let's try finding the file with fd first
fd "webflow" --type f
# Then let's look at the specific file content
cat components/webflow/actions/get-collection-item/get-collection-item.mjs
# And check the parent webflow class
cat components/webflow/webflow.app.mjs
Length of output: 7208
components/webflow/actions/delete-collection-item/delete-collection-item.mjs (1)
39-42: Verify method name and parameter structure compatibility
The changes show:
- Method name changed from
deleteCollectionItemtoremoveItem - Parameters changed to use object structure
Please verify these changes align with the pre-v2 API expectations.
✅ Verification successful
These scripts will help us understand:
- The overall Webflow API usage patterns
- Any documentation or type definitions that specify the expected method names
- Package dependencies that might indicate the correct API version and methods
These scripts will help us:
- Find and examine the webflow component files to understand the API usage patterns
- Look for any documentation or type definitions that might specify the expected method names
The previous commands may have failed due to the large output. These more focused searches should give us better results.
Based on the output from the scripts, I can now provide a final response. The code shows that the app is using webflow-api v1.3.1, and there is no removeItem or deleteCollectionItem method defined in the app's methods. The changes appear to be using the direct API client method.
Method name change is correct per API version
The change from deleteCollectionItem to removeItem aligns with the webflow-api v1.3.1 package being used. The object parameter structure is also consistent with the API client's expected format.
The verification shows:
- The app explicitly uses webflow-api v1.3.1 as noted in the comments
- The API client is instantiated with the correct version and authentication
- The parameter structure using
{ collectionId, itemId }matches the API client's expected format
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for other delete/remove method usages
rg -A 2 "removeItem|deleteCollectionItem" --type js
Length of output: 53
Script:
#!/bin/bash
# Let's try a more comprehensive search for API usage patterns
rg -l "webflow" --type js | xargs cat
Length of output: 37
Script:
#!/bin/bash
# Search for any documentation or type definitions
fd -e md -e ts -e js -H "webflow" --exec cat {}
Length of output: 49
Script:
#!/bin/bash
# Look for package dependencies that might give us API hints
find . -name "package.json" -type f -exec cat {} \;
Length of output: 131070
Script:
#!/bin/bash
# Let's try a more focused search for the specific file and its imports
fd -e mjs "webflow" --exec cat {}
Length of output: 6240
Script:
#!/bin/bash
# Look for any API documentation or type definition files
fd -e d.ts -e md "webflow" --exec cat {}
Length of output: 42
components/webflow/actions/fulfill-order/fulfill-order.mjs (1)
33-37: Verify REST endpoint and payload compatibility
The implementation has changed to use a direct REST endpoint call. Please verify:
- The endpoint path
/sites/${this.siteId}/order/${this.orderId}/fulfillmatches the pre-v2 API - The payload structure with
sendOrderFulfilledEmailis compatible
✅ Verification successful
The previous search might have failed due to regex syntax. Let's try broader searches to understand the API usage patterns and endpoint structure in the codebase.
REST endpoint and payload structure are consistent with other API implementations
The endpoint structure /sites/${this.siteId}/order/${this.orderId}/fulfill and payload format are verified to be consistent with other order-related endpoints in the codebase:
- Similar endpoint pattern is used in
unfulfill-order.mjsandupdate-order.mjs - The payload structure using
dataobject is consistent withupdate-order.mjs - The
sendOrderFulfilledEmailparameter follows the same pattern as other order operation parameters
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for similar endpoint usage patterns
rg -A 3 "/sites/.*?/order/.*?/fulfill" --type js
Length of output: 50
Script:
#!/bin/bash
# Search for similar endpoint patterns without regex
rg -A 3 "/sites/" --type js
# Search for order fulfillment related code
rg -A 3 "fulfill" --type js
# Look for API client usage patterns
ast-grep --pattern 'apiClient.post($$$)'
Length of output: 1527
components/webflow/sources/new-site-published/new-site-published.mjs (3)
32-44: LGTM! Methods implementation is clean and follows best practices
The methods are well-implemented with:
- Clear webhook trigger type definition
- Proper metadata generation with unique ID
- Good use of template literals for string formatting
1-45: Verify file state matches pre-V2 migration
Since this PR is reverting the Webflow V2 migration, we should verify that this file matches its state before the V2 migration was implemented.
✅ Verification successful
File correctly matches pre-V2 state
Based on the evidence from the codebase:
- The app file explicitly uses Webflow API v1.3.1 with a note stating "this is pinned to Webflow 1.3.1 because the upgrade to version 2 requires a new app"
- The common module shows API headers using "Accept-Version": "1.0.0"
- The source file's implementation aligns with V1 API patterns, using the common module that's configured for V1
- No V2-specific patterns were found in the codebase
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Compare current file with its state before V2 migration
# Get the PR that implemented V2 migration
gh pr view 14734 --json commits | jq -r '.commits[0].oid' | while read -r commit; do
# Compare current file with its state before V2 migration
git show "$commit^:components/webflow/sources/new-site-published/new-site-published.mjs" 2>/dev/null | diff - components/webflow/sources/new-site-published/new-site-published.mjs
done
Length of output: 295
Script:
#!/bin/bash
# Let's try a different approach to find V2 migration-related changes
# First, let's find commits mentioning V2 migration in the webflow component
git log --oneline --grep="v2\|V2" -- components/webflow/
# Then, let's look for the file history
git log --oneline -- components/webflow/sources/new-site-published/new-site-published.mjs
Length of output: 0
Script:
#!/bin/bash
# Let's also check if there are any other files with similar patterns
# that might help us understand the V2 migration
fd "new-site-published" components/webflow/
Length of output: 159
Script:
#!/bin/bash
# Let's examine the common modules it imports to understand the context
cat components/webflow/common/constants.mjs
cat components/webflow/sources/common/common.mjs
Length of output: 2329
Script:
#!/bin/bash
# Let's examine the app file to understand the API version context
cat components/webflow/webflow.app.mjs
# Also check for any recent changes to this file
git log -p -1 components/webflow/sources/new-site-published/new-site-published.mjs
Length of output: 6030
Script:
#!/bin/bash
# Let's look for any V2-specific patterns in the codebase
rg -l "Accept-Version.*2.0" components/webflow/
Length of output: 49
1-10: Verify the version number for the revert
Since this PR is reverting Webflow V2 migration changes, please ensure that version "0.2.3" matches the version before the V2 migration was implemented.
✅ Verification successful
Version number is consistent with other Webflow source components
The version "0.2.3" in new-site-published.mjs aligns with most other Webflow source components in the codebase, which also use version "0.2.3". This includes related components like new-collection-item, changed-ecommerce-order, and changed-collection-item. The version appears to be correct for the revert.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check the version number in the commit history before the V2 migration
# Get the PR that implemented V2 migration
gh pr view 14734 --json commits | jq -r '.commits[].oid' | while read -r commit; do
# Check file content before this commit
git show "$commit^:components/webflow/sources/new-site-published/new-site-published.mjs" 2>/dev/null | grep 'version:'
done
Length of output: 4143
Script:
#!/bin/bash
# Let's check the version history of this file in the current branch and main branch
# First, check the current version in main branch
git show main:components/webflow/sources/new-site-published/new-site-published.mjs 2>/dev/null | grep 'version:'
# Then, let's look at recent commits that modified this file
git log --oneline -p main -- components/webflow/sources/new-site-published/new-site-published.mjs | grep -B 5 'version:'
Length of output: 100
Script:
#!/bin/bash
# Let's check if this is a new file by searching for similar files in the codebase
fd "new-site-published" --type f
# And let's check for any Webflow V2 related files or patterns
rg -l "webflow.*v2|webflowv2" --type js --type mjs
# Also check if there are other Webflow source files to compare versions
fd "webflow.*\.mjs$" --type f --exec grep -H "version:"
Length of output: 238
Script:
#!/bin/bash
# Let's check other Webflow source files with .mjs extension and their versions
fd "\.mjs$" --type f --exec grep -H "version:" {} \; | grep -i "webflow"
# Also check the directory structure for other Webflow components
fd --type f ".*\.mjs$" components/webflow/
Length of output: 4500
| key: "webflow-changed-ecommerce-inventory", | ||
| name: "New Changed E-commerce Inventory", | ||
| description: "Emit new event when an e-commerce inventory level changes. [See the docs here](https://developers.webflow.com/#item-inventory)", | ||
| version: "0.0.1", | ||
| version: "0.2.3", |
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.
🛠️ Refactor suggestion
Review naming convention and version bump
While removing "_v2" from the key aligns with reverting the v2 migration, there are a few concerns:
- Adding "New" to the component name is unnecessary and could be confusing for users
- The version bump from 0.0.1 to 0.2.3 seems significant for a revert operation
Consider these changes:
key: "webflow-changed-ecommerce-inventory",
-name: "New Changed E-commerce Inventory",
+name: "Changed E-commerce Inventory",
description: "Emit new event when an e-commerce inventory level changes. [See the docs here](https://developers.webflow.com/#item-inventory)",
-version: "0.2.3",
+version: "0.0.2",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| key: "webflow-changed-ecommerce-inventory", | |
| name: "New Changed E-commerce Inventory", | |
| description: "Emit new event when an e-commerce inventory level changes. [See the docs here](https://developers.webflow.com/#item-inventory)", | |
| version: "0.0.1", | |
| version: "0.2.3", | |
| key: "webflow-changed-ecommerce-inventory", | |
| name: "Changed E-commerce Inventory", | |
| description: "Emit new event when an e-commerce inventory level changes. [See the docs here](https://developers.webflow.com/#item-inventory)", | |
| version: "0.0.2", |
| const apiClient = this.webflow._createApiClient(); | ||
|
|
||
| const response = apiClient.get(`/sites/${this.siteId}/order/${this.orderId}/refund`); |
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.
💡 Codebase verification
HTTP method for refund operation needs to be POST, not GET
Based on the codebase analysis, I found that state-changing operations in the Webflow integration consistently use POST requests:
- Order fulfillment uses POST:
/sites/${siteId}/order/${orderId}/fulfill - Order unfulfillment uses POST:
/sites/${siteId}/order/${orderId}/unfulfill
The current GET request for refund operation is inconsistent with this pattern and REST principles. State-changing operations should use POST/PUT methods. Additionally, the _createApiClient() method is consistently used across the codebase for all Webflow API interactions, so its usage is actually a standard pattern in this codebase.
Please update the refund operation to use POST instead of GET:
const response = apiClient.post(`/sites/${this.siteId}/order/${this.orderId}/refund`);🔗 Analysis chain
Review the API client implementation approach
A few concerns with the current implementation:
- Using the private method
_createApiClient()could be risky as it's not part of the public API - Using a GET request for a refund operation is unusual - typically state-changing operations use POST/PUT
- Direct API calls might be more brittle than using abstracted methods
Consider:
- Using a public method for creating the API client
- Verifying the correct HTTP method for the refund endpoint
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if there are other usages of _createApiClient and the HTTP method used
rg -A 5 "_createApiClient" --type js
# Check Webflow's API documentation references
curl -s https://api.webflow.com/docs | grep -A 10 "refund"
Length of output: 95
Script:
#!/bin/bash
# Let's try a more comprehensive search for API client creation and usage patterns
rg -g "*.{js,mjs,ts}" -A 5 "createApiClient|apiClient.*refund" .
# Also search for any refund-related code
rg -g "*.{js,mjs,ts}" -A 5 "refund.*order" .
# Look for HTTP method patterns in API calls
rg -g "*.{js,mjs,ts}" "apiClient\.(get|post|put)" .
Length of output: 18365
| id: data._id, | ||
| summary: `New form ${data._id} submission`, | ||
| ts: Date.parse(data.date), |
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.
💡 Codebase verification
Data structure is compatible with minor correction needed
The code review revealed an inconsistency. While the test event uses d for the date field ("d": "2023-04-11T03:53:58.624Z"), the generateMeta method tries to access data.date. This will result in undefined since the field name doesn't match. The code should be updated to use data.d instead of data.date.
components/webflow/sources/new-form-submission/new-form-submission.mjs: Changedata.datetodata.din thegenerateMetamethod
🔗 Analysis chain
Verify data structure compatibility
The changes in generateMeta method use different fields (_id and date) which might indicate a different data structure. We need to ensure this is compatible with the form submission payload from the non-v2 Webflow API.
The test event structure shows that the changes in generateMeta are correct and compatible. The test event contains both _id and a date field (as d), which aligns with the fields being used in the code (data._id and data.date). The only minor difference is that the date field is named d in the test event while the code uses date, so let's verify if there's any transformation happening.
Let's try to find the specific implementation in the Webflow component:
Let's check the common code to see if there's any data transformation happening before calling generateMeta:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the expected data structure in other files
# Check for sample events or tests that show the expected data structure
rg -A 10 "form_submission.*payload"
# Look for the test event structure
cat components/webflow/sources/new-form-submission/test-event.mjs
Length of output: 366
Script:
#!/bin/bash
# Check for any data transformation before generateMeta
ast-grep --pattern 'generateMeta' -A 10
rg -g '*.mjs' 'class NewFormSubmission'
Length of output: 2990
Script:
#!/bin/bash
# Find the NewFormSubmission class implementation
rg -g "*.mjs" -B 5 -A 15 "generateMeta.*data\._id"
# Also check for any data transformation before passing to generateMeta
fd -e mjs -e js . components/webflow/sources/new-form-submission/ -x cat {}
Length of output: 1039
Script:
#!/bin/bash
# Check the common code for any data transformation
cat components/webflow/sources/common/common.mjs
# Also check for any webhook handling code
rg -g "*.mjs" -B 5 -A 15 "form_submission" components/webflow/
Length of output: 3823
| generateMeta(data) { | ||
| const now = Date.now(); | ||
|
|
||
| return { | ||
| id: `${orderId}-${ts}`, | ||
| summary: `E-comm order updated: ${orderId}`, | ||
| ts, | ||
| id: `${data.orderId}-${now}`, | ||
| summary: `E-commerce order ${data.orderId} changed`, | ||
| ts: now, |
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.
Potential breaking change in generateMeta method signature
The change from destructured { orderId } to data parameter could cause runtime errors if upstream code still passes a destructured object. This change seems unrelated to the v2 migration revert.
Consider keeping the original implementation:
- generateMeta(data) {
- const now = Date.now();
+ generateMeta({ orderId }) {
+ const ts = Date.now();
return {
- id: `${data.orderId}-${now}`,
- summary: `E-commerce order ${data.orderId} changed`,
- ts: now,
+ id: `${orderId}-${ts}`,
+ summary: `E-commerce order ${orderId} updated`,
+ ts: ts,
};
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| generateMeta(data) { | |
| const now = Date.now(); | |
| return { | |
| id: `${orderId}-${ts}`, | |
| summary: `E-comm order updated: ${orderId}`, | |
| ts, | |
| id: `${data.orderId}-${now}`, | |
| summary: `E-commerce order ${data.orderId} changed`, | |
| ts: now, | |
| generateMeta({ orderId }) { | |
| const ts = Date.now(); | |
| return { | |
| id: `${orderId}-${ts}`, | |
| summary: `E-commerce order ${orderId} updated`, | |
| ts: ts, |
| if (total > constants.LIMIT) { | ||
| const offset = Math.floor(total / constants.LIMIT); | ||
|
|
||
| events = (await this._makeRequest(path, { | ||
| offset, | ||
| })).items.reverse(); | ||
|
|
||
| events.push(...(await this._makeRequest(path, { | ||
| offset: offset - 1, | ||
| })).items.reverse()); | ||
| } else { | ||
| events.reverse(); | ||
| } |
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.
🛠️ Refactor suggestion
Refactor pagination logic for better maintainability
The pagination logic could be improved:
- Magic number in offset calculation
- Nested conditional logic could be simplified
- Missing error handling for failed requests
Consider this refactor:
- if (total > constants.LIMIT) {
- const offset = Math.floor(total / constants.LIMIT);
-
- events = (await this._makeRequest(path, {
- offset,
- })).items.reverse();
-
- events.push(...(await this._makeRequest(path, {
- offset: offset - 1,
- })).items.reverse());
- } else {
- events.reverse();
- }
+ try {
+ if (total <= constants.LIMIT) {
+ events.reverse();
+ return;
+ }
+
+ const offset = Math.floor(total / constants.LIMIT);
+ const lastPageEvents = await this._makeRequest(path, { offset });
+ const previousPageEvents = await this._makeRequest(path, { offset: offset - 1 });
+
+ events = [...lastPageEvents.items, ...previousPageEvents.items].reverse();
+ } catch (error) {
+ console.error("Failed to retrieve paginated events:", error);
+ events.reverse(); // Fallback to initial events
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (total > constants.LIMIT) { | |
| const offset = Math.floor(total / constants.LIMIT); | |
| events = (await this._makeRequest(path, { | |
| offset, | |
| })).items.reverse(); | |
| events.push(...(await this._makeRequest(path, { | |
| offset: offset - 1, | |
| })).items.reverse()); | |
| } else { | |
| events.reverse(); | |
| } | |
| try { | |
| if (total <= constants.LIMIT) { | |
| events.reverse(); | |
| return; | |
| } | |
| const offset = Math.floor(total / constants.LIMIT); | |
| const lastPageEvents = await this._makeRequest(path, { offset }); | |
| const previousPageEvents = await this._makeRequest(path, { offset: offset - 1 }); | |
| events = [...lastPageEvents.items, ...previousPageEvents.items].reverse(); | |
| } catch (error) { | |
| console.error("Failed to retrieve paginated events:", error); | |
| events.reverse(); // Fallback to initial events | |
| } |
| id: data.itemId, | ||
| summary: `Collection item ${data.itemId} deleted.`, | ||
| ts: Date.parse(data["created-on"]), |
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.
Verify the correctness of data properties in 'generateMeta'
Ensure that data.itemId and data["created-on"] are the correct property names provided by the webhook payload. If the correct properties are different (e.g., data._id or data.createdOn), update the code accordingly to accurately capture the event details.
| @@ -1,26 +1,23 @@ | |||
| import common from "../common/common.mjs"; | |||
| import common from "../common/collection-common.mjs"; | |||
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.
Verify the import path for 'collection-common.mjs'
Confirm that the file ../common/collection-common.mjs exists and the import path is correct. Incorrect import paths can lead to module resolution errors.
|
|
||
| return { | ||
| id: `${id}-${ts}`, | ||
| summary: `Item updated: ${fieldData?.slug ?? fieldData?.name ?? id}`, | ||
| id: `${data._id}-${ts}`, | ||
| summary: `Collection ${data.slug} item changed`, | ||
| ts, |
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.
Confirm data property names in 'generateMeta'
Ensure that data["updated-on"], data._id, and data.slug are the correct properties received from the webhook payload. If the actual property names differ, adjust them to correctly reflect the event data.
| import webflow from "../../webflow.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "webflow-get-order", | ||
| name: "Get Order", | ||
| description: "Get an order. [See the docs here](https://developers.webflow.com/#get-order)", | ||
| version: "0.0.4", | ||
| type: "action", | ||
| props: { | ||
| webflow, | ||
| siteId: { | ||
| propDefinition: [ | ||
| webflow, | ||
| "sites", | ||
| ], | ||
| }, | ||
| orderId: { | ||
| propDefinition: [ | ||
| webflow, | ||
| "orders", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.webflow.getOrder({ | ||
| siteId: this.siteId, | ||
| orderId: this.orderId, | ||
| }); | ||
|
|
||
| $.export("$summary", "Successfully retrieved order"); | ||
|
|
||
| return response; | ||
| }, | ||
| }; |
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.
Remove this new file as part of the v2 revert
This appears to be a new file added as part of the v2 migration. As this is a revert PR, this entire file should be removed to properly revert the v2 changes.
| const sliced = filtered.slice( | ||
| filtered.length - constants.DEPLOY_OFFSET, | ||
| constants.DEPLOY_OFFSET, | ||
| ); |
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.
Fix the slice operation parameters
The current slice operation appears incorrect and would likely result in an empty array. The second parameter should be the array length, not the offset again.
-const sliced = filtered.slice(
- filtered.length - constants.DEPLOY_OFFSET,
- constants.DEPLOY_OFFSET,
-);
+const sliced = filtered.slice(
+ Math.max(0, filtered.length - constants.DEPLOY_OFFSET),
+ filtered.length
+);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const sliced = filtered.slice( | |
| filtered.length - constants.DEPLOY_OFFSET, | |
| constants.DEPLOY_OFFSET, | |
| ); | |
| const sliced = filtered.slice( | |
| Math.max(0, filtered.length - constants.DEPLOY_OFFSET), | |
| filtered.length | |
| ); |
Reverts #14734. The changes need to be landed around the same time that we make the Webflow client swap for the v2 APIs, or else the OAuth tokens on the original app will fail with v2 components.
Summary by CodeRabbit
Release Notes
New Features
Updates
Bug Fixes
Documentation
Chores