Skip to content

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Oct 13, 2025

Resolves #6258

Summary by CodeRabbit

  • New Features

    • Add actions to create Sales Orders, Purchase Orders, Stock Adjustments, and Stock Transfers.
    • Add actions to retrieve Sales Orders, Purchase Orders, and Stock On Hand.
    • Support dynamic line items with per-line product, quantity, and price inputs.
    • Enable optional warehouse selection, exchange rate, tax handling, and comments.
    • Add actions to update Sales Orders and Purchase Orders (status, warehouse, exchange rate, comments).
  • Chores

    • Bump component version to 0.1.0.

Copy link

vercel bot commented Oct 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Oct 13, 2025 5:07pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Oct 13, 2025 5:07pm

Copy link
Contributor

coderabbitai bot commented Oct 13, 2025

Walkthrough

Adds Unleashed Software app client with signed HTTP methods, propDefinitions, and list/get/create/update operations. Introduces actions to create/update/get Sales Orders and Purchase Orders, get Stock On Hand, and create Stock Adjustments and Stock Transfers. Updates package.json with version bump and dependency.

Changes

Cohort / File(s) Summary of Changes
App client and prop definitions
components/unleashed_software/unleashed_software.app.mjs
Implements signed request client, query builder, CRUD helpers (sales/purchase orders, stock ops), stock queries, and public propDefinitions. Removes prior authKeys. Adds axios (from @pipedream/platform) and crypto usage.
Order creation actions
components/unleashed_software/actions/create-sales-order/create-sales-order.mjs, components/unleashed_software/actions/create-purchase-order/create-purchase-order.mjs
New actions to create Sales and Purchase Orders with dynamic line item props, tax rate retrieval, line totals aggregation, and API invocation.
Order update actions
components/unleashed_software/actions/update-sales-order/update-sales-order.mjs, components/unleashed_software/actions/update-purchase-order/update-purchase-order.mjs
New actions to update existing orders: fetch current order, resolve tax rate, apply optional overrides (status, warehouse, exchange rate, comments), and submit updates.
Order retrieval actions
components/unleashed_software/actions/get-sales-order/get-sales-order.mjs, components/unleashed_software/actions/get-purchase-order/get-purchase-order.mjs
New actions to fetch Sales/Purchase Orders by ID and export success summaries.
Inventory actions
components/unleashed_software/actions/get-stock-on-hand/get-stock-on-hand.mjs, components/unleashed_software/actions/create-stock-adjustment/create-stock-adjustment.mjs, components/unleashed_software/actions/create-stock-transfer/create-stock-transfer.mjs
New actions to get stock on hand, create stock adjustments, and create stock transfers with typed props and structured payloads.
Package manifest
components/unleashed_software/package.json
Bumps version to 0.1.0 and adds dependency on @pipedream/platform ^3.1.0.

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant Action as Create Order Action
  participant App as Unleashed App Client
  participant API as Unleashed API

  User->>Action: Provide inputs (customer/supplier, lines, tax code, etc.)
  Action->>App: getTaxRateFromCode(taxCode)
  App->>API: GET /Tax (signed)
  API-->>App: Tax rate
  Action->>Action: Build lines, compute Subtotal/Tax/Total
  Action->>App: createSalesOrder / createPurchaseOrder(data)
  App->>API: POST /SalesOrders or /PurchaseOrders (signed)
  API-->>App: Created order
  App-->>Action: Response
  Action-->>User: Summary + response
Loading
sequenceDiagram
  actor User
  participant Action as Update Order Action
  participant App as Unleashed App Client
  participant API as Unleashed API

  User->>Action: Provide orderId and optional overrides
  Action->>App: getSalesOrder / getPurchaseOrder(orderId)
  App->>API: GET /...Orders/{id} (signed)
  API-->>App: Order details
  Action->>App: getTaxRateFromCode(order.TaxCode)
  App->>API: GET /Tax (signed)
  API-->>App: Tax rate
  Action->>App: updateSalesOrder / updatePurchaseOrder(orderId, data)
  App->>API: PUT /...Orders/{id} (signed)
  API-->>App: Updated order
  Action-->>User: Summary + response
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Suggested reviewers

  • lcaresia
  • GTFalcao

Poem

A hop, a bop, I sign each call,
Orders rise and never stall.
Stocks adjust, then transfer gleams,
Carrots count in balanced streams. 🥕
With paws on keys and ears held high,
I ship these flows—inventory fly!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description only contains “Resolves #6258” and lacks the required “## WHY” section or any details from the repository’s template, leaving critical context and motivation unprovided. Please complete the description using the repository’s template, including a “## WHY” section that explains the motivation for adding Unleashed Inventory support and outlines the changes made to implement it.
Title Check ❓ Inconclusive The title “Unleashed - new components” is overly generic and does not clearly convey the main change, which is adding a full Unleashed Inventory app integration with specific actions and triggers for sales orders, purchase orders, stock adjustments, stock transfers, and stock-on-hand. Please revise the title to succinctly summarize the primary change, for example “Unleashed Inventory: add app integration with actions for sales/purchase orders, stock adjustments, transfers, and stock-on-hand.”
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues Check ✅ Passed This pull request fully implements the objectives of issue #6258 by adding authentication handling in the Unleashed app client and providing actions for sales orders (POST/PUT/GET), purchase orders (POST/PUT/GET), get stock on hand, stock adjustments, and stock transfers.
Out of Scope Changes Check ✅ Passed All modifications in this pull request relate directly to the Unleashed Inventory app integration and its required actions, triggers, and client updates, with no unrelated or extraneous changes detected.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-6258

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (6)
components/unleashed_software/actions/get-stock-on-hand/get-stock-on-hand.mjs (1)

23-34: Consider exposing pagination control to users.

The underlying getStockOnHand method supports pagination, but this action always uses the default page (1). If stock on hand results for a product can span multiple pages, users have no way to access subsequent pages.

Consider adding a page prop to allow users to retrieve additional pages:

     productId: {
       propDefinition: [
         unleashedSoftware,
         "productId",
       ],
     },
+    page: {
+      type: "integer",
+      label: "Page",
+      description: "Page number for pagination (default: 1)",
+      optional: true,
+      default: 1,
+    },
   },
   async run({ $ }) {
     const response = await this.unleashedSoftware.getStockOnHand({
       $,
+      page: this.page,
       params: {
         productId: this.productId,
       },
     });
components/unleashed_software/actions/create-stock-adjustment/create-stock-adjustment.mjs (1)

49-72: Document the single-product limitation or consider supporting multiple products.

The implementation only supports adjusting a single product per operation, as StockAdjustmentLines contains a hardcoded array with one element. If the Unleashed API supports adjusting multiple products in a single request, consider enhancing this action to accept multiple product adjustments.

If you'd like to support multiple products, you could restructure the props to accept an array of product adjustments. Alternatively, if this is intentional, add a note in the description clarifying that only one product can be adjusted per action execution.

components/unleashed_software/unleashed_software.app.mjs (1)

190-197: Consider optimizing tax rate lookup if the API supports it.

The current implementation fetches all taxes to find a matching tax code. While acceptable for small tax lists, this could be optimized if the Unleashed API provides a direct endpoint for looking up a specific tax code.

If optimization is needed and the API supports it, consider adding a direct lookup method. Otherwise, the current implementation is acceptable.

components/unleashed_software/actions/update-sales-order/update-sales-order.mjs (1)

72-72: Consider handling undefined comments to avoid clearing existing values.

The Comments field is always included in the update payload, even when this.comments is undefined. This might unintentionally clear existing comments on the sales order.

Consider conditionally including comments only when provided:

         Warehouse: {
           Guid: this.warehouseId || salesOrder.Warehouse.Guid,
         },
-        Comments: this.comments,
+        ...(this.comments !== undefined && { Comments: this.comments }),
         SubTotal: salesOrder.SubTotal,

Alternatively, if clearing comments when not provided is the intended behavior, document this in the action description.

components/unleashed_software/actions/create-stock-transfer/create-stock-transfer.mjs (2)

16-27: Consider adding explicit labels to distinguish source and destination warehouses.

Both sourceWarehouseId and destinationWarehouseId use the same propDefinition, which will display the same label ("Warehouse ID") in the UI. While the property keys will help differentiate them, adding explicit label overrides would improve clarity.

Apply this diff to add explicit labels:

     sourceWarehouseId: {
+      label: "Source Warehouse",
       propDefinition: [
         unleashedSoftware,
         "warehouseId",
       ],
     },
     destinationWarehouseId: {
+      label: "Destination Warehouse",
       propDefinition: [
         unleashedSoftware,
         "warehouseId",
       ],
     },

40-64: Document the single-product limitation or consider supporting multiple products.

The implementation only supports transferring a single product per operation. If the Unleashed API supports transferring multiple products in one request, consider enhancing this action. Otherwise, document in the description that only one product can be transferred per execution.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7f84b6d and 9158967.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • components/unleashed_software/actions/create-purchase-order/create-purchase-order.mjs (1 hunks)
  • components/unleashed_software/actions/create-sales-order/create-sales-order.mjs (1 hunks)
  • components/unleashed_software/actions/create-stock-adjustment/create-stock-adjustment.mjs (1 hunks)
  • components/unleashed_software/actions/create-stock-transfer/create-stock-transfer.mjs (1 hunks)
  • components/unleashed_software/actions/get-purchase-order/get-purchase-order.mjs (1 hunks)
  • components/unleashed_software/actions/get-sales-order/get-sales-order.mjs (1 hunks)
  • components/unleashed_software/actions/get-stock-on-hand/get-stock-on-hand.mjs (1 hunks)
  • components/unleashed_software/actions/update-purchase-order/update-purchase-order.mjs (1 hunks)
  • components/unleashed_software/actions/update-sales-order/update-sales-order.mjs (1 hunks)
  • components/unleashed_software/package.json (2 hunks)
  • components/unleashed_software/unleashed_software.app.mjs (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (10)
components/unleashed_software/actions/update-purchase-order/update-purchase-order.mjs (3)
components/unleashed_software/actions/create-purchase-order/create-purchase-order.mjs (2)
  • taxRate (96-99)
  • response (117-138)
components/unleashed_software/actions/update-sales-order/update-sales-order.mjs (2)
  • taxRate (56-59)
  • response (61-81)
components/unleashed_software/actions/get-purchase-order/get-purchase-order.mjs (1)
  • response (24-27)
components/unleashed_software/actions/get-sales-order/get-sales-order.mjs (1)
components/unleashed_software/actions/get-purchase-order/get-purchase-order.mjs (1)
  • response (24-27)
components/unleashed_software/actions/get-purchase-order/get-purchase-order.mjs (1)
components/unleashed_software/actions/get-sales-order/get-sales-order.mjs (1)
  • response (24-27)
components/unleashed_software/unleashed_software.app.mjs (2)
components/unleashed_software/actions/create-purchase-order/create-purchase-order.mjs (1)
  • products (71-73)
components/unleashed_software/actions/create-sales-order/create-sales-order.mjs (1)
  • products (69-71)
components/unleashed_software/actions/create-stock-transfer/create-stock-transfer.mjs (3)
components/unleashed_software/actions/create-purchase-order/create-purchase-order.mjs (1)
  • response (117-138)
components/unleashed_software/actions/create-sales-order/create-sales-order.mjs (1)
  • response (115-136)
components/unleashed_software/actions/create-stock-adjustment/create-stock-adjustment.mjs (1)
  • response (50-67)
components/unleashed_software/actions/create-sales-order/create-sales-order.mjs (2)
components/unleashed_software/actions/create-purchase-order/create-purchase-order.mjs (9)
  • i (66-66)
  • i (101-101)
  • products (71-73)
  • lineItems (94-94)
  • subtotal (95-95)
  • taxRate (96-99)
  • lineTotal (102-102)
  • lineTax (103-103)
  • response (117-138)
components/unleashed_software/unleashed_software.app.mjs (1)
  • products (77-79)
components/unleashed_software/actions/get-stock-on-hand/get-stock-on-hand.mjs (2)
components/unleashed_software/actions/get-purchase-order/get-purchase-order.mjs (1)
  • response (24-27)
components/unleashed_software/actions/get-sales-order/get-sales-order.mjs (1)
  • response (24-27)
components/unleashed_software/actions/create-purchase-order/create-purchase-order.mjs (2)
components/unleashed_software/actions/create-sales-order/create-sales-order.mjs (10)
  • props (60-60)
  • i (64-64)
  • i (99-99)
  • products (69-71)
  • lineItems (92-92)
  • subtotal (93-93)
  • taxRate (94-97)
  • lineTotal (100-100)
  • lineTax (101-101)
  • response (115-136)
components/unleashed_software/unleashed_software.app.mjs (1)
  • products (77-79)
components/unleashed_software/actions/create-stock-adjustment/create-stock-adjustment.mjs (3)
components/unleashed_software/actions/create-purchase-order/create-purchase-order.mjs (1)
  • response (117-138)
components/unleashed_software/actions/create-sales-order/create-sales-order.mjs (1)
  • response (115-136)
components/unleashed_software/actions/create-stock-transfer/create-stock-transfer.mjs (1)
  • response (41-59)
components/unleashed_software/actions/update-sales-order/update-sales-order.mjs (3)
components/unleashed_software/actions/create-sales-order/create-sales-order.mjs (2)
  • taxRate (94-97)
  • response (115-136)
components/unleashed_software/actions/update-purchase-order/update-purchase-order.mjs (2)
  • taxRate (61-64)
  • response (66-89)
components/unleashed_software/actions/get-sales-order/get-sales-order.mjs (1)
  • response (24-27)
⏰ 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)
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (10)
components/unleashed_software/actions/get-stock-on-hand/get-stock-on-hand.mjs (1)

1-22: LGTM!

The action metadata and props are well-structured. The use of propDefinitions for productId ensures consistent UX across actions.

components/unleashed_software/actions/create-stock-adjustment/create-stock-adjustment.mjs (1)

26-48: LGTM!

Props are appropriately defined using propDefinitions for resource selectors.

components/unleashed_software/unleashed_software.app.mjs (5)

1-3: LGTM!

Appropriate imports for API client functionality and request signing.


7-152: LGTM!

PropDefinitions are well-structured with consistent pagination patterns and clear value/label mappings. This provides a good foundation for dynamic resource selection across actions.


154-172: LGTM!

Authentication signature implementation correctly uses HMAC-SHA256 with the API key. Query string building follows standard URLSearchParams patterns.


173-189: LGTM!

The request builder properly constructs authenticated requests with signed headers. The authentication flow matches the Unleashed API requirements.


198-323: LGTM!

API methods follow a consistent and clean pattern. Proper use of HTTP verbs (GET for reads, POST for creates, PUT for updates) and parameter handling throughout.

components/unleashed_software/actions/update-sales-order/update-sales-order.mjs (1)

1-49: LGTM!

Action metadata and props are well-defined. The optional nature of update fields allows for flexible partial updates.

components/unleashed_software/actions/create-stock-transfer/create-stock-transfer.mjs (2)

1-13: LGTM!

Action metadata and annotations are appropriate for a stock transfer creation operation.


40-64: Implementation looks correct for single-product transfers.

The stock transfer logic properly maps the source/destination warehouses and product details to the API payload structure.

Copy link
Collaborator

@luancazarine luancazarine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @michelle0927, LGTM! Ready for QA!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[APP] [ACTIONS] UNLEASHED INVENTORY app, New UNLEASHED INVENTORY actions

2 participants