-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[FEATURE] Shopify Developer App - update to GraphQL API #15926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
WalkthroughThis PR refactors multiple Shopify integration modules by updating import paths, restructuring exported objects, and introducing dynamic property handling via a new utility function ( Changes
Sequence Diagram(s)sequenceDiagram
participant User as User/Trigger
participant Action as Shopify Action Module
participant Utils as adjustPropDefinitions()
participant Shopify as shopify_developer_app.app
participant API as Shopify API
User->>Action: Initiates action (e.g., create/update product)
Action->>Utils: Pass props for dynamic adjustment
Utils-->>Action: Returns adjusted properties
Action->>Shopify: Call method (e.g., run, getOrder, updateProduct)
Shopify->>API: Make API request with new prop definitions
API-->>Shopify: Return API response
Shopify-->>Action: Return response
Action-->>User: Emit summary message
Possibly related PRs
Suggested labels
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
Scope: all 2 workspace projects Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
✨ Finishing Touches
🪧 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: 5
🧹 Nitpick comments (19)
components/shopify_developer_app/sources/new-page/new-page.mjs (1)
18-21
: Property naming inconsistency detectedUnlike other components which use
shopify
directly as a prop name, this component usesapp: shopify
. Consider standardizing the property naming across all components for better consistency.props: { - app: shopify, + shopify, ...props, },components/shopify_developer_app/actions/update-product/update-product.mjs (1)
105-141
: Consider robust error handling and parallel execution.
- The method
run
executes multipleawait createMetafieldsArray
calls inside a loop. If performance is critical and variants can be numerous, consider batching or parallelizing requests.- Minimal error handling is present. In case of a failed API call, consider wrapping in
try/catch
to log or handle errors gracefully.components/shopify_developer_app/actions/create-customer/create-customer.mjs (1)
71-93
: Added implementation-specific run method.A dedicated run method has been added that directly implements the customer creation logic instead of relying on a common module. The implementation properly constructs the input object with customer details and returns a meaningful summary message.
One small observation: The method correctly uses the GraphQL API to create a customer, but error handling could be improved to provide clearer feedback if the API request fails.
async run({ $ }) { const response = await this.shopify.createCustomer({ input: { firstName: this.firstName, lastName: this.lastName, email: this.email, phone: this.phone, addresses: [ { address1: this.address, company: this.company, city: this.city, province: this.province, country: this.country, zip: this.zip, }, ], }, }); + if (response.customerCreate.userErrors?.length > 0) { + throw new Error(`Failed to create customer: ${JSON.stringify(response.customerCreate.userErrors)}`); + } $.export("$summary", `Created new customer with ID \`${response.customerCreate.customer.id}\``); return response; },components/shopify_developer_app/actions/delete-article/delete-article.mjs (1)
19-20
: Ensure correct order inprops
.Declaring
shopify
before spreading...props
ensures that any property key conflicts are resolved properly. This ordering convention is typically best practice, but confirm that no collisions or overwrites occur.components/shopify_developer_app/actions/search-product-variant/search-product-variant.mjs (1)
6-9
: Safe destructuring and property pass-through.The destructuring of
name
,description
, andtype
, and passing the remaining toothers
is a clean approach. Verify thatothers.props
is consistent with the base file to avoid runtime errors.components/shopify_developer_app/actions/add-tags/add-tags.mjs (1)
6-9
:adjustPropDefinitions
usage.The new utility function call is straightforward. Please confirm that any default or overridden properties remain intact after
adjustPropDefinitions
processes them.components/shopify_developer_app/actions/delete-metafield/delete-metafield.mjs (4)
5-7
: Optional check forothers.props
.Same pattern as other files: destructuring
name
,description
,type
, then spreadingothers
. Confirm the shape ofothers
to ensure no undefined references.
17-17
: Ensureshopify
initialization.Assigning
shopify
toprops
is standard. Just confirm that any references toapp
in the originalcommon
code are updated toshopify
to prevent confusion.
23-25
: Remove or gatekeep console logs.Line 24 logs
props
to the console. Ensure this log is intentional, or consider removing it or using a logger with appropriate logging levels.Apply this diff to remove the console log if not needed:
- const props = await this.getOwnerIdProp(this.ownerResource); console.log(props); + const props = await this.getOwnerIdProp(this.ownerResource);
26-31
: Dynamically reloading props.Modifying
props.ownerId
withreloadProps: true
is helpful for dynamic forms. Ensure that any dependent logic is aware of this flow and adjusts properly when the user changesownerId
.components/shopify_developer_app/actions/update-inventory-level/update-inventory-level.mjs (1)
20-20
: Proactive '...props' usage
Spreading the dynamic props ensures flexibility for future expansions or modifications.Consider documenting the shape of
props
to facilitate user understanding of available properties.components/shopify_developer_app/actions/search-customers/search-customers.mjs (2)
17-20
: New 'max' prop
Allowing an optional limit enhances user control over the returned records.Consider adding input validation or boundary checks.
22-35
: Asynchronous 'run' method
Retrieving paginated data viathis.shopify.getPaginated
is succinct and functional. The$summary
output clarifies the operation's result.Consider adding error handling for possible request failures or partial successes.
components/shopify_developer_app/actions/common/metafield-actions.mjs (4)
9-15
: New 'ownerResource' prop
Empowering users to filter by resource type is a flexible addition. Be mindful to keepRESOURCE_TYPES
in sync if new resource types are added.Consider adding runtime validation to ensure the user picks from allowed resource types.
17-157
: Comprehensive 'getOwnerIdProp' method
Automating prop definitions for each resource reduces repetitive code. The dynamicoptions
approach is robust.This block can be refactored to reduce duplication, possibly by mapping resource strings to functions or using a single helper function for listing resources.
167-233
: Dynamic 'listMetafields' method
Good approach for coverage across multiple resource types. If additional resources are introduced, consider a single mapping approach to reduce repeated if-else logic.
245-269
: 'createMetafieldsArray' method
Dynamic creation/updating of metafields is well-handled.Consider validating the parsed JSON to ensure array structure before iteration.
components/shopify_developer_app/actions/create-metaobject/create-metaobject.mjs (1)
12-12
: Confirm version alignment.You have updated the version to
"0.0.7"
. Double-check that this increment aligns with the rest of your release or versioning strategy, ensuring consistency across related modules.Also applies to: 14-17
components/shopify_developer_app/actions/create-smart-collection/create-smart-collection.mjs (1)
2-4
: Import updates look good but usage of adjustPropDefinitions needs documentation.The updated imports from
@pipedream/shopify
and the new utility function import follow good practices for modularization. However, theadjustPropDefinitions
utility function isn't immediately clear in its purpose and behavior.Consider adding a brief comment explaining what
adjustPropDefinitions
does, for example:// Utility function that adapts property definitions to work with the Shopify developer app import { adjustPropDefinitions } from "../../common/utils.mjs";
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yaml
is excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (61)
components/shopify_developer_app/actions/add-product-to-custom-collection/add-product-to-custom-collection.mjs
(1 hunks)components/shopify_developer_app/actions/add-tags/add-tags.mjs
(1 hunks)components/shopify_developer_app/actions/common/constants.mjs
(1 hunks)components/shopify_developer_app/actions/common/metafield-actions.mjs
(1 hunks)components/shopify_developer_app/actions/common/metaobjects.mjs
(0 hunks)components/shopify_developer_app/actions/create-article/create-article.mjs
(1 hunks)components/shopify_developer_app/actions/create-blog/create-blog.mjs
(1 hunks)components/shopify_developer_app/actions/create-custom-collection/create-custom-collection.mjs
(1 hunks)components/shopify_developer_app/actions/create-customer/create-customer.mjs
(2 hunks)components/shopify_developer_app/actions/create-metafield/create-metafield.mjs
(1 hunks)components/shopify_developer_app/actions/create-metaobject/create-metaobject.mjs
(1 hunks)components/shopify_developer_app/actions/create-order/create-order.mjs
(1 hunks)components/shopify_developer_app/actions/create-page/create-page.mjs
(1 hunks)components/shopify_developer_app/actions/create-product-variant/create-product-variant.mjs
(1 hunks)components/shopify_developer_app/actions/create-product/create-product.mjs
(1 hunks)components/shopify_developer_app/actions/create-smart-collection/create-smart-collection.mjs
(1 hunks)components/shopify_developer_app/actions/delete-article/delete-article.mjs
(1 hunks)components/shopify_developer_app/actions/delete-blog/delete-blog.mjs
(1 hunks)components/shopify_developer_app/actions/delete-metafield/delete-metafield.mjs
(1 hunks)components/shopify_developer_app/actions/delete-page/delete-page.mjs
(1 hunks)components/shopify_developer_app/actions/get-articles/get-articles.mjs
(1 hunks)components/shopify_developer_app/actions/get-metafields/get-metafields.mjs
(1 hunks)components/shopify_developer_app/actions/get-metaobjects/get-metaobjects.mjs
(1 hunks)components/shopify_developer_app/actions/get-order/get-order.mjs
(1 hunks)components/shopify_developer_app/actions/get-pages/get-pages.mjs
(1 hunks)components/shopify_developer_app/actions/search-custom-collection-by-name/search-custom-collection-by-name.mjs
(1 hunks)components/shopify_developer_app/actions/search-customers/search-customers.mjs
(1 hunks)components/shopify_developer_app/actions/search-product-variant/search-product-variant.mjs
(1 hunks)components/shopify_developer_app/actions/search-products/search-products.mjs
(1 hunks)components/shopify_developer_app/actions/update-article/update-article.mjs
(1 hunks)components/shopify_developer_app/actions/update-customer/update-customer.mjs
(2 hunks)components/shopify_developer_app/actions/update-inventory-level/update-inventory-level.mjs
(1 hunks)components/shopify_developer_app/actions/update-metafield/update-metafield.mjs
(2 hunks)components/shopify_developer_app/actions/update-metaobject/update-metaobject.mjs
(1 hunks)components/shopify_developer_app/actions/update-page/update-page.mjs
(1 hunks)components/shopify_developer_app/actions/update-product-variant/update-product-variant.mjs
(1 hunks)components/shopify_developer_app/actions/update-product/update-product.mjs
(2 hunks)components/shopify_developer_app/common/mutations.mjs
(1 hunks)components/shopify_developer_app/common/queries.mjs
(1 hunks)components/shopify_developer_app/common/rest-admin.mjs
(0 hunks)components/shopify_developer_app/common/utils.mjs
(1 hunks)components/shopify_developer_app/package.json
(2 hunks)components/shopify_developer_app/shopify_developer_app.app.mjs
(1 hunks)components/shopify_developer_app/sources/common/webhook.mjs
(2 hunks)components/shopify_developer_app/sources/new-abandoned-cart/new-abandoned-cart.mjs
(1 hunks)components/shopify_developer_app/sources/new-article/new-article.mjs
(1 hunks)components/shopify_developer_app/sources/new-cancelled-order/new-cancelled-order.mjs
(1 hunks)components/shopify_developer_app/sources/new-customer-created/new-customer-created.mjs
(1 hunks)components/shopify_developer_app/sources/new-draft-order/new-draft-order.mjs
(1 hunks)components/shopify_developer_app/sources/new-event-emitted/new-event-emitted.mjs
(2 hunks)components/shopify_developer_app/sources/new-fulfillment-event/new-fulfillment-event.mjs
(1 hunks)components/shopify_developer_app/sources/new-order-created/new-order-created.mjs
(1 hunks)components/shopify_developer_app/sources/new-order-fulfilled/new-order-fulfilled.mjs
(1 hunks)components/shopify_developer_app/sources/new-page/new-page.mjs
(1 hunks)components/shopify_developer_app/sources/new-paid-order/new-paid-order.mjs
(1 hunks)components/shopify_developer_app/sources/new-product-created/new-product-created.mjs
(1 hunks)components/shopify_developer_app/sources/new-product-updated/new-product-updated.mjs
(3 hunks)components/shopify_developer_app/sources/new-refund-created/new-refund-created.mjs
(1 hunks)components/shopify_developer_app/sources/new-updated-customer/new-updated-customer.mjs
(1 hunks)components/shopify_developer_app/sources/new-updated-order/new-updated-order.mjs
(1 hunks)components/shopify_developer_app/sources/product-added-to-custom-collection/product-added-to-custom-collection.mjs
(1 hunks)
💤 Files with no reviewable changes (2)
- components/shopify_developer_app/actions/common/metaobjects.mjs
- components/shopify_developer_app/common/rest-admin.mjs
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: pnpm publish
- GitHub Check: Publish TypeScript components
- GitHub Check: Verify TypeScript components
🔇 Additional comments (193)
components/shopify_developer_app/actions/update-metaobject/update-metaobject.mjs (4)
2-4
: Improved import structure for better modularityThe import paths have been updated to use a more standardized approach. The code now pulls from the main update-metaobject.mjs module rather than a separate common file, and introduces a utility function for prop definition adjustments.
6-9
: Good use of destructuring to separate common elementsNice approach using destructuring to extract specific properties while collecting remaining ones with the spread operator. This provides a clean way to reuse the common implementation while allowing for customization specific to this component.
12-17
: Clean implementation of component propertiesThe exported object structure is now more maintainable by dynamically including properties from the common module rather than hardcoding them. The version increment to 0.0.8 reflects these changes appropriately.
20-20
: Improved property handling with adjustPropDefinitionsUsing the
adjustPropDefinitions
utility function to process properties ensures consistent handling across different Shopify components, making the code more maintainable and standardized.components/shopify_developer_app/actions/update-article/update-article.mjs (4)
1-4
: Import changes reflect shift from REST to GraphQL APIThe imports have been updated to use the main Shopify app module and a common utility function for property definitions. This change aligns with the PR objective of updating to GraphQL API and creates better separation of concerns.
6-9
: Improved code modularity with dynamic property handlingThe code now leverages destructuring to extract common properties and uses the new
adjustPropDefinitions
utility to dynamically modify property definitions. This approach enhances maintainability and consistency across Shopify components.
11-17
: Enhanced code reusability with proper version incrementThe exported object now spreads
others
(from the common module) and explicitly includes the destructured properties. The version has been properly incremented to 0.0.7, following semantic versioning practices.
18-21
: Simplified props definition with improved structureThe props object now includes the Shopify app instance and spreads the dynamically adjusted props, creating a more consistent interface across components.
components/shopify_developer_app/actions/update-page/update-page.mjs (5)
1-2
: Improved import organization and architecture.The imports have been updated to align with a more consistent pattern across the codebase. Importing directly from
shopify_developer_app.app.mjs
instead of the previous REST admin implementation suggests a move toward a more centralized approach to handling Shopify interactions.
4-4
: Good addition of the utility function.Introducing the
adjustPropDefinitions
utility function helps standardize how properties are modified across different components, promoting consistency and reducing code duplication.
6-9
: Improved property handling with common patterns.The destructuring approach used here is excellent for extracting specific properties while gathering the rest under
others
. The use ofadjustPropDefinitions
creates a standardized way to adapt properties for the Shopify context.
11-17
: Well-structured export with improved modularity.Using the destructured properties from the common module rather than hardcoding them improves maintainability and ensures consistency. The version increment to
0.0.7
correctly reflects the changes made.
18-21
: Props structure follows new pattern correctly.The props object now includes the Shopify app instance directly and spreads the adjusted props, which aligns with the architectural changes being made throughout the codebase.
components/shopify_developer_app/sources/new-article/new-article.mjs (7)
4-4
: Good addition of utility importAdding the
adjustPropDefinitions
utility function import is a good practice for code reusability across Shopify integration components.
6-9
: Clean restructuring of common objectThe destructuring approach extracts only what's needed while collecting the rest in
others
. This makes the code more explicit about which properties are directly used vs. passed through.
9-9
: Improved prop handling with utility functionUsing
adjustPropDefinitions
to process the props creates more consistent property handling across Shopify components and likely handles any necessary transformations in one place.
12-17
: Cleaner component definitionThe restructured component exports individual properties directly instead of spreading the entire common object, which makes the component structure more explicit and easier to understand.
14-14
: Appropriate version incrementVersion has been properly incremented from "0.0.4" to "0.0.5" to reflect the changes made to the component.
19-20
: Standardized prop naming conventionChanged from
shopify
toapp: shopify
which likely aligns with a standardization effort across the codebase to consistently name app instances asapp
.
2-2
:✅ Verification successful
Verify import path to prevent circular dependencies
The import path has been changed from
common.mjs
tonew-article.mjs
, which is the same name as the current file. This could potentially lead to circular dependencies or confusion. Verify that this is intentional and not a mistake.
🏁 Script executed:
#!/bin/bash # Check if the import path actually exists and is not a circular reference echo "Checking for the import path..." fd "new-article.mjs" --full-path | grep -v "shopify_developer_app" | head -n 5 echo "Checking import structure of @pipedream/shopify..." find . -type f -name "package.json" | xargs grep -l "@pipedream/shopify" | head -n 3Length of output: 584
Import path verified — no circular dependency detected.
The source file being imported (resolved to
components/shopify/sources/new-article/new-article.mjs
) is different from the current file (components/shopify_developer_app/sources/new-article/new-article.mjs
), which confirms that this naming similarity is intentional and does not introduce circular dependencies.
- Verification using file search revealed two distinct locations.
- The resolved import path for "@pipedream/shopify/sources/new-article/new-article.mjs" targets a module separate from the current one.
components/shopify_developer_app/actions/search-products/search-products.mjs (5)
4-4
: No issues with this new import.
adjustPropDefinitions
is correctly imported and used in alignment with the approach introduced in other files.
6-9
: Declare defensive checks for missing props.
Ifothers.props
is undefined or falsey, this could throw an error at runtime when callingadjustPropDefinitions
. Consider adding a fallback or verifying thatcommon
always exportsprops
.
12-17
: Overriding objects and fields is consistent.
Spreading...others
and then specifying new values forkey
,version
,name
,description
, andtype
is a clean approach and clarifies your custom overrides. This is good practice.
20-20
: Confirm dynamic props alignment.
Use of...props
provides flexibility, but ensure that previously removed properties (e.g.,title
,productIds
) are either no longer needed or are retained throughothers.props
.Would you like a shell script to locate references to those deprecated fields and confirm they’re not still in use elsewhere?
2-2
:❓ Verification inconclusive
Verify the external import path.
Ensure that referencing the same-named module from@pipedream/shopify/actions/search-products/search-products.mjs
does not introduce a circular reference. If it’s an external library or separate file (as intended), that’s fine.You may run a quick search for all import usage of this file to confirm there's no cyclical dependency:
🏁 Script executed:
#!/bin/bash rg -A 5 "import .* from '@pipedream/shopify/actions/search-products/search-products.mjs'"Length of output: 97
Action Required: Validate External Import Path for Circular Dependency Potential
After running the automated search, no additional references to
@pipedream/shopify/actions/search-products/search-products.mjs
were found. However, since the search produced no output, it's inconclusive whether the imported module is entirely external or if it might inadvertently reference the current file, thus risking a circular dependency.
- Next Step: Please verify manually that the import in
components/shopify_developer_app/actions/search-products/search-products.mjs
truly points to an external module and does not create a self-reference.- Review Consideration: Check your module resolution (e.g., package configuration or aliasing) to ensure this import is not resolving to the same file or another internal module that could lead to cyclic dependencies.
components/shopify_developer_app/actions/create-product-variant/create-product-variant.mjs (3)
2-9
: Good refactoring to leverage common module patternYou've successfully implemented the pattern of importing from the common Shopify module and using the
adjustPropDefinitions
utility. This approach improves maintainability by centralizing shared logic and ensuring consistency across the Shopify integration.
12-17
: Improved component definition structureThe restructuring from spreading
common
to spreadingothers
while explicitly definingname
,description
, andtype
makes the component structure clearer and more consistent with other Shopify components. Version bump to 0.0.6 is appropriate for these changes.
18-21
: Props configuration aligns with updated patternUsing the adjusted props from the utility function provides consistency in how properties are defined across Shopify components while maintaining the specific shopify app reference.
components/shopify_developer_app/sources/new-abandoned-cart/new-abandoned-cart.mjs (3)
2-9
: Consistent implementation of common module patternThe implementation follows the same pattern as the action components, importing from the common module and using the
adjustPropDefinitions
utility. This consistency across both actions and sources is good for maintainability.
12-17
: Source component structure appropriately updatedThe restructuring matches the pattern used in other components, with proper version increment to 0.0.6. Using destructured properties from common rather than hardcoding them reduces duplication and improves maintainability.
18-21
: Props structure follows the standard patternThe props structure maintains the same pattern as in the action components, using the shopify app reference and spreading the adjusted props.
components/shopify_developer_app/actions/get-metaobjects/get-metaobjects.mjs (3)
2-9
: Metaobjects component updated to use common patternThe component now follows the standard pattern for Shopify integration components, importing from the shared module and using the
adjustPropDefinitions
utility. This consistency is beneficial for maintainability.
12-17
: Component definition restructured consistentlyThe component definition follows the same pattern as other Shopify components with appropriate version increment to 0.0.6.
18-21
: Props configuration utilizes adjustment utilityThe props configuration leverages the
adjustPropDefinitions
utility, which standardizes how properties are defined across components while maintaining component-specific requirements.components/shopify_developer_app/sources/new-page/new-page.mjs (1)
2-9
: New page source updated to use common patternThis source component now follows the standard pattern for Shopify integration, importing from a common module and leveraging the
adjustPropDefinitions
utility.components/shopify_developer_app/sources/product-added-to-custom-collection/product-added-to-custom-collection.mjs (3)
2-4
: Validate the new import references.You’ve changed the source of common logic to
@pipedream/shopify/sources/collection-updated/collection-updated.mjs
. Confirm that the functionalities incollection-updated.mjs
align well with this custom-collection scenario.
7-9
: Good use of destructuring and prop adjustment.Destructuring
name
,description
, andtype
for direct usage while adjusting the remaining props is a clean approach for reusability.
14-17
: Version bump and property merges.The increment to
0.0.5
, along with mergingname
,description
, andtype
into the export, looks consistent. Ensure any downstream references expecting the old version or dedupe logic are properly updated or removed.Also applies to: 20-20
components/shopify_developer_app/actions/update-product-variant/update-product-variant.mjs (2)
2-9
: Refactored imports and prop definitions look correct.By sourcing
common
from the new path and applyingadjustPropDefinitions
, you maintain a coherent structure while simplifying code.
14-17
: Version increment and field assignment.Updating to
0.0.7
and exposingname
,description
, andtype
directly is aligned with the rest of the refactor. Confirm all references to the previous object fields are updated or deprecated.Also applies to: 20-20
components/shopify_developer_app/actions/update-product/update-product.mjs (3)
2-3
: Review changes to imported modules.
import common from "../common/metafield-actions.mjs";
andimport utils from "@pipedream/shopify/common/utils.mjs";
appear to be consolidating metafield-related functionality and shared utilities. Verify these modules supply all required methods (e.g.,createMetafieldsArray
,parseArrayOfJSONStrings
).
9-10
: Documentation and version update.The clarified description references the official Shopify docs, and moving to version
0.0.6
helps track this feature update.
45-53
: Confirm case sensitivity in status field.The code references
"ACTIVE"
,"ARCHIVED"
, and"DRAFT"
, while your description references lowercase values. Shopify’s GraphQL often treats enum values as uppercase. Confirm that this exact casing aligns with Shopify’s API requirements.components/shopify_developer_app/package.json (1)
3-3
: Version and dependency updates align with GraphQL API enhancements.The version bump to 0.7.0 and dependency update to @pipedream/shopify ^0.7.0 are consistent with the PR's objective of updating the GraphQL API. This minor version increment correctly signals the addition of new features without breaking changes.
Also applies to: 17-17
components/shopify_developer_app/sources/new-refund-created/new-refund-created.mjs (3)
8-8
: Version increment is appropriate for the changes.The patch version update from 0.0.5 to 0.0.6 correctly reflects the minor modifications made to this component.
14-14
: Simplified topic reference with hardcoded string.Changed from using a constants reference to a direct string literal "REFUNDS_CREATE". This simplifies the code by removing dependency on an external constants module.
17-17
: Updated property name to camelCase convention.Changed from
resource.created_at
toresource.createdAt
, which aligns with the standardization of camelCase across the codebase.components/shopify_developer_app/actions/create-customer/create-customer.mjs (1)
6-7
: Improved documentation reference and version increment.The description now includes a specific link to the Shopify GraphQL API documentation for the customerCreate mutation, and the version has been appropriately incremented.
components/shopify_developer_app/sources/new-customer-created/new-customer-created.mjs (4)
9-9
: Version increment is appropriate for the changes.The patch version update from 0.0.8 to 0.0.9 correctly reflects the minor modifications made to this component.
14-14
: Simplified topic reference with hardcoded string.Changed from using a constants reference to a direct string literal "CUSTOMERS_CREATE". This simplifies the code by removing dependency on an external constants module.
17-17
: Updated property name to camelCase convention.Changed from
resource.created_at
toresource.createdAt
, which aligns with the standardization of camelCase across the codebase.
20-20
: Improved summary message formatting.Removed the trailing period from the summary string for better consistency in notification messages.
components/shopify_developer_app/actions/common/constants.mjs (1)
1-86
: Well-structured constants file for Shopify resources and metafieldsThis new constants file provides a comprehensive collection of Shopify resource types and metafield types which will be useful for the GraphQL API update. The organization is clear and follows standard JavaScript practices.
components/shopify_developer_app/sources/new-cancelled-order/new-cancelled-order.mjs (3)
9-9
: Version correctly incrementedVersion has been properly bumped from 0.0.8 to 0.0.9 to reflect the changes.
13-15
: Hardcoded webhook topic stringThe webhook topic has been changed from using a constant to a hardcoded string, which aligns with the GraphQL API update approach.
16-23
: Standardized to camelCase property accessUpdated from snake_case
updated_at
to camelCaseupdatedAt
and removed trailing period from summary string, maintaining consistency with GraphQL conventions.components/shopify_developer_app/sources/new-fulfillment-event/new-fulfillment-event.mjs (3)
9-9
: Version correctly incrementedVersion has been properly bumped from 0.0.6 to 0.0.7 to reflect the changes.
13-15
: Hardcoded webhook topic stringThe webhook topic has been changed from using a constant to a hardcoded string, aligning with the GraphQL API update approach seen across other files.
16-23
: Standardized to camelCase property accessUpdated from snake_case
updated_at
to camelCaseupdatedAt
and removed trailing period from summary string, maintaining consistency with GraphQL conventions.components/shopify_developer_app/sources/new-paid-order/new-paid-order.mjs (3)
9-9
: Version correctly incrementedVersion has been properly bumped from 0.0.8 to 0.0.9 to reflect the changes.
13-15
: Hardcoded webhook topic stringThe webhook topic has been changed from using a constant to a hardcoded string, aligning with the GraphQL API update approach seen across other files.
16-23
: Standardized to camelCase property accessUpdated from snake_case
updated_at
to camelCaseupdatedAt
and removed trailing period from summary string, maintaining consistency with GraphQL conventions.components/shopify_developer_app/sources/new-updated-order/new-updated-order.mjs (3)
9-9
: Version increment looks goodVersion bump from 0.0.8 to 0.0.9 is appropriate for these changes.
13-15
: API topic reference updatedThe change from using a constants reference to a hardcoded string aligns with the GraphQL API update approach.
16-22
: Property name and formatting updates align with GraphQL conventionsGood changes converting from snake_case to camelCase for property names and standardizing summary string format.
components/shopify_developer_app/sources/new-draft-order/new-draft-order.mjs (3)
9-9
: Version increment looks goodVersion bump from 0.0.8 to 0.0.9 is appropriate for these changes.
13-15
: Topic reference updated consistentlyGood update from constants reference to hardcoded string, maintaining consistency with other files.
16-22
: Property naming and format standardizationGood updates to camelCase property access and summary string formatting to align with GraphQL conventions.
components/shopify_developer_app/sources/new-order-fulfilled/new-order-fulfilled.mjs (3)
9-9
: Version increment is appropriateVersion bump from 0.0.5 to 0.0.6 is correct for this component.
13-15
: Topic reference updated consistentlyChange from constants reference to hardcoded string matches the approach used throughout the PR.
16-22
: Property naming and format standardizationGood updates to camelCase property access and standardized summary string format.
components/shopify_developer_app/sources/new-updated-customer/new-updated-customer.mjs (3)
9-9
: Version increment looks goodVersion bump from 0.0.8 to 0.0.9 is appropriate for these changes.
13-15
: Topic reference updated consistentlyGood update from constants reference to hardcoded string, consistent with the pattern in other files.
16-22
: Property naming and format standardizationGood updates to camelCase property access and standardized summary string format, consistent with GraphQL conventions.
components/shopify_developer_app/sources/new-product-created/new-product-created.mjs (4)
9-9
: Version incremented appropriately.The version has been updated from "0.0.8" to "0.0.9" to reflect the changes made to this component.
17-17
: Property naming convention standardized to camelCase.Changed from
resource.created_at
toresource.createdAt
, which aligns with the GraphQL API response format and JavaScript naming conventions.
20-20
: Minor formatting improvement.Removed the period at the end of the summary string for consistency with other summary strings in the codebase.
13-15
:❓ Verification inconclusive
Hardcoded webhook topic value.
The method now returns a hardcoded string "PRODUCTS_CREATE" instead of referencing a constant from the constants module. This is consistent with the approach taken in other updated files, but consider the maintainability impact if these topic values need to change in the future.
🏁 Script executed:
#!/bin/bash # Find other occurrences of this webhook topic to verify consistency rg -i "PRODUCTS_CREATE" --type jsLength of output: 33
Maintainability Concern: Hardcoded Webhook Topic
- In
components/shopify_developer_app/sources/new-product-created/new-product-created.mjs
(lines 13–15), thegetTopic()
method now returns a hardcoded"PRODUCTS_CREATE"
.- Although this mirrors changes in other recently updated files, having the topic hardcoded could complicate maintenance if the topic value ever needs to change.
- A preliminary repository search for
"PRODUCTS_CREATE"
produced no additional occurrences, so its usage seems limited to this spot. However, please verify manually that this change consistently aligns with the overall codebase practices regarding webhook topic management.components/shopify_developer_app/common/utils.mjs (1)
1-40
: Well-designed utility function for standardizing prop definitions.The
adjustPropDefinitions
function provides a clean way to modify property definitions across components, ensuring consistent integration with the Shopify app. This helper standardizes how propDefinitions are structured when components reference app properties.This utility:
- Preserves string properties as-is
- For objects with
propDefinition
, prepends the app reference- Filters out app-type properties that are no longer needed
- Retains other property values intact
This approach significantly reduces code duplication across action and source components while making future app reference updates easier to maintain.
components/shopify_developer_app/sources/new-product-updated/new-product-updated.mjs (4)
8-8
: Version incremented appropriately.The version has been updated from "0.0.6" to "0.0.7" to reflect the changes made to this component.
28-30
: Hardcoded webhook topic value.The method now returns a hardcoded string "PRODUCTS_UPDATE" instead of referencing a constant from the constants module. This matches the approach in other files and simplifies the code.
32-34
: Property naming convention standardized to camelCase.Changed from checking
resource.product_type
toresource.productType
, which aligns with GraphQL API response format and JavaScript naming conventions.
45-47
: Property naming convention standardized to camelCase.Changed from parsing
resource.updated_at
toresource.updatedAt
, maintaining consistency with the GraphQL API response format.components/shopify_developer_app/actions/update-customer/update-customer.mjs (4)
2-2
: Updated import path for metafield actions.The import path has been changed to use the common metafield actions module, which likely centralizes metafield functionality across components.
8-8
: Updated documentation reference to GraphQL API.The description now correctly points to the GraphQL API documentation instead of the REST API, reflecting the underlying implementation change.
9-9
: Version incremented appropriately.The version has been updated from "0.0.5" to "0.0.6" to reflect the implementation of the run method.
87-112
: Complete implementation of the update customer functionality.The new
run
method properly implements the customer update functionality using the GraphQL API:
- Creates metafields using the common utility method
- Constructs a well-structured input object with all customer properties
- Calls the Shopify API with the appropriate parameters
- Provides a clear summary message with the customer identifier
- Returns the complete API response
The implementation handles all the provided customer fields and correctly structures the address as an array, matching Shopify's API requirements.
components/shopify_developer_app/sources/new-event-emitted/new-event-emitted.mjs (4)
2-2
: Good import additionAdding the constants import is a good practice to maintain consistency across the codebase and access the EVENT_TOPIC definitions.
10-10
: Version increment is appropriateVersion number has been incremented from "0.0.9" to "0.0.10", which is good practice when introducing changes.
18-24
: Improved topic options structureThe refactoring of topic options to use Object.entries with mapping to value/label pairs improves readability and maintainability. This approach is more flexible and follows best practices for dropdown options.
36-36
: Minor formatting improvementRemoving the period at the end of the summary string creates a more consistent formatting style.
components/shopify_developer_app/sources/common/webhook.mjs (3)
15-27
: Updated to new Shopify GraphQL webhook APIThe webhook creation implementation has been completely refactored to use the new Shopify GraphQL API structure. This is a significant improvement that:
- Uses proper destructuring from the nested response object
- Changes
address
to the more descriptivecallbackUrl
- Explicitly specifies
format: "JSON"
- Properly consolidates metafield namespaces
The new implementation is more robust and follows current Shopify API best practices.
31-33
: Added defensive programmingAdding a conditional check before deleting the webhook is a good defensive programming practice. This prevents potential errors when attempting to delete a non-existent webhook.
56-56
: Improved validation logicThe webhook event validation has been improved by comparing against a constant value from EVENT_TOPIC rather than directly using getTopic(). This approach is more maintainable and ensures consistent validation.
components/shopify_developer_app/common/queries.mjs (4)
1-37
: Well-structured GET_ORDER GraphQL queryThis GraphQL query for retrieving order details is well-structured and includes important related data like metafields and suggested refund details. The query includes pagination support through the
first
andafter
parameters, making it suitable for handling large datasets.
39-84
: Comprehensive GET_CUSTOMER queryThe GET_CUSTOMER query provides a thorough structure for retrieving customer data, including personal information, order statistics, addresses, and metafields. The pagination support for metafields is appropriately implemented.
106-127
: Well-implemented listing queries with paginationThe LIST_ORDERS, LIST_DRAFT_ORDERS, and LIST_CUSTOMERS queries are well-implemented with proper pagination support. They retrieve the necessary fields and include the pageInfo.endCursor for continuing pagination.
Also applies to: 129-149, 151-172
174-181
: Clean exports organizationThe export structure is clean and organized, making all queries easily accessible throughout the application.
components/shopify_developer_app/common/mutations.mjs (5)
1-39
: Well-structured CREATE_ORDER mutationThe CREATE_ORDER mutation is comprehensive and well-structured. It properly includes order creation parameters and returns important details such as order ID, tax information, and line items.
41-67
: Comprehensive CREATE_CUSTOMER mutationThe CREATE_CUSTOMER mutation is well-defined with proper input parameters and returns all necessary customer information, including consent data.
69-94
: Well-structured UPDATE_CUSTOMER mutationThe UPDATE_CUSTOMER mutation specifically focuses on updating customer metafields and returns appropriate customer details and potential errors.
96-117
: Comprehensive UPDATE_PRODUCT mutationThe UPDATE_PRODUCT mutation handles product updates with new media. It properly accepts product input and media array, and returns the updated product details with appropriate error handling.
119-124
: Clear and concise exportsThe exports are organized clearly, making all mutations easily accessible throughout the application.
components/shopify_developer_app/actions/get-order/get-order.mjs (4)
1-2
: Good migration from REST to GraphQL APIThe import changes properly shift from using the REST admin API to the GraphQL implementation. The addition of MAX_LIMIT will help with pagination handling in the GraphQL queries.
7-8
: Proper version increment and documentation updateThe version increment from 0.0.2 to 0.0.3 reflects the API change, and the documentation link has been correctly updated to point to the GraphQL query reference.
11-17
: Consistent property name updateThe property has been correctly updated from
app
toshopify
to match the new import, maintaining consistency throughout the component.
20-23
: Successfully refactored API call implementationThe method call has been properly updated to use the GraphQL API with the correct parameter structure, changing from
orderId
toid
and adding pagination control withfirst: MAX_LIMIT
.components/shopify_developer_app/actions/get-pages/get-pages.mjs (4)
1-5
: Well-structured import updatesThe imports have been properly updated to reference the new Shopify app module and common utilities. The addition of the
adjustPropDefinitions
utility indicates a more dynamic approach to handling properties.
6-9
: Effective use of destructuring for improved modularityGood practice using destructuring to extract specific properties from the common module while collecting the rest in
others
. This creates a more flexible and maintainable structure.
11-17
: Enhanced module structure with reusable propertiesThe export structure has been improved by spreading
others
and explicitly including the extracted properties. This approach reduces code duplication and increases maintainability.
18-21
: Properly refactored props objectThe props object has been updated to use the new
shopify
reference and dynamically adjusted properties, creating a more consistent structure across components.components/shopify_developer_app/actions/delete-blog/delete-blog.mjs (2)
1-9
: Well-implemented modular structureThe import updates and use of the
adjustPropDefinitions
utility function create a more modular and maintainable code structure. The destructuring pattern provides clear separation of reused and custom properties.
11-21
: Consistent pattern application across componentsThe exported object follows the same refactoring pattern seen in other components, maintaining consistency throughout the codebase. The version has been properly incremented, and props have been updated to use the new structure.
components/shopify_developer_app/actions/create-page/create-page.mjs (2)
1-9
: DRY approach to component structureThe implementation follows the Don't Repeat Yourself principle by dynamically extracting and processing properties from the common module. The use of
adjustPropDefinitions
creates a consistent pattern across components.
11-21
: Consistent refactoring across the codebaseThe exported object structure matches the pattern used in other components, showing a consistent and comprehensive refactoring approach. Version management has been properly handled with an increment from 0.0.6 to 0.0.7.
components/shopify_developer_app/actions/delete-article/delete-article.mjs (4)
6-9
: Check for missing properties inothers.props
.You destructure
name
,description
, andtype
, then spreadothers.props
. Ifprops
is not defined inothers
, it could cause runtime issues. It’s good practice to verify thatcommon
has the expected shape.
14-14
: Version bump confirmation.Incrementing the version from
0.0.6
to0.0.7
is fine, but please confirm if additional changes elsewhere in the codebase or release notes are also needed to reflect this new version.
16-17
: Destructured properties usage looks good.Spreading
name
,description
, andtype
in the export object helps maintain clarity. This destructuring approach is consistent with the rest of the code and fosters reusability.
1-4
:✅ Verification successful
Validate import paths and references.
The import paths appear correct; however, please ensure that
@pipedream/shopify/actions/delete-article/delete-article.mjs
is the intended updated reference and that all functionalities used from it remain valid after this change.Run this script to confirm the imports in the codebase:
🏁 Script executed:
#!/bin/bash # Description: Verify all references to the updated module are valid rg '@pipedream/shopify/actions/delete-article/delete-article.mjs' -A 3Length of output: 519
Validated Import Paths – No Corrections Needed
- The
rg
output confirms that the updated import reference@pipedream/shopify/actions/delete-article/delete-article.mjs
is correctly used in the file.- All functionalities tied to this module appear valid based on the current code state.
components/shopify_developer_app/actions/search-product-variant/search-product-variant.mjs (2)
2-4
: Confirm updated import references.Ensure that
@pipedream/shopify/actions/search-product-variant/search-product-variant.mjs
provides the expected functionality after this refactor. Also verify that the localadjustPropDefinitions
import is called correctly throughout the code.
14-17
: Version bump and property organization.Bumping the version to
0.0.5
is coherent given the structural changes. Also, placingshopify
upfront followed by spreads ofprops
maintains clarity.Also applies to: 20-20
components/shopify_developer_app/actions/add-tags/add-tags.mjs (2)
2-4
: Check updated module import.
@pipedream/shopify/actions/add-tags/add-tags.mjs
must still provide the required properties and methods. Confirm that no references were removed that this file relies upon.
14-17
: Consistent approach with version and spread.Continuing the pattern of extracting
name
,description
,type
, and version bump to0.0.5
appears consistent with other actions. Looks good overall.Also applies to: 20-20
components/shopify_developer_app/actions/delete-metafield/delete-metafield.mjs (5)
2-3
: Validate new target module.Switching
common
to@pipedream/shopify/actions/delete-metafield/delete-metafield.mjs
is a significant change. Confirm the new module covers all previously used methods to avoid breaking functionality.
10-10
: Spread usage in export object.Spreading
...others
is consistent with the reusability approach taken across the codebase. This should help keep the code DRY.
12-15
: Check version coherence and naming.Version
0.0.6
is in line with the incremental changes. The explicit naming fields also reflect consistent code style.
33-48
: Check dynamic options formetafieldId
.Generating
options
by listing metafields is a neat approach. Ensure that all relevant metafields are returned, and handle potential empty results or failure cases gracefully.Consider adding error handling if
this.listMetafields
can fail or return an unexpected format.
50-50
: Returning the final computed props.The final return statement is succinct, returning the aggregated
props
. This is consistent with the approach used in other similar actions.components/shopify_developer_app/actions/create-article/create-article.mjs (4)
1-4
: Good refactoring of import structureThe transition from direct app imports to the Shopify module pattern and the introduction of the
adjustPropDefinitions
utility function is a good architectural improvement that will make the code more maintainable and centralized.
6-9
: Clean destructuring approachThe destructuring pattern to extract common properties while collecting the rest with
...others
is clean and allows for better flexibility when composing the exported component.
11-18
: Appropriate version increment and metadata handlingThe version increment from 0.0.6 to 0.0.7 properly reflects the changes made. Using the destructured variables for metadata fields (name, description, type) instead of hardcoding them reduces duplication and improves maintainability.
18-21
: Good property management approachThe switch to using the adjusted properties with the new utility function creates a more consistent and maintainable pattern across all Shopify integrations.
components/shopify_developer_app/actions/create-custom-collection/create-custom-collection.mjs (2)
1-9
: Consistent refactoring approachThe refactoring pattern matches the other Shopify components, with proper import restructuring and use of the
adjustPropDefinitions
utility function. This consistency across the codebase is excellent for maintainability.
11-21
: Clean component structure with appropriate versioningThe refactored component structure with version increment from 0.0.4 to 0.0.5 reflects the changes properly. The props pattern with spread operator improves code readability while maintaining functionality.
components/shopify_developer_app/sources/new-order-created/new-order-created.mjs (4)
9-9
: Version increment is appropriateThe version bump from 0.0.8 to 0.0.9 correctly reflects the changes made to this component.
13-15
: Simplification of getTopic methodGood simplification by directly returning the string constant instead of relying on an imported constants module.
16-22
: Property naming convention updateThe change from snake_case (
created_at
) to camelCase (createdAt
) aligns with JavaScript conventions and the GraphQL API response format. Removing the trailing period from the summary string is also a good cleanup.
27-31
: GraphQL API implementationThe update to use
listOrders
with GraphQL-style destructuring (accessingnodes
from the response) is a good implementation of the GraphQL API migration. The pagination parameters are appropriately set for the initial data fetch.components/shopify_developer_app/actions/search-custom-collection-by-name/search-custom-collection-by-name.mjs (2)
1-9
: Consistent import and utility function usageThe refactoring follows the same pattern as other components, using the proper import path for the common module and introducing the
adjustPropDefinitions
utility function. This consistency is excellent for maintainability.
11-21
: Clean component structure with appropriate versioningThe export structure with version increment from 0.0.4 to 0.0.5 properly reflects the changes. Using destructured variables for metadata and the adjusted props pattern improves code organization.
components/shopify_developer_app/actions/update-metafield/update-metafield.mjs (5)
2-3
: Check for possible circular import
By importingupdate-metafield/update-metafield.mjs
from within the same-named file in a different location, there's a risk of confusion or circular referencing. Please verify or rename to avoid overshadowing.
5-7
: Good approach for selective destructuring
Extractingname, description, type
and spreading...others
fosters clarity and maintainability.
10-10
: Refined object exports
Spreading...others
while explicitly specifyingversion
,name
,description
, andtype
is consistent with the new approach. Exposingshopify
as a top-level prop clarifies usage.Also applies to: 12-15, 17-17
51-55
: Verify consistent usage for 'draftOrder'
The new 'draftOrder' field is introduced. Ensure it's properly handled in all references to 'draftOrder', especially on the resource keys.Would you like me to run a search script to confirm matching references for 'draftOrder'?
60-60
: Check handling for 'variants'
Confirm thatownerResource === "variants"
is the correct string used throughout the codebase. There's a potential mismatch if 'variant' or a different naming was used.components/shopify_developer_app/actions/update-inventory-level/update-inventory-level.mjs (3)
2-2
: Updated imports
Switching from a more genericcommon.mjs
to a specializedupdate-inventory-level.mjs
for shared logic is a good step toward file clarity, but please confirm there's no overshadowing of local vs. external reference.Also applies to: 4-4
6-9
: Great usage of 'adjustPropDefinitions'
Dynamically adjusting prop definitions promotes consistency and reduces code duplication.
12-12
: Incremented version & refined exporting
Applyingversion: "0.0.5"
while destructuringname
,description
, andtype
aligns with the new approach.Also applies to: 14-17
components/shopify_developer_app/actions/search-customers/search-customers.mjs (2)
6-7
: Updated description & version
The new doc link and version "0.0.5" are consistent with the ongoing enhancements.
12-15
: Added 'query' prop
Specifyingtype
,label
, anddescription
improves clarity for end users.components/shopify_developer_app/actions/common/metafield-actions.mjs (3)
2-4
: Consolidated constants and utilities
Importingconstants
,utils
, andMAX_LIMIT
from specified modules centralizes key references for easier maintenance.
158-166
: Reusable 'getMetafields' function
A direct approach for retrieving metafields from the specified resource function.
234-244
: 'getMetafieldIdByKey' method
Filtering by key and namespace is straightforward. Ensure no performance bottlenecks for large metafield sets.components/shopify_developer_app/actions/create-metaobject/create-metaobject.mjs (3)
6-9
: Good use of destructuring.Extracting key fields like
name
,description
, andtype
followed by the spread of...others
keeps the code readable and minimizes clutter.
20-20
: Props spreading looks good.Including
...props
within theprops
object properly merges dynamic properties adjusted byadjustPropDefinitions
. This maintains a flexible configuration for metaobjects.
2-4
:✅ Verification successful
Validate the new imports.
The updated import paths and the addition of
adjustPropDefinitions
look correct and consistent with the new refactoring approach. Ensure that thecommon
module exports all the required entities and thatadjustPropDefinitions
is properly tested to handle any malformed or missing property definitions.
🏁 Script executed:
#!/bin/bash # Verify that `adjustPropDefinitions` is exported where expected rg --context 3 'export function adjustPropDefinitions'Length of output: 1313
Imports Verified and Function Export Confirmed
The updated import paths and the addition of
adjustPropDefinitions
are correctly implemented. The shell script verification confirms thatadjustPropDefinitions
is properly exported in the expected module (components/shopify_developer_app/common/utils.mjs
). Please make sure that tests adequately cover scenarios for malformed or missing property definitions.components/shopify_developer_app/actions/create-order/create-order.mjs (2)
7-8
: Document your version increment.You have changed the version to
"0.0.5"
and updated the description. Be sure to document this change in your release notes or migration guide if relevant.
2-2
:✅ Verification successful
Check for potential duplication.
Importing
utils
from@pipedream/shopify/common/utils.mjs
is fine; just confirm there are no duplicate imports or overshadowed symbols from../../shopify_developer_app.app.mjs
orutils.mjs
in the same directory.
🏁 Script executed:
#!/bin/bash # Description: Verify there is no other place overshadowing `utils` import rg --context 5 'import .*utils'Length of output: 65921
Verification Complete – No Duplicate Imports Detected
The search results confirmed that in the codebase there isn’t any duplicate or overshadowing import related to the
utils
module in the context of the Shopify developer app. In particular:
- Components/Actions Context: In
components/shopify_developer_app/actions/create-order/create-order.mjs
, the unique import ofutils
from@pipedream/shopify/common/utils.mjs
stands alone.- No Conflicts Found: There are no other imports from
../../shopify_developer_app.app.mjs
or any localutils.mjs
that would conflict or override the symbol in the same directory.components/shopify_developer_app/actions/get-metafields/get-metafields.mjs (3)
5-7
: Version and destructuring approach.
- Updating the version to
"0.0.6"
is consistent with the typical incremental patch.- The destructured
name
,description
, andtype
keep the export object concise and maintain the original metadata fromcommon
.Also applies to: 11-11
16-29
: Good addition of optional filters and summary.Defining
namespace
andkey
for metafield filtering provides flexibility. The newrun
method properly filters based on these arrays and exports a clear summary of how many metafields were found. This is aligned with best practices for user feedback.Also applies to: 34-36, 38-38, 40-42, 44-46, 48-49
2-3
:❓ Verification inconclusive
Double-check for circular imports.
The new import references
@pipedream/shopify/actions/get-metafields/get-metafields.mjs
. Confirm that there is no cyclical dependency between this file and thecommon
usage within the same folder structure.
🏁 Script executed:
#!/bin/bash # Attempt to identify circular references rg --context 3 'import .*get-metafields/get-metafields.mjs'Length of output: 651
Action Required: Verify Self-Import Mapping for Circular Dependency
The grep results confirm that the file
components/shopify_developer_app/actions/get-metafields/get-metafields.mjs
includes an import that appears to reference itself via the alias:
import common from "@pipedream/shopify/actions/get-metafields/get-metafields.mjs";
Please double-check the module resolution settings to ensure that this alias isn’t inadvertently causing a circular dependency issue at runtime. If the self-import is intentional (for example, to access common functionality), consider whether extracting that functionality into a separate module might simplify the dependency graph and reduce potential side effects.
components/shopify_developer_app/actions/create-smart-collection/create-smart-collection.mjs (3)
6-9
: Good use of destructuring to enhance readability.The destructuring pattern to extract specific properties while collecting the rest is clean and effective.
12-17
: Version increment and destructured properties are appropriately implemented.The version has been properly incremented, and using the destructured properties from
common
instead of hardcoding them improves maintainability.
19-21
: Props structure is now more modular and reusable.Using the adjusted properties creates better reusability and consistency across components.
components/shopify_developer_app/actions/add-product-to-custom-collection/add-product-to-custom-collection.mjs (4)
2-4
: Consistent import pattern across components.The imports follow the same pattern as other components, which is good for consistency.
6-9
: Consistent destructuring pattern.This follows the same pattern used in other components, creating consistency across the codebase.
12-14
: Version update and code structure are appropriate.The version has been properly incremented, and the spread of
others
is consistent with the pattern used elsewhere.
19-20
: Props structure maintains consistency with other components.The props structure uses the adjusted properties, which aligns with the pattern in other components.
components/shopify_developer_app/actions/create-blog/create-blog.mjs (4)
1-4
: Import structure follows the updated pattern.The import of
shopify
directly and the updated path for the common module follows the pattern used in other components.
6-9
: Destructuring pattern is consistent.The destructuring of
common
follows the same pattern used in other files.
12-17
: Version increment and property references are appropriate.The version has been incremented from 0.0.6 to 0.0.7, and the destructured properties are used properly.
19-20
: Props structure updates maintain consistency.The update to use
shopify
instead of what was likelyapp
before, along with the spread of adjusted props, is consistent with other components.components/shopify_developer_app/actions/delete-page/delete-page.mjs (4)
1-4
: Import pattern is consistent with other refactored files.The imports follow the same pattern seen in other refactored components.
6-9
: Destructuring follows the established pattern.The destructuring of
common
is consistent with the approach used throughout the refactored files.
12-17
: Version increment and property references are appropriate.The version number has been properly incremented from 0.0.6 to 0.0.7, and the properties are referenced from the destructured variables.
19-20
: Props structure is consistent with the refactoring approach.The props now reference
shopify
and use the adjusted properties, which aligns with the approach in other components.components/shopify_developer_app/actions/create-product/create-product.mjs (4)
2-4
: LGTM: Good update to imports and path structureThe import changes are aligned with the broader refactoring pattern of the Shopify Developer App, consolidating the module paths for better maintainability. The import of
adjustPropDefinitions
utility adds modularity to the code.
6-9
: Effective use of destructuring to improve code organizationThe destructuring approach here is clean and enables reuse of common components while maintaining the specific customizations needed for this implementation.
12-17
: Proper version increment and component metadata handlingThe version increment from 0.0.4 to 0.0.5 is appropriate for feature enhancements. Using the destructured properties from common provides consistency across components.
19-20
: Simplified props structure using utility functionThe new approach using
adjustPropDefinitions
centralizes property configuration, which is more maintainable than the previous hardcoded approach for individual properties.components/shopify_developer_app/actions/get-articles/get-articles.mjs (4)
1-4
: LGTM: Consistent import structure aligns with other componentsThe import changes follow the same pattern used across other Shopify components, creating consistency in the codebase. The
adjustPropDefinitions
utility import shows good code reuse.
6-9
: Effective property extraction patternThis consistent pattern of destructuring the common object and dynamically adjusting props improves maintainability across the Shopify components.
12-17
: Appropriate version increment and metadata handlingThe version increment from 0.0.6 to 0.0.7 is appropriate for this update. Using the destructured properties from common ensures consistency with the parent implementation.
19-20
: Simplified props configurationReplacing hardcoded properties with the result of
adjustPropDefinitions
improves maintainability and consistency with the parent implementation.components/shopify_developer_app/actions/create-metafield/create-metafield.mjs (5)
2-5
: LGTM: Well-structured imports with necessary dependenciesThe import structure provides good separation of concerns, importing the app, common functionality, and constants separately.
6-8
: Good use of destructuring for code clarityDestructuring the common object makes it clear which properties are being directly used and which are being spread into the component.
11-16
: Appropriate version increment and property usageThe version increment from 0.0.5 to 0.0.6 is consistent with the feature updates. The use of destructured properties maintains alignment with the parent implementation.
23-26
:❓ Verification inconclusive
Verify resource type case conversion
The code converts the resource type values to uppercase using
type.value.toUpperCase()
. Ensure this matches the expected format for the Shopify API. If the API expects a specific case format, this conversion could cause issues.
🏁 Script executed:
#!/bin/bash # Check if the resource types are consistently handled across the codebase # and match Shopify API expectations # Check how resource types are used in API calls echo "Checking how resource types are used in API calls:" rg -A 5 -B 5 "ownerResource.*toUpperCase\(\)" components/shopify_developer_app/ # Look for any existing API calls that use resource types echo "Looking for existing API calls with resource types:" rg -A 10 "createMetafield.*resource" components/shopify_developer_app/Length of output: 378
Action Required: Confirm Uppercase Format for Resource Types
The code incomponents/shopify_developer_app/actions/create-metafield/create-metafield.mjs
(lines 23–26) transforms the resource type values to uppercase. Although our initial repository searches didn't reveal any conflicting usages or explicit API calls that might contradict this format, it's important to manually verify that this conversion aligns with the Shopify API’s expected case. Please cross-check the API documentation to ensure that the uppercase format is acceptable.
18-55
:✅ Verification successful
Well-documented property definitions with comprehensive metadata
The expanded property definitions provide excellent documentation with clear labels and descriptions for each field. The use of constants for options is a good practice that promotes maintainability.
One potential concern: There is both a
type
property coming from the destructured common object (line 7) and atype
property defined in the props (lines 43-48). Verify that this doesn't cause any naming conflicts or unintended behavior.
🏁 Script executed:
#!/bin/bash # Check if there are any issues with the duplicate 'type' property # Look for any references to 'this.type' in the codebase that might be affected # First, check for references to this.type in metafield-related files echo "Checking for references to this.type in metafield files:" rg "this\.type" components/shopify_developer_app/actions/ -A 2 -B 2 # Check how the parent component handles the type property echo "Checking how the parent component handles type property:" cat components/shopify/actions/create-metafield/create-metafield.mjs | grep -A 10 -B 10 "type[: ]"Length of output: 2806
Naming Conflict Verified – No Action Required
After running the verification scripts, it’s clear that the top-level
type
property (with a constant value"action"
) and thetype
property defined in theprops
(which represents the metafield’s data type) are being used in clearly distinct contexts. The runtime behavior observed in therun
method shows thatthis.type
correctly refers to the prop (i.e. the metafield type) rather than the static action type. There is no evidence of any unintended naming conflicts.components/shopify_developer_app/shopify_developer_app.app.mjs (4)
1-5
: Imports look consistent and necessary for GraphQL requests.
No issues spotted here. The addition of these files for queries, mutations, and the API version pointer seems appropriate.
13-42
: Verify error handling for dynamic options.
listOrders
andlistCustomers
are used to populate the options fororderId
andcustomerId
. Consider adding handling or fallbacks for cases where the listings might fail or return empty results.Would you like to verify all references to
this.listOrders
andthis.listCustomers
across the codebase to ensure calls are properly caught and handled?
116-116
: API version usage approved.
IncludingapiVersion: API_VERSION
ensures consistent requests to the Shopify GraphQL API.
119-145
:❓ Verification inconclusive
Ensure robust error handling and test coverage for new methods.
All these new methods delegate directly to_makeGraphQlRequest
; consider adding logging or retry logic for potential upstream API failures. Also confirm that each method is covered by relevant unit or integration tests.Run the following script to locate references to these new methods and confirm they’re properly exercised in test code:
🏁 Script executed:
#!/bin/bash rg -A 3 'getOrder\(' rg -A 3 'getDraftOrder\(' rg -A 3 'getCustomer\(' rg -A 3 'listOrders\(' rg -A 3 'listDraftOrders\(' rg -A 3 'listCustomers\(' rg -A 3 'createOrder\(' rg -A 3 'createCustomer\(' rg -A 3 'updateCustomer\('Length of output: 65907
Action Required: Enhance Error Handling and Validate Test Coverage
After verifying the method usage across the repository, it’s clear that the new GraphQL methods in
components/shopify_developer_app/shopify_developer_app.app.mjs
(lines 119–145) are consistently delegating to_makeGraphQlRequest
and are referenced throughout various action files. However, the current implementations lack any built-in mechanisms for handling API failures. Please:
Implement Robust Error Handling:
Consider adding logging and retry logic either within these methods or in the underlying_makeGraphQlRequest
to gracefully handle upstream API failures.Confirm Comprehensive Test Coverage:
Ensure that both the happy-path scenarios and the failure cases for these new methods are covered by unit or integration tests.
components/shopify_developer_app/actions/common/metafield-actions.mjs
Outdated
Show resolved
Hide resolved
components/shopify_developer_app/actions/create-order/create-order.mjs
Outdated
Show resolved
Hide resolved
components/shopify_developer_app/actions/create-order/create-order.mjs
Outdated
Show resolved
Hide resolved
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: 0
♻️ Duplicate comments (1)
components/shopify_developer_app/actions/create-order/create-order.mjs (1)
157-158
:⚠️ Potential issueVerify the
response.orderCreate.orderid
field.Shopify typically returns
response.orderCreate.order.id
. The current reference toorderid
could be invalid, causing the exported summary to displayundefined
.Proposed fix:
- $.export("$summary", `Created new order with ID \`${response.orderCreate.orderid}\``); + $.export("$summary", `Created new order with ID \`${response.orderCreate.order.id}\``);
🧹 Nitpick comments (4)
components/shopify_developer_app/actions/common/metafield-actions.mjs (3)
167-233
: Consider refactoring the repetitive if blocks to improve maintainability.The current implementation uses a series of if statements for different resource types. Consider using a mapping object or switch statement to make this more maintainable and concise.
- async listMetafields(ownerResource, ownerId) { - const variables = { - id: ownerId, - first: MAX_LIMIT, - }; - let resourceFn, resourceKeys; - if (ownerResource === "product") { - resourceFn = this.shopify.getProduct; - resourceKeys = [ - "product", - ]; - } - if (ownerResource === "variants") { - resourceFn = this.shopify.getProductVariant; - resourceKeys = [ - "productVariant", - ]; - } - // ... more if statements + async listMetafields(ownerResource, ownerId) { + const variables = { + id: ownerId, + first: MAX_LIMIT, + }; + + const resourceMap = { + product: { + resourceFn: this.shopify.getProduct, + resourceKeys: ["product"], + }, + variants: { + resourceFn: this.shopify.getProductVariant, + resourceKeys: ["productVariant"], + }, + collection: { + resourceFn: this.shopify.getCollection, + resourceKeys: ["collection"], + }, + blog: { + resourceFn: this.shopify.getBlog, + resourceKeys: ["blog"], + }, + article: { + resourceFn: this.shopify.getArticle, + resourceKeys: ["article"], + }, + page: { + resourceFn: this.shopify.getPage, + resourceKeys: ["page"], + }, + customer: { + resourceFn: this.shopify.getCustomer, + resourceKeys: ["customer"], + }, + draftOrder: { + resourceFn: this.shopify.getDraftOrder, + resourceKeys: ["draftOrder"], + }, + order: { + resourceFn: this.shopify.getOrder, + resourceKeys: ["order"], + }, + }; + + const { resourceFn, resourceKeys } = resourceMap[ownerResource] || {}; + if (!resourceFn) { + throw new Error(`Unsupported owner resource: ${ownerResource}`); + }
234-244
: Consider consistent return types for better type safety.The method returns either an ID or false. Consider returning null, undefined, or throwing an error instead of false for more consistent typing.
async getMetafieldIdByKey(key, namespace, ownerId, ownerResource) { const results = await this.listMetafields(ownerResource, ownerId); const metafield = results?.filter( (field) => field.key === key && field.namespace === namespace, ); if (!metafield || metafield.length === 0) { - return false; + return null; // or undefined for more consistent typing } return metafield[0].id; },
245-269
: Potential null reference issue with metafieldsArray.If
utils.parseJson(metafieldsOriginal)
returns null or undefined, you could face issues with the for loop. Consider adding additional validation.async createMetafieldsArray(metafieldsOriginal, ownerId, ownerResource) { if (!metafieldsOriginal) { - return; + return []; // Return empty array for consistent return type } const metafields = []; const metafieldsArray = utils.parseJson(metafieldsOriginal); + if (!Array.isArray(metafieldsArray)) { + throw new Error("Metafields must be a valid JSON array"); + } for (const meta of metafieldsArray) { // rest of the codecomponents/shopify_developer_app/actions/create-order/create-order.mjs (1)
12-16
: Clarify or refactor mixed usage ofstring[]
vsobject
.Each of these props (
lineItems
,taxLines
,shippingLines
) is documented as an array of objects but typed asstring[]
—and then parsed manually viaparseJson()
. This may cause confusion, since the UI or user might expect an array of objects without needing to pass JSON strings. Consider switching toobject[]
or clearly documenting that JSON strings are required.Also applies to: 80-85, 118-123
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
components/shopify_developer_app/actions/common/metafield-actions.mjs
(1 hunks)components/shopify_developer_app/actions/create-order/create-order.mjs
(1 hunks)components/shopify_developer_app/common/queries.mjs
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- components/shopify_developer_app/common/queries.mjs
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: pnpm publish
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
🔇 Additional comments (5)
components/shopify_developer_app/actions/common/metafield-actions.mjs (4)
1-5
: LGTM! Clean import structure.The import structure is clean and well-organized, properly separating app-specific imports from common utilities.
9-15
: Good property definition with clear documentation.The ownerResource property is well-defined with appropriate type, label, description, and reloadProps functionality to refresh the UI when changed.
113-127
: LGTM! The draftOrder resources are correctly configured.The draftOrder configuration looks good with proper resource keys. This appears to fix the previous issue with "draftrders" that was identified in an earlier review.
145-157
:❓ Verification inconclusive
Potential dependency issue with conditional props.
The code has special handling for 'variants' and 'article' resources, but relies on the order of operations. Consider adding validation to ensure required props are available or restructuring to make dependencies clearer.
🏁 Script executed:
#!/bin/bash # Check if there are any other components that use this file and how they handle these dependencies # Look for imports of this file rg -l "metafield-actions.mjs" --type js # Check for components that use ownerResource="variants" or ownerResource="article" rg "ownerResource.*[\"']variants[\"']|ownerResource.*[\"']article[\"']" --type jsLength of output: 131
Action Required: Verify Dependency Handling in Conditional Props
The current implementation in
components/shopify_developer_app/actions/common/metafield-actions.mjs
is relying on sequential conditional assignments for handling special cases (variants
andarticle
). Although the automated search did not reveal additional consumers of these specific conditional props, potential issues remain if the expected properties (likeproductId
forvariants
andblogId
forarticle
) are ever missing or mis-assigned.
- Validate that required props are always provided: Ensure that when
ownerResource
is"variants"
, the correspondingproductId
is available (and similarly for"article"
withblogId
).- Consider refactoring for clarity: Restructure or add explicit validations to avoid any dependency on the ordering of operations.
Please manually verify across the codebase that no external components erroneously depend on the implicit order of prop assignments.
components/shopify_developer_app/actions/create-order/create-order.mjs (1)
50-55
: Fulfillment prop mismatch resolved from previous review.Thank you for correcting the previous mismatch (
fulfillments
→fulfillment
). This now aligns with the prop definition.Also applies to: 144-144
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
components/shopify_developer_app/actions/create-order/create-order.mjs (2)
23-28
: Shipping address documentation could be more specific.The description references "billing_address" when it should reference "shipping_address" in the documentation link.
- description: "The mailing address to where the order will be shipped. More details when searching **billing_address** in [Shopify Order Object](https://shopify.dev/docs/api/admin-graphql/latest/objects/order)", + description: "The mailing address to where the order will be shipped. More details when searching **shipping_address** in [Shopify Order Object](https://shopify.dev/docs/api/admin-graphql/latest/objects/order)",
131-159
: Missing error handling for API calls.The
run
method doesn't include any explicit error handling for the API call. Consider adding try-catch blocks to provide meaningful error messages when the API request fails.async run({ $ }) { + try { const response = await this.shopify.createOrder({ options: { sendReceipt: this.sendReceipt, sendFulfillmentReceipt: this.sendFulfillmentReceipt, inventoryBehaviour: this.inventoryBehavior, }, order: { // existing order properties }, }); $.export("$summary", `Created new order with ID \`${response.orderCreate.order.id}\``); return response; + } catch (error) { + $.export("error", error); + throw `Failed to create Shopify order: ${error.message}`; + } },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
components/shopify_developer_app/actions/create-order/create-order.mjs
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: pnpm publish
- GitHub Check: Publish TypeScript components
- GitHub Check: Lint Code Base
- GitHub Check: Verify TypeScript components
🔇 Additional comments (10)
components/shopify_developer_app/actions/create-order/create-order.mjs (10)
2-2
: Import path changed to use Shopify common utilities.The import path has been updated to use utilities from the Shopify common module. This is a good practice for reusing code across the Shopify integration.
7-8
: Version bump and improved documentation.The version has been properly incremented and the description now links to the relevant Shopify GraphQL documentation, which will help users understand the action's capabilities.
12-16
: Well-defined line items property with examples.The lineItems property definition includes helpful example JSON that will guide users on the expected format.
17-22
: Billing address URL typo fixed.The billing address documentation URL has been corrected from the previous version which had a typo ("hhttps" is now "https").
29-43
: Comprehensive financial status options.The financial status property provides all possible order statuses, making it clear what values are acceptable.
44-49
: Helpful discount code example provided.The discount code property includes a clear example of the expected JSON format, which will help users implement discounts correctly.
50-55
: Property name fixed from previous feedback.The property is now correctly named "fulfillment" (singular) which matches how it's used in the run method, resolving the previous review comment.
56-67
: Fulfillment status includes NULL option.Good to include the "NULL" option explicitly in the fulfillment status options, as this makes it clear that an order can have no fulfillment status.
98-117
: Clear labels for inventory behavior options.The inventory behavior options include descriptive labels that explain the technical values, which improves usability.
157-158
: Fixed order ID reference in summary message.The summary message now correctly references
response.orderCreate.order.id
instead of the previously incorrectresponse.orderCreate.orderid
.
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.
Hi @michelle0927 I've just had a question there other than that lgtm! Ready for QA!
dedupe: "unique", | ||
methods: { | ||
...common.methods, | ||
getTopic() { | ||
return constants.EVENT_TOPIC.ORDERS_CANCELLED; | ||
return "ORDERS_CANCELLED"; |
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.
Just wondering if you tested this. Isn't this just a key in EVENT_TOPIC
object as a constant?
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.
The graphQL API expects the topic names to be in all caps.
Resolves #15914
Summary by CodeRabbit
New Features
Improvements