-
Notifications
You must be signed in to change notification settings - Fork 5.7k
[21034] add MCP-optimized actions for Returnista #21111
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
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
cb1e69c
feat(returnista): add MCP-optimized actions for returns and order man…
vetrivigneshwaran 99c5642
Merge branch 'master' into mcp/returnista
vetrivigneshwaran 3fdf937
new component addition and removal of newly added component for list
vetrivigneshwaran 7db648b
Merge branch 'master' into mcp/returnista
vetrivigneshwaran ccbaea5
version update
vetrivigneshwaran 47418ab
coderabbit review comment addressed
vetrivigneshwaran 2a895ef
Merge branch 'master' into mcp/returnista
vetrivigneshwaran 8c4aa49
Merge branch 'master' into mcp/returnista
vetrivigneshwaran cb53347
fix for the coderabbbit comment
vetrivigneshwaran f3129dc
Merge branch 'master' into mcp/returnista
vetrivigneshwaran bb42fa3
fix for the code review
vetrivigneshwaran 8b98920
Merge branch 'master' into mcp/returnista
vetrivigneshwaran 65c1376
Updating already existing async options for the existing props
vetrivigneshwaran 5b1bd36
Update components/returnista/returnista.app.mjs
michelle0927 6644ea6
Update components/returnista/returnista.app.mjs
michelle0927 fee94bf
Update components/returnista/returnista.app.mjs
michelle0927 53ec92e
coderabbit suggestion
michelle0927 2b23bbe
Merge branch 'master' into mcp/returnista
vetrivigneshwaran a76acde
update the version
vetrivigneshwaran a7883a7
Change in the description
vetrivigneshwaran 28ed987
changes with respect to mcp
vetrivigneshwaran 2041a92
Update in the version
vetrivigneshwaran 86c938a
Update in the description
vetrivigneshwaran 353b9ca
Merge branch 'master' into mcp/returnista
vetrivigneshwaran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
105 changes: 105 additions & 0 deletions
105
components/returnista/actions/create-draft-return-order/create-draft-return-order.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
| import returnista from "../../returnista.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "returnista-create-draft-return-order", | ||
| name: "Create Draft Return Order", | ||
| description: "Creates a new draft return order for a consumer." | ||
| + " Draft return orders are pending merchant review before being accepted or rejected." | ||
| + " Use **Process Draft Return Order** to accept or reject the created draft." | ||
| + " [See the documentation](https://platform.returnista.com/reference/rest-api/#post-/consumer/-consumerId-/draft-return-order)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| props: { | ||
| returnista, | ||
| consumerId: { | ||
| propDefinition: [ | ||
| returnista, | ||
| "consumerId", | ||
| ], | ||
| }, | ||
| purchaseId: { | ||
| propDefinition: [ | ||
| returnista, | ||
| "purchaseId", | ||
| ], | ||
| }, | ||
| returnReasonId: { | ||
| propDefinition: [ | ||
| returnista, | ||
| "returnReasonId", | ||
| ], | ||
| }, | ||
| returnReasonComment: { | ||
| propDefinition: [ | ||
| returnista, | ||
| "returnReasonComment", | ||
| ], | ||
| }, | ||
| resolutionType: { | ||
| propDefinition: [ | ||
| returnista, | ||
| "resolutionType", | ||
| ], | ||
| }, | ||
| exchangeProductId: { | ||
| propDefinition: [ | ||
| returnista, | ||
| "exchangeProductId", | ||
| ], | ||
| }, | ||
| exchangeOptionSku: { | ||
| propDefinition: [ | ||
| returnista, | ||
| "exchangeOptionSku", | ||
| ], | ||
| }, | ||
| answers: { | ||
| propDefinition: [ | ||
| returnista, | ||
| "answers", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const answers = Array.isArray(this.answers) | ||
| ? this.answers.map((a, index) => { | ||
| try { | ||
| return JSON.parse(a); | ||
| } catch { | ||
| throw new ConfigurationError(`answers[${index}] must be valid JSON: ${a}`); | ||
| } | ||
| }) | ||
| : undefined; | ||
| const response = await this.returnista.createDraftReturnOrder({ | ||
| $, | ||
| consumerId: this.consumerId, | ||
| data: { | ||
| selectedPurchases: [ | ||
| { | ||
| purchaseId: this.purchaseId, | ||
| returnReasonId: this.returnReasonId || null, | ||
| returnReasonComment: this.returnReasonComment, | ||
| resolutionType: this.resolutionType, | ||
| answers, | ||
| exchangeProductId: this.exchangeProductId, | ||
| exchangeOptionSku: this.exchangeOptionSku, | ||
| }, | ||
| ], | ||
| }, | ||
| }); | ||
| const createdDraftId = response?.id ?? response?.data?.id; | ||
| $.export( | ||
| "$summary", | ||
| createdDraftId | ||
| ? `Successfully created draft return order ${createdDraftId}` | ||
| : `Successfully created draft return order for consumer ${this.consumerId}`, | ||
| ); | ||
| return response; | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.