-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - amazon_selling_partner #17562
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 update introduces a comprehensive Amazon Selling Partner integration, including a fully implemented app client, multiple actions for order, inventory, pricing, and report management, and two polling-based event sources for new orders and inbound shipments. Supporting modules and configuration updates enable robust API interaction and event-driven workflows. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AmazonSellingPartnerApp
participant AmazonAPI
User->>AmazonSellingPartnerApp: Trigger action (e.g., Fetch Orders)
AmazonSellingPartnerApp->>AmazonAPI: Make authenticated API request
AmazonAPI-->>AmazonSellingPartnerApp: Return data (orders, inventory, etc.)
AmazonSellingPartnerApp-->>User: Return processed results
Note over AmazonSellingPartnerApp,AmazonAPI: For sources, polling is performed periodically, and new events are emitted when new data is detected.
Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
components/amazon_selling_partner/actions/retrieve-sales-performance-reports/retrieve-sales-performance-reports.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
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: 6
🧹 Nitpick comments (2)
components/amazon_selling_partner/actions/check-fba-inventory-levels/check-fba-inventory-levels.mjs (1)
29-34: Consider adding validation for SKU limitThe description mentions "up to 50 SKUs" but there's no validation to enforce this Amazon API constraint.
Consider adding validation:
sellerSkus: { type: "string[]", label: "Seller SKUs", description: "A list of seller SKUs for which to return inventory summaries. You may specify up to 50 SKUs.", optional: true, + max: 50, },components/amazon_selling_partner/actions/retrieve-sales-performance-reports/retrieve-sales-performance-reports.mjs (1)
96-96: Improve summary message specificity.The summary message is generic. Consider making it more informative based on the retrieved data or parameters used.
Consider a more specific summary:
- $.export("$summary", "Fetched sales performance reports"); + $.export("$summary", `Fetched sales performance reports for ${this.granularity} granularity`);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (12)
components/amazon_selling_partner/actions/check-fba-inventory-levels/check-fba-inventory-levels.mjs(1 hunks)components/amazon_selling_partner/actions/fetch-orders-by-date-range/fetch-orders-by-date-range.mjs(1 hunks)components/amazon_selling_partner/actions/generate-sales-inventory-reports/generate-sales-inventory-reports.mjs(1 hunks)components/amazon_selling_partner/actions/get-order-details/get-order-details.mjs(1 hunks)components/amazon_selling_partner/actions/list-inbound-shipments/list-inbound-shipments.mjs(1 hunks)components/amazon_selling_partner/actions/optimize-product-pricing/optimize-product-pricing.mjs(1 hunks)components/amazon_selling_partner/actions/retrieve-sales-performance-reports/retrieve-sales-performance-reports.mjs(1 hunks)components/amazon_selling_partner/amazon_selling_partner.app.mjs(1 hunks)components/amazon_selling_partner/package.json(2 hunks)components/amazon_selling_partner/sources/common/base.mjs(1 hunks)components/amazon_selling_partner/sources/new-inbound-shipment-to-fba-created/new-inbound-shipment-to-fba-created.mjs(1 hunks)components/amazon_selling_partner/sources/new-order-created/new-order-created.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (11)
components/amazon_selling_partner/package.json (1)
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.
components/amazon_selling_partner/actions/fetch-orders-by-date-range/fetch-orders-by-date-range.mjs (2)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
components/amazon_selling_partner/actions/check-fba-inventory-levels/check-fba-inventory-levels.mjs (2)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
components/amazon_selling_partner/actions/retrieve-sales-performance-reports/retrieve-sales-performance-reports.mjs (2)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
components/amazon_selling_partner/actions/optimize-product-pricing/optimize-product-pricing.mjs (2)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
components/amazon_selling_partner/actions/generate-sales-inventory-reports/generate-sales-inventory-reports.mjs (2)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
components/amazon_selling_partner/sources/common/base.mjs (1)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common.mjs:97-98
Timestamp: 2024-07-24T02:05:59.531Z
Learning: The `processTimerEvent` method in the `components/salesforce_rest_api/sources/common.mjs` file is intentionally left unimplemented to enforce that subclasses must implement this method, similar to an abstract class in object-oriented programming.
components/amazon_selling_partner/sources/new-inbound-shipment-to-fba-created/new-inbound-shipment-to-fba-created.mjs (4)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#14265
File: components/the_magic_drip/sources/common.mjs:35-43
Timestamp: 2024-10-10T19:18:27.998Z
Learning: In `components/the_magic_drip/sources/common.mjs`, when processing items in `getAndProcessData`, `savedIds` is intentionally updated with IDs of both emitted and non-emitted items to avoid emitting retroactive events upon first deployment and ensure only new events are emitted as they occur.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#15376
File: components/monday/sources/name-updated/name-updated.mjs:6-6
Timestamp: 2025-01-23T03:55:15.166Z
Learning: Source names in Monday.com components don't need to start with "New" if they emit events for updated items (e.g., "Name Updated", "Column Value Updated") rather than new items. This follows the component guidelines exception where the "New" prefix is only required when emits are limited to new items.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-10-08T15:33:38.240Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
components/amazon_selling_partner/sources/new-order-created/new-order-created.mjs (4)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#15376
File: components/monday/sources/name-updated/name-updated.mjs:6-6
Timestamp: 2025-01-23T03:55:15.166Z
Learning: Source names in Monday.com components don't need to start with "New" if they emit events for updated items (e.g., "Name Updated", "Column Value Updated") rather than new items. This follows the component guidelines exception where the "New" prefix is only required when emits are limited to new items.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#14265
File: components/the_magic_drip/sources/common.mjs:35-43
Timestamp: 2024-10-10T19:18:27.998Z
Learning: In `components/the_magic_drip/sources/common.mjs`, when processing items in `getAndProcessData`, `savedIds` is intentionally updated with IDs of both emitted and non-emitted items to avoid emitting retroactive events upon first deployment and ensure only new events are emitted as they occur.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-10-08T15:33:38.240Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.
components/amazon_selling_partner/actions/get-order-details/get-order-details.mjs (2)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12731
File: components/hackerone/actions/get-members/get-members.mjs:3-28
Timestamp: 2024-07-04T18:11:59.822Z
Learning: When exporting a summary message in the `run` method of an action, ensure the message is correctly formatted. For example, in the `hackerone-get-members` action, the correct format is `Successfully retrieved ${response.data.length} members`.
components/amazon_selling_partner/amazon_selling_partner.app.mjs (2)
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: In the Salesloft API integration (components/salesloft/salesloft.app.mjs), the _makeRequest method returns response.data which directly contains arrays for list endpoints like listPeople, listCadences, listUsers, and listAccounts. The propDefinitions correctly call .map() directly on these responses without needing to destructure a nested data property.
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#16954
File: components/salesloft/salesloft.app.mjs:14-23
Timestamp: 2025-06-04T17:52:05.780Z
Learning: The Salesloft API list endpoints (listPeople, listCadences, listUsers, listAccounts) return arrays directly in the response body, not wrapped in a metadata object with a nested data property. The _makeRequest method correctly returns response.data which contains the arrays that can be mapped over directly in propDefinitions.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Lint Code Base
- GitHub Check: pnpm publish
- GitHub Check: Verify TypeScript components
- GitHub Check: Publish TypeScript components
🔇 Additional comments (17)
components/amazon_selling_partner/package.json (2)
3-3: LGTM: Version bump appropriate for new functionalityThe version increment from 0.0.1 to 0.1.0 is appropriate given the comprehensive Amazon Selling Partner integration being added.
15-17: LGTM: Legitimate dependency additionThe
@pipedream/platformdependency is correctly added and required for the new actions and sources in this integration.components/amazon_selling_partner/actions/get-order-details/get-order-details.mjs (2)
17-25: LGTM: Proper prop dependency configurationThe
amazonOrderIdprop correctly depends onmarketplaceIdfor dynamic validation or selection, which is the expected pattern for Amazon Selling Partner API integration.
27-34: LGTM: Correct API call and summary exportThe
getOrdermethod call and summary export format follow the expected patterns based on the learnings about proper summary message formatting.components/amazon_selling_partner/actions/fetch-orders-by-date-range/fetch-orders-by-date-range.mjs (1)
47-62: LGTM: Correct API call and summary formattingThe
listOrdersmethod call with proper parameter mapping and summary export format follow the expected patterns.components/amazon_selling_partner/actions/list-inbound-shipments/list-inbound-shipments.mjs (1)
36-53: LGTM: Correct pagination and parameter handlingThe use of
getPaginatedResourceswith proper resource key and the array joining forShipmentStatusListparameter are implemented correctly. The summary export format is also appropriate.components/amazon_selling_partner/actions/check-fba-inventory-levels/check-fba-inventory-levels.mjs (1)
36-54: LGTM: Correct API call and summary formattingThe
getInventorySummariesmethod call with proper parameter mapping and the summary export with correct singular/plural handling are implemented correctly.components/amazon_selling_partner/sources/common/base.mjs (1)
1-29: LGTM! Well-structured base module.The base module provides a solid foundation for Amazon Selling Partner sources with appropriate defaults and shared functionality. The timestamp management methods follow expected patterns for polling sources.
components/amazon_selling_partner/actions/optimize-product-pricing/optimize-product-pricing.mjs (2)
47-49: LGTM! Correct conditional parameter mapping.The conditional logic correctly maps the values array to either "Asins" or "Skus" parameter based on the itemType, and properly formats the array as a comma-separated string.
53-55: Good conditional summary export.The conditional summary export based on the presence of product data is a good practice, ensuring the summary is only shown when relevant data is retrieved.
components/amazon_selling_partner/actions/generate-sales-inventory-reports/generate-sales-inventory-reports.mjs (2)
50-65: LGTM! Correct pagination and parameter handling.The pagination implementation using
getPaginatedResourcesis correct, with proper parameter formatting (arrays to comma-separated strings) and the appropriatehasPayload: falsesetting.
66-68: Good summary message with proper pluralization.The summary message correctly handles pluralization and provides meaningful information about the number of reports retrieved.
components/amazon_selling_partner/sources/new-order-created/new-order-created.mjs (2)
13-19: LGTM! Proper metadata generation.The
generateMetamethod correctly creates event metadata with a unique ID, descriptive summary, and proper timestamp parsing from the order's purchase date.
21-47: LGTM! Correct timestamp management and event emission.The implementation properly:
- Retrieves the last processed timestamp
- Fetches new orders using pagination
- Tracks the maximum timestamp from processed orders
- Emits events with generated metadata
- Updates the stored timestamp
The logic handles edge cases correctly (empty results, timestamp comparison).
components/amazon_selling_partner/sources/new-inbound-shipment-to-fba-created/new-inbound-shipment-to-fba-created.mjs (1)
1-11: Component setup looks good!The source component is properly configured with appropriate naming conventions, documentation link, and dedupe strategy.
components/amazon_selling_partner/amazon_selling_partner.app.mjs (2)
131-166: Well-designed pagination implementation!The async generator pattern efficiently handles large datasets, and the dual token support (NextToken/nextToken) properly handles API inconsistencies.
76-76: Verify OAuth token expiration handlingI didn’t find any refresh-token logic in
components/amazon_selling_partner/amazon_selling_partner.app.mjs—only:
- Line 76:
"x-amz-access-token": this.$auth.oauth_access_tokenBy contrast, other components (Trello, SmugMug, Google Calendar) reference
this.$auth.oauth_refresh_token.• Please confirm whether Pipedream’s platform automatically refreshes tokens for the Amazon Selling Partner API.
• If not, implement refresh logic—e.g. includerefresh_token: this.$auth.oauth_refresh_tokenin your auth config and renew the access token before making requests.
...nts/amazon_selling_partner/actions/fetch-orders-by-date-range/fetch-orders-by-date-range.mjs
Show resolved
Hide resolved
...ng_partner/actions/retrieve-sales-performance-reports/retrieve-sales-performance-reports.mjs
Show resolved
Hide resolved
..._partner/sources/new-inbound-shipment-to-fba-created/new-inbound-shipment-to-fba-created.mjs
Show resolved
Hide resolved
..._partner/sources/new-inbound-shipment-to-fba-created/new-inbound-shipment-to-fba-created.mjs
Show resolved
Hide resolved
GTFalcao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's one issue in the code to be fixed; since it doesn't impact functionality I'll move the issue forward
| if (payload?.NextToken) { | ||
| params.NextToken = payload.NextToken; | ||
| hasMore = true; | ||
| } |
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.
This block of code seems duplicated
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.
It looks duplicated, but it's not. :) Some endpoints use NextToken (capitalized), and some use nextToken (not capitalized), so I wanted to allow for either one.
hasMore = false;
if (payload?.NextToken) {
params.NextToken = payload.NextToken;
hasMore = true;
}
if (payload?.nextToken) {
params.nextToken = payload.nextToken;
hasMore = true;
}
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.
Ah I see the casing difference now that you pointed it out - makes sense!
|
/approve |
Resolves #15955
Summary by CodeRabbit
New Features
Chores