feat: order export and upload stream (#14243)

* feat: order export

* Merge branch 'develop' of https://github.com/medusajs/medusa into feat/order-export

* normalize status

* rm util

* serialize totals

* test

* lock

* comments

* configurable order list
This commit is contained in:
Carlos R. L. Rodrigues
2025-12-14 08:02:53 -03:00
committed by GitHub
parent e199f1eb01
commit 9366c6d468
31 changed files with 1041 additions and 37 deletions

View File

@@ -638,7 +638,7 @@ export class Order {
* This method updates an order change. It sends a request to the
* [Update Order Change](https://docs.medusajs.com/api/admin#order-changes_postorder-changesid)
* API route.
*
*
* @since 2.12.0
*
* @param id - The order change's ID.
@@ -674,4 +674,36 @@ export class Order {
}
)
}
/**
* This method starts an order export process to retrieve a CSV of exported orders.
*
* You'll receive in the response the transaction ID of the workflow generating the CSV file.
* To check the status of the execution, send a `GET` request to
* `/admin/workflows-executions/export-orders/:transaction-id`.
*
* Once the execution finishes successfully, a notification is created for the export.
* You can retrieve the notifications using the `/admin/notification` API route to
* retrieve the file's download URL.
*
* @param query - Filters to specify which orders to export.
* @param headers - Headers to pass in the request.
* @returns The export's details.
*
* @example
* sdk.admin.order.export({})
* .then(({ transaction_id }) => {
* console.log(transaction_id)
* })
*/
async export(query?: HttpTypes.AdminOrderFilters, headers?: ClientHeaders) {
return await this.client.fetch<HttpTypes.AdminExportOrderResponse>(
`/admin/orders/export`,
{
method: "POST",
headers,
query,
}
)
}
}