Skip to content

Conversation

@jcortes
Copy link
Collaborator

@jcortes jcortes commented Dec 3, 2025

WHY

Resolves #7478

Summary by CodeRabbit

  • New Features

    • Create, retrieve, update, and delete invoices and sales orders in NetSuite
    • List and search invoices and sales orders with streaming pagination
    • Dynamic selection fields for customers, subsidiaries, invoices, and sales orders
    • Built-in JSON parsing for item/additional fields and configurable validation/replacement options
  • Chores

    • NetSuite component version bumped to 0.1.0

✏️ Tip: You can customize this high-level summary in your review settings.

@jcortes jcortes self-assigned this Dec 3, 2025
@vercel
Copy link

vercel bot commented Dec 3, 2025

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

2 Skipped Deployments
Project Deployment Review Updated (UTC)
pipedream-docs Ignored Ignored Dec 18, 2025 10:11pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Dec 18, 2025 10:11pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 3, 2025

Walkthrough

Adds a full NetSuite integration: app-level REST client and CRUD helpers for invoices and sales orders, ten new action modules (create/get/list/update/delete), utilities for safe JSON parsing, validation constants, pagination support, and expanded propDefinitions for dynamic UI selection.

Changes

Cohort / File(s) Summary
Action Modules - Invoice Operations
components/netsuite/actions/create-invoice/create-invoice.mjs, components/netsuite/actions/delete-invoice/delete-invoice.mjs, components/netsuite/actions/get-invoice/get-invoice.mjs, components/netsuite/actions/list-invoices/list-invoices.mjs, components/netsuite/actions/update-invoice/update-invoice.mjs
New action definitions for invoice CRUD and listing. Create/update build JSON payloads (conditionally include subsidiary, items, additionalFields), set property validation headers, support replace semantics; get/delete use invoiceId; list paginates via app.paginate and supports search query/maxResults.
Action Modules - Sales Order Operations
components/netsuite/actions/create-sales-order/create-sales-order.mjs, components/netsuite/actions/delete-sales-order/delete-sales-order.mjs, components/netsuite/actions/get-sales-order/get-sales-order.mjs, components/netsuite/actions/list-sales-orders/list-sales-orders.mjs, components/netsuite/actions/update-sales-order/update-sales-order.mjs
New action definitions for sales order CRUD and listing. Create/update assemble request bodies with optional fields and JSON-parsed items/additionalFields, include validation headers and replace options; get/delete use salesOrderId; list uses pagination with optional query and maxResults.
App Module
components/netsuite/netsuite.app.mjs
Adds REST client helpers (getUrl, _headers, _makeRequest), CRUD methods for invoices and sales orders (list/get/create/update/delete), listSubsidiaries/listCustomers, an async paginate generator, and extensive propDefinitions (salesOrderId, invoiceId, subsidiaryId, customerId, searchQuery, items, validation options, replace, etc.).
Common Utilities & Constants
components/netsuite/common/utils.mjs, components/netsuite/common/constants.mjs
Adds parseJson(input, maxDepth) utility to safely parse JSON-like strings with depth and circular-reference protection; adds VALIDATION_OPTIONS constants: ERROR, WARNING, IGNORE.
Package Metadata
components/netsuite/package.json
Bumps package version from 0.0.1 to 0.1.0.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

  • Review focus areas:
    • components/netsuite/netsuite.app.mjs: REST request construction, auth/header handling, pagination generator correctness, and async prop option implementations.
    • Action modules: correct prop wiring, conditional payload assembly, consistent use of utils.parseJson, and header/query param usage for replace/validation.
    • components/netsuite/common/utils.mjs: parseJson recursion, maxDepth and circular reference handling.
    • Cross-file consistency for naming/field shapes between app methods and actions.

Suggested reviewers

  • lcaresia
  • GTFalcao

Pre-merge checks and finishing touches

❌ Failed checks (2 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title '[ACTIONS] Netsuite - new components' is vague and uses overly generic phrasing; it lacks specificity about what was actually implemented. Provide a more specific title that clearly describes the main additions, e.g., 'Add Netsuite CRUD actions for invoices and sales orders' or 'Implement Netsuite REST API integration with action modules'.
Description check ❓ Inconclusive The pull request description only includes 'Resolves #7478' without explaining the changes or implementation details required by the repository's template. Expand the description to fill the WHY section with context about why these Netsuite components are needed and what problem they solve for users.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR implements comprehensive Netsuite integration with CRUD actions and REST API support, satisfying the primary objective to add Netsuite application support as specified in issue #7478.
Out of Scope Changes check ✅ Passed All changes directly support the Netsuite integration objective: action modules for invoices and sales orders, app configuration, utilities for JSON parsing, and version bump are all within scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 netsuite-new-components

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.

@jcortes jcortes force-pushed the netsuite-new-components branch from 80e4f15 to a4e6ce2 Compare December 3, 2025 22:38
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: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
components/netsuite/package.json (1)

3-15: Add trailing newline to fix eslint eol-last failure

Version bump to 0.1.0 looks appropriate, and the minimal manifest avoids unnecessary dependencies (consistent with not adding Node built-ins as deps, based on learnings). The remaining issue is the eslint error about a missing newline at end of file.

Add a trailing newline after the closing brace to satisfy eol-last and unblock the checks:

-  }
-}
+  }
+}
+
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6512c92 and a4e6ce2.

📒 Files selected for processing (14)
  • components/netsuite/actions/create-invoice/create-invoice.mjs (1 hunks)
  • components/netsuite/actions/create-sales-order/create-sales-order.mjs (1 hunks)
  • components/netsuite/actions/delete-invoice/delete-invoice.mjs (1 hunks)
  • components/netsuite/actions/delete-sales-order/delete-sales-order.mjs (1 hunks)
  • components/netsuite/actions/get-invoice/get-invoice.mjs (1 hunks)
  • components/netsuite/actions/get-sales-order/get-sales-order.mjs (1 hunks)
  • components/netsuite/actions/list-invoices/list-invoices.mjs (1 hunks)
  • components/netsuite/actions/list-sales-orders/list-sales-orders.mjs (1 hunks)
  • components/netsuite/actions/update-invoice/update-invoice.mjs (1 hunks)
  • components/netsuite/actions/update-sales-order/update-sales-order.mjs (1 hunks)
  • components/netsuite/common/constants.mjs (1 hunks)
  • components/netsuite/common/utils.mjs (1 hunks)
  • components/netsuite/netsuite.app.mjs (1 hunks)
  • components/netsuite/package.json (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2024-10-30T15:24:39.294Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 14467
File: components/gainsight_px/actions/create-account/create-account.mjs:4-6
Timestamp: 2024-10-30T15:24:39.294Z
Learning: In `components/gainsight_px/actions/create-account/create-account.mjs`, the action name should be "Create Account" instead of "Create Memory".

Applied to files:

  • components/netsuite/actions/create-sales-order/create-sales-order.mjs
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 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.

Applied to files:

  • components/netsuite/netsuite.app.mjs
📚 Learning: 2025-06-04T17:52:05.780Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 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.

Applied to files:

  • components/netsuite/netsuite.app.mjs
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
Repo: PipedreamHQ/pipedream PR: 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.

Applied to files:

  • components/netsuite/package.json
🧬 Code graph analysis (5)
components/netsuite/actions/list-sales-orders/list-sales-orders.mjs (2)
components/netsuite/actions/list-invoices/list-invoices.mjs (2)
  • items (40-40)
  • paginator (41-50)
components/netsuite/netsuite.app.mjs (1)
  • items (303-303)
components/netsuite/actions/get-invoice/get-invoice.mjs (8)
components/netsuite/actions/create-invoice/create-invoice.mjs (1)
  • response (119-147)
components/netsuite/actions/create-sales-order/create-sales-order.mjs (1)
  • response (95-123)
components/netsuite/actions/delete-invoice/delete-invoice.mjs (1)
  • response (30-33)
components/netsuite/actions/delete-sales-order/delete-sales-order.mjs (1)
  • response (30-33)
components/netsuite/actions/get-sales-order/get-sales-order.mjs (1)
  • response (51-59)
components/netsuite/actions/update-invoice/update-invoice.mjs (1)
  • response (135-167)
components/netsuite/actions/update-sales-order/update-sales-order.mjs (1)
  • response (110-142)
components/netsuite/netsuite.app.mjs (1)
  • response (294-301)
components/netsuite/actions/update-sales-order/update-sales-order.mjs (3)
components/netsuite/actions/create-sales-order/create-sales-order.mjs (1)
  • response (95-123)
components/netsuite/actions/update-invoice/update-invoice.mjs (1)
  • response (135-167)
components/netsuite/netsuite.app.mjs (2)
  • response (294-301)
  • items (303-303)
components/netsuite/actions/delete-sales-order/delete-sales-order.mjs (1)
components/netsuite/actions/delete-invoice/delete-invoice.mjs (1)
  • response (30-33)
components/netsuite/actions/create-invoice/create-invoice.mjs (4)
components/netsuite/actions/create-sales-order/create-sales-order.mjs (1)
  • response (95-123)
components/netsuite/actions/update-invoice/update-invoice.mjs (1)
  • response (135-167)
components/netsuite/actions/update-sales-order/update-sales-order.mjs (1)
  • response (110-142)
components/netsuite/netsuite.app.mjs (2)
  • response (294-301)
  • items (303-303)
🪛 GitHub Actions: Pull Request Checks
components/netsuite/package.json

[error] 15-15: eslint: Newline required at end of file but not found. (eol-last) during 'pnpm exec eslint ...'

⏰ 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). (1)
  • GitHub Check: pnpm publish
🔇 Additional comments (8)
components/netsuite/common/constants.mjs (1)

1-7: Validation constants look good

The VALIDATION_OPTIONS map is clear and aligns well with how the actions configure validation behavior. No changes needed here.

components/netsuite/actions/delete-sales-order/delete-sales-order.mjs (1)

1-37: Delete Sales Order action is consistent and straightforward

The action wiring (props, annotations, and run implementation) is consistent with the existing delete-invoice pattern and correctly delegates to app.deleteSalesOrder, emitting a clear summary.

No issues from a correctness or API-shape standpoint.

components/netsuite/actions/get-invoice/get-invoice.mjs (1)

1-64: Get Invoice action matches established pattern

Props, annotations, and the run delegation to app.getInvoice (including optional params and summary) are consistent with the corresponding get-sales-order action and look correct.

No changes needed here.

components/netsuite/actions/update-invoice/update-invoice.mjs (1)

1-172: Update Invoice action wiring and payload construction look correct

The props schema, validation headers, query params (replace, replaceSelectedFields), and conditional assembly of the data payload (entity, subsidiary, items, memo, otherRefNum, additionalFields) are all consistent with the related create/update actions and NetSuite expectations.

The only caveat is that this action relies on utils.parseJson for items and additionalFields; once the depth/cycle handling in that utility is corrected (see comment in components/netsuite/common/utils.mjs), this action should behave as intended.

components/netsuite/actions/create-sales-order/create-sales-order.mjs (1)

1-128: Create Sales Order action is well-structured and consistent

The action metadata, prop definitions, and run implementation align with the create-invoice pattern and correctly delegate to app.createSalesOrder with validation headers and a properly assembled payload (including parsed items and additionalFields).

The name "Create Sales Order" correctly reflects the behavior, which is good alignment with prior feedback on action naming. Aside from the shared parseJson utility concerns already noted, this action looks solid.

components/netsuite/actions/list-invoices/list-invoices.mjs (1)

1-61: List Invoices action correctly leverages pagination helper

The action uses app.paginate in the same way as the list-sales-orders action, with appropriate conditional search params and a clear summary message. The for await accumulation into items and return value are straightforward and correct.

No changes needed here.

components/netsuite/actions/create-invoice/create-invoice.mjs (1)

104-147: Create‑invoice action wiring looks correct and consistent

The createInvoice call uses the same flattened options shape as createSalesOrder / updateInvoice, so $, validation headers, replace, and the payload (including parsed items and additionalFields) will be forwarded correctly to _makeRequest. This action is structurally sound once the shared app helpers are fixed.

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

110-141: The review comment identifies a critical issue regarding argument handling in the updateSalesOrder call, but this cannot be verified without access to the netsuite.app.mjs implementation. The claim that headers, params, and data are being ignored requires examining the actual function signature and how it processes the opts parameter. Manual code inspection of the app file is necessary to confirm whether the suggested nested opts structure or an app-level fix is required.

luancazarine
luancazarine previously approved these changes Dec 18, 2025
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 @jcortes, I just added a small suggestion, but I'll move it to Ready for QA anyway

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.

Netsuite

3 participants