Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Nov 19, 2025

Resolves #17834

Summary by CodeRabbit

  • New Features

    • Added four new actions: Get Order, Get Product, List Orders, and List Products.
    • Added four new event sources: New Order Created, New Product Created, Order Updated, and Product Updated.
    • Event sources support automatic pagination, timestamp-based emission, and configurable polling.
  • Chores

    • Component version bumped to 0.1.0.
    • Added platform dependency and dynamic UI option support for order/product selection.

@vercel
Copy link

vercel bot commented Nov 19, 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 Nov 19, 2025 7:28pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Nov 19, 2025 7:28pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 2025

Walkthrough

Adds an upgrade_chat component: new actions for getting/listing orders and products, polling sources (new/updated orders and products) built on a reusable polling base, API client and pagination helpers in the app file, and a package version bump with a new dependency.

Changes

Cohort / File(s) Summary
Actions
components/upgrade_chat/actions/get-order/get-order.mjs, components/upgrade_chat/actions/get-product/get-product.mjs, components/upgrade_chat/actions/list-orders/list-orders.mjs, components/upgrade_chat/actions/list-products/list-products.mjs
Four new action modules. Each exports a default action object (metadata, annotations, props referencing upgradeChat and relevant propDefinitions) and a run({ $ }) that calls the corresponding this.upgradeChat method, sets $summary, and returns the API response.
Polling Sources — Base
components/upgrade_chat/sources/common/base.mjs
New reusable polling source object providing timer config, _getLastTs/_setLastTs persistence, abstract hooks (getResourceFn, getSummary, getParams, getTsField), generateMeta, processEvent(max), run(), and a hooks.deploy that primes with up to 10 items.
Polling Sources — Specific
components/upgrade_chat/sources/new-order-created/new-order-created.mjs, components/upgrade_chat/sources/new-product-created/new-product-created.mjs, components/upgrade_chat/sources/order-updated/order-updated.mjs, components/upgrade_chat/sources/product-updated/product-updated.mjs
Four new source modules that spread the common base and implement source-specific methods: getResourceFn() (returns listOrders or listProducts), getSummary(...) (formats summary), and getTsField() where needed (returns "updated" for updated sources). Exports include metadata and dedupe: "unique".
API Integration / App
components/upgrade_chat/upgrade_chat.app.mjs
Adds propDefinitions (orderUuid, productUuid, limit, offset), HTTP helpers (_baseUrl, _makeRequest), API methods (getOrder, getProduct, listOrders, listProducts), and an async generator paginate({ fn, params, max }) for paginated iteration.
Package Configuration
components/upgrade_chat/package.json
Bumped version from 0.0.1 to 0.1.0 and added dependency @pipedream/platform: ^3.1.1.

Sequence Diagram(s)

sequenceDiagram
    participant Timer as Timer/Deploy
    participant Source as Source (new/updated)
    participant Base as Base Source
    participant App as upgrade_chat.app
    participant DB as DB (lastTs)
    participant API as upgrade.chat API

    Timer->>Source: run() (timer or deploy)
    Source->>Base: processEvent(max?)
    Base->>DB: _getLastTs()
    DB-->>Base: lastTs
    Base->>Source: getResourceFn() -> App.listOrders/listProducts
    Source->>App: listOrders/listProducts(params)
    App->>API: paginated HTTP requests via _makeRequest
    API-->>App: items page
    App-->>Base: items iterator (paginate)
    rect rgb(220, 255, 220)
      Base->>Base: filter items with item[tsField] > lastTs
      Base->>Base: generateMeta(item) (id, summary)
      Base->>Timer: emit event(item, meta)
    end
    Base->>DB: _setLastTs(maxTimestamp)
    DB-->>Base: ack
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Pay attention to:
    • paginate implementation and offset/limit/max handling in upgrade_chat.app.mjs
    • Timestamp comparison, initial run behavior, and persistence in sources/common/base.mjs
    • Correct wiring of propDefinition entries (orderUuid, productUuid, limit, offset) in the app and actions
    • That each source correctly overrides getTsField() where required and that summaries interpolate the intended fields.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description only contains 'Resolves #17834' without following the required template structure that includes a WHY section for explaining the rationale. Complete the PR description by adding the missing WHY section that explains the purpose and rationale for the changes, following the repository template.
Linked Issues check ⚠️ Warning The PR implements only 4 of 9 required features: list-orders, list-products, get-order, get-product actions and new-order-created, new-product-created, order-updated sources are present, but new-lead, new-subscription, new-payment sources and add-or-update-contact, create-invoice, get-contact-details, add-or-update-contact-extended, create-product, add-or-update-subscription actions are missing. Implement the missing polling sources (new-lead, new-subscription, new-payment) and actions (add-or-update-contact, create-invoice, get-contact-details, add-or-update-contact-extended, create-product, add-or-update-subscription) specified in issue #17834.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'Upgrade Chat - new components' accurately describes the main change—adding new Upgrade Chat integration components including actions and sources.
Out of Scope Changes check ✅ Passed All changes are related to Upgrade Chat integration components and appear to be within scope of issue #17834, though they represent only a partial implementation of the specified features.
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 issue-17834

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 870fe61 and dd455a5.

📒 Files selected for processing (6)
  • components/upgrade_chat/actions/list-orders/list-orders.mjs (1 hunks)
  • components/upgrade_chat/actions/list-products/list-products.mjs (1 hunks)
  • components/upgrade_chat/sources/new-order-created/new-order-created.mjs (1 hunks)
  • components/upgrade_chat/sources/new-product-created/new-product-created.mjs (1 hunks)
  • components/upgrade_chat/sources/order-updated/order-updated.mjs (1 hunks)
  • components/upgrade_chat/sources/product-updated/product-updated.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2024-10-08T16:43:04.167Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 14229
File: components/americommerce/actions/change-order-status/change-order-status.mjs:6-6
Timestamp: 2024-10-08T16:43:04.167Z
Learning: When providing action descriptions in the AmeriCommerce components, avoid unnecessary details and include a link to the relevant documentation instead.

Applied to files:

  • components/upgrade_chat/actions/list-products/list-products.mjs
📚 Learning: 2024-07-24T02:06:47.016Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 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.

Applied to files:

  • components/upgrade_chat/sources/new-product-created/new-product-created.mjs
  • components/upgrade_chat/sources/product-updated/product-updated.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/upgrade_chat/actions/list-orders/list-orders.mjs
📚 Learning: 2024-10-08T15:33:38.240Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 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`.

Applied to files:

  • components/upgrade_chat/actions/list-orders/list-orders.mjs
🧬 Code graph analysis (3)
components/upgrade_chat/actions/list-products/list-products.mjs (2)
components/upgrade_chat/actions/list-orders/list-orders.mjs (1)
  • response (30-36)
components/upgrade_chat/actions/get-product/get-product.mjs (1)
  • response (24-27)
components/upgrade_chat/sources/product-updated/product-updated.mjs (1)
components/hubspot/sources/new-or-updated-product/new-or-updated-product.mjs (1)
  • product (49-51)
components/upgrade_chat/actions/list-orders/list-orders.mjs (1)
components/upgrade_chat/actions/list-products/list-products.mjs (1)
  • response (30-36)
⏰ 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: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (7)
components/upgrade_chat/sources/product-updated/product-updated.mjs (1)

1-23: LGTM! Clean implementation following the base pattern.

The source correctly extends the common base, overrides the required methods (getResourceFn, getSummary, getTsField), and uses appropriate field references (product.name for summary, "updated" timestamp field).

components/upgrade_chat/sources/new-order-created/new-order-created.mjs (1)

1-20: LGTM! Previous review issues have been addressed.

The grammar and identifier issues from the previous review have been resolved:

  • Description correctly uses "an order" (line 7)
  • Summary correctly uses order.uuid for consistency with the base (line 17)

The implementation follows the established pattern appropriately.

components/upgrade_chat/sources/order-updated/order-updated.mjs (1)

1-23: LGTM! Previous review issues have been addressed.

The grammar and identifier issues from the previous review have been resolved:

  • Description correctly uses "an order" (line 7)
  • Summary correctly uses order.uuid for consistency with the base (line 17)

The getTsField override returning "updated" is appropriate for tracking updated orders.

components/upgrade_chat/sources/new-product-created/new-product-created.mjs (2)

1-20: LGTM! Clean implementation consistent with sibling sources.

The source correctly extends the common base and implements the required methods. Using product.name in the summary is appropriate and consistent with the product-updated source.


1-20: Verify alignment with PR objectives.

The PR objectives from issue #17834 specify implementing these polling sources:

  • new-lead: emits when a new lead is created
  • new-subscription: emits when a new subscription is created
  • new-payment: emits when a new payment is created

However, the implemented sources are:

  • new-order-created
  • order-updated
  • new-product-created
  • product-updated

Please confirm whether this represents a scope change, or if the lead/subscription/payment sources are still planned for implementation.

components/upgrade_chat/actions/list-products/list-products.mjs (1)

29-42: Verify PR scope: this action is not mentioned in PR objectives.

The PR objectives (#17834) specify implementing actions like add-or-update-contact, create-invoice, get-contact-details, add-or-update-contact-extended, create-product, and add-or-update-subscription. However, this list-products action (and the related list-orders action) are not mentioned in those objectives.

Please confirm whether:

  1. The PR objectives need to be updated to reflect the actual implementation, or
  2. The originally specified actions are still planned and these are additional actions
components/upgrade_chat/actions/list-orders/list-orders.mjs (1)

29-42: Verify PR scope: this action is not mentioned in PR objectives.

The PR objectives (#17834) specify implementing actions like add-or-update-contact, create-invoice, get-contact-details, add-or-update-contact-extended, create-product, and add-or-update-subscription. However, this list-orders action (and the related list-products action) are not mentioned in those objectives.

Please confirm whether:

  1. The PR objectives need to be updated to reflect the actual implementation, or
  2. The originally specified actions are still planned and these are additional actions

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: 5

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 29b168a and 870fe61.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • components/upgrade_chat/actions/get-order/get-order.mjs (1 hunks)
  • components/upgrade_chat/actions/get-product/get-product.mjs (1 hunks)
  • components/upgrade_chat/actions/list-orders/list-orders.mjs (1 hunks)
  • components/upgrade_chat/actions/list-products/list-products.mjs (1 hunks)
  • components/upgrade_chat/package.json (2 hunks)
  • components/upgrade_chat/sources/common/base.mjs (1 hunks)
  • components/upgrade_chat/sources/new-order-created/new-order-created.mjs (1 hunks)
  • components/upgrade_chat/sources/new-product-created/new-product-created.mjs (1 hunks)
  • components/upgrade_chat/sources/order-updated/order-updated.mjs (1 hunks)
  • components/upgrade_chat/sources/product-updated/product-updated.mjs (1 hunks)
  • components/upgrade_chat/upgrade_chat.app.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📚 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/upgrade_chat/package.json
📚 Learning: 2024-10-08T15:33:38.240Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 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.

Applied to files:

  • components/upgrade_chat/sources/order-updated/order-updated.mjs
  • components/upgrade_chat/sources/product-updated/product-updated.mjs
  • components/upgrade_chat/sources/new-product-created/new-product-created.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/upgrade_chat/upgrade_chat.app.mjs
📚 Learning: 2024-10-08T15:33:38.240Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 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`.

Applied to files:

  • components/upgrade_chat/actions/list-orders/list-orders.mjs
📚 Learning: 2024-10-10T19:18:27.998Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 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.

Applied to files:

  • components/upgrade_chat/sources/common/base.mjs
🧬 Code graph analysis (6)
components/upgrade_chat/actions/list-products/list-products.mjs (3)
components/upgrade_chat/actions/get-order/get-order.mjs (1)
  • response (24-27)
components/upgrade_chat/actions/get-product/get-product.mjs (1)
  • response (24-27)
components/upgrade_chat/actions/list-orders/list-orders.mjs (1)
  • response (30-36)
components/upgrade_chat/sources/product-updated/product-updated.mjs (1)
components/hubspot/sources/new-or-updated-product/new-or-updated-product.mjs (1)
  • product (49-51)
components/upgrade_chat/actions/get-order/get-order.mjs (3)
components/upgrade_chat/actions/get-product/get-product.mjs (1)
  • response (24-27)
components/upgrade_chat/actions/list-orders/list-orders.mjs (1)
  • response (30-36)
components/upgrade_chat/actions/list-products/list-products.mjs (1)
  • response (30-36)
components/upgrade_chat/actions/get-product/get-product.mjs (3)
components/upgrade_chat/actions/get-order/get-order.mjs (1)
  • response (24-27)
components/upgrade_chat/actions/list-orders/list-orders.mjs (1)
  • response (30-36)
components/upgrade_chat/actions/list-products/list-products.mjs (1)
  • response (30-36)
components/upgrade_chat/upgrade_chat.app.mjs (2)
components/upgrade_chat/sources/common/base.mjs (1)
  • params (46-46)
components/zep/actions/get-threads/get-threads.mjs (1)
  • max (39-39)
components/upgrade_chat/actions/list-orders/list-orders.mjs (1)
components/upgrade_chat/actions/list-products/list-products.mjs (1)
  • response (30-36)
⏰ 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: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
🔇 Additional comments (9)
components/upgrade_chat/package.json (1)

3-17: Package version bump and dependency look appropriate

The 0.1.0 version bump and adding @pipedream/platform as the sole dependency match the new app/base usage and avoid adding built-in Node modules as deps. No changes needed here.
Based on learnings

components/upgrade_chat/actions/get-order/get-order.mjs (1)

3-30: Get Order action wiring looks consistent with the app helper

Props, call into this.upgradeChat.getOrder, and the exported summary are all consistent with the app design; no changes needed here assuming the shared _makeRequest helper is corrected as discussed in the app file.

components/upgrade_chat/sources/product-updated/product-updated.mjs (1)

3-22: Source definition is coherent; behavior depends on fixed pagination

The source correctly extends the common base, uses listProducts as its resource function, and overrides getTsField() to poll by the updated field, which matches the “Product Updated” semantics. Once the upgradeChat.paginate helper is fixed (binding and response handling), this source should behave as expected.

components/upgrade_chat/upgrade_chat.app.mjs (2)

7-41: Let me search more specifically for Upgrade.chat API response structure and pagination details.

Let me try a more direct search for Upgrade.chat API list endpoints documentation.

Verify response shape and consistency between propDefinitions, paginate, and _makeRequest

The original concern remains unresolved through available documentation. Web searches did not yield the specific response structure of Upgrade.chat's /orders or /products endpoints.

To proceed, you must manually verify:

  1. Check the actual Upgrade.chat API response by consulting their full developer documentation or testing against the live API
  2. Confirm whether /orders and /products return:
    • A bare array: [{...}, {...}]
    • A wrapped object: { data: [...], has_more: boolean }
    • Another structure entirely

Once verified, ensure _makeRequest, paginate, and the propDefinitions option loaders all use a consistent contract—either all work with the raw axios response or all unwrap response.data.


61-71: Fix paginate method: correct this binding, wrap params in object, and fix response handling

The current implementation has two critical bugs preventing pagination:

  1. fn(params) calls the unbound function (e.g., this.listOrders), so this inside _makeRequest becomes undefined in ESM strict mode
  2. params is passed flat instead of wrapped in { params: ... }, so limit/offset never become query parameters

Additionally, the response handling needs correction. Per Pipedream docs, axios($, config) returns the HTTP response body directly on success (not an object with a data property).

Suggested fix:

    async *paginate({
      fn, params = {}, max,
    }) {
      let limit = params.limit ?? DEFAULT_LIMIT;
      let offset = params.offset ?? 0;
      let done = false;

      do {
        const response = await fn.call(this, {
          params: {
            ...params,
            limit,
            offset,
          },
        });

        const {
          data: items,
          has_more: hasMore = false,
        } = response || {};

        if (!items?.length) {
          return;
        }

        for (const item of items) {
          yield item;
        }

        offset += limit;
        done = !hasMore;
      } while (!done);
    },
⛔ Skipped due to learnings
Learnt from: LucBerge
Repo: PipedreamHQ/pipedream PR: 14080
File: components/nocodb/nocodb.app.mjs:133-133
Timestamp: 2024-10-08T15:33:38.240Z
Learning: When implementing pagination with an offset, incrementing `args.params.offset` within the loop ensures correct tracking of the offset, particularly when a maximum count limit (`max`) is used.
Learnt from: LucBerge
Repo: PipedreamHQ/pipedream PR: 14080
File: components/nocodb/nocodb.app.mjs:133-133
Timestamp: 2024-09-25T16:13:11.505Z
Learning: When implementing pagination with an offset, incrementing `args.params.offset` within the loop ensures correct tracking of the offset, particularly when a maximum count limit (`max`) is used.
components/upgrade_chat/actions/list-products/list-products.mjs (1)

29-42: LGTM!

The run method correctly implements the list products functionality with proper pagination parameters and summary formatting.

components/upgrade_chat/sources/new-product-created/new-product-created.mjs (2)

1-10: LGTM!

The source metadata and base extension follow the established pattern for Pipedream sources.


16-18: No issues found—the name field exists in the product API response.

The upgrade_chat.app.mjs file already uses product.name in the productUuid propDefinition (line 30) when mapping products from the /products endpoint. The getSummary method in new-product-created.mjs correctly uses this existing field.

components/upgrade_chat/actions/get-product/get-product.mjs (1)

1-31: LGTM!

The action correctly implements the get product functionality following the established pattern from other get actions in this PR.

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!

@vunguyenhung
Copy link
Collaborator

@vunguyenhung
Copy link
Collaborator

Hi everyone, all test cases are passed! Ready for release!

Test reports

@michelle0927 michelle0927 merged commit f0e72d9 into master Nov 20, 2025
10 checks passed
@michelle0927 michelle0927 deleted the issue-17834 branch November 20, 2025 15:18
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.

[Components] upgrade_chat

4 participants