-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Upgrade Chat - new components #19135
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughAdds 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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (6)
🧰 Additional context used🧠 Learnings (4)📚 Learning: 2024-10-08T16:43:04.167ZApplied to files:
📚 Learning: 2024-07-24T02:06:47.016ZApplied to files:
📚 Learning: 2025-06-04T17:52:05.780ZApplied to files:
📚 Learning: 2024-10-08T15:33:38.240ZApplied to files:
🧬 Code graph analysis (3)components/upgrade_chat/actions/list-products/list-products.mjs (2)
components/upgrade_chat/sources/product-updated/product-updated.mjs (1)
components/upgrade_chat/actions/list-orders/list-orders.mjs (1)
⏰ 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)
🔇 Additional comments (7)
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. Comment |
There was a problem hiding this 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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis 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.mjscomponents/upgrade_chat/sources/product-updated/product-updated.mjscomponents/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 appropriateThe 0.1.0 version bump and adding
@pipedream/platformas the sole dependency match the new app/base usage and avoid adding built-in Node modules as deps. No changes needed here.
Based on learningscomponents/upgrade_chat/actions/get-order/get-order.mjs (1)
3-30: Get Order action wiring looks consistent with the app helperProps, call into
this.upgradeChat.getOrder, and the exported summary are all consistent with the app design; no changes needed here assuming the shared_makeRequesthelper 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 paginationThe source correctly extends the common base, uses
listProductsas its resource function, and overridesgetTsField()to poll by theupdatedfield, which matches the “Product Updated” semantics. Once theupgradeChat.paginatehelper 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
/ordersor/productsendpoints.To proceed, you must manually verify:
- Check the actual Upgrade.chat API response by consulting their full developer documentation or testing against the live API
- Confirm whether
/ordersand/productsreturn:
- A bare array:
[{...}, {...}]- A wrapped object:
{ data: [...], has_more: boolean }- Another structure entirely
Once verified, ensure
_makeRequest,paginate, and thepropDefinitionsoption loaders all use a consistent contract—either all work with the raw axios response or all unwrapresponse.data.
61-71: Fixpaginatemethod: correctthisbinding, wrap params in object, and fix response handlingThe current implementation has two critical bugs preventing pagination:
fn(params)calls the unbound function (e.g.,this.listOrders), sothisinside_makeRequestbecomesundefinedin ESM strict modeparamsis passed flat instead of wrapped in{ params: ... }, so limit/offset never become query parametersAdditionally, the response handling needs correction. Per Pipedream docs,
axios($, config)returns the HTTP response body directly on success (not an object with adataproperty).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—thenamefield exists in the product API response.The
upgrade_chat.app.mjsfile already usesproduct.namein theproductUuidpropDefinition (line 30) when mapping products from the/productsendpoint. ThegetSummarymethod innew-product-created.mjscorrectly 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.
components/upgrade_chat/actions/list-products/list-products.mjs
Outdated
Show resolved
Hide resolved
luancazarine
left a comment
There was a problem hiding this 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!
For Integration QA: |
|
Hi everyone, all test cases are passed! Ready for release! Test reports
|
Resolves #17834
Summary by CodeRabbit
New Features
Chores