-
Notifications
You must be signed in to change notification settings - Fork 5.5k
OptimoRoute - new components #19068
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
OptimoRoute - new components #19068
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughAdds six new Optimoroute action modules, a polling source and test event fixture, centralizes HTTP requests and route wrappers in the Optimoroute app module, and bumps the component package version and dependencies. Changes
Sequence Diagram(s)sequenceDiagram
participant Timer
participant Source as new-mobile-event source
participant Pagination as paginateEvents()
participant App as optimoroute.app
participant API as Optimoroute API
participant DB as State (db)
participant Emit
Timer->>Source: run()
activate Source
Source->>DB: _getAfterTag()
DB-->>Source: afterTag
Source->>Pagination: paginateEvents(afterTag)
activate Pagination
loop pages
Pagination->>App: getMobileEvents({ after_tag })
App->>API: HTTP GET /v1/... (api_key injected)
API-->>App: { events[], after_tag }
App-->>Pagination: response
Pagination->>Source: yield event
Source->>Source: generateMeta(event)
Source->>Emit: $emit(event, metadata)
end
Pagination->>DB: _setAfterTag(newAfterTag)
deactivate Pagination
deactivate Source
sequenceDiagram
participant Action as Action (e.g., create-order)
participant Run as run({ $ })
participant App as optimoroute.app
participant Helper as _makeRequest()
participant API as Optimoroute API
Action->>Run: invoked
activate Run
Run->>Run: map props -> payload
Run->>App: createOrder(payload)
activate App
App->>Helper: _makeRequest({ path, params })
activate Helper
Helper->>API: HTTP POST /v1/path (api_key added)
API-->>Helper: response / error
alt success
Helper-->>App: response
else error
Helper-->>App: throw ConfigurationError
end
App-->>Run: response
Run->>Action: export summary + return response
deactivate Run
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 2 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2024-10-08T16:42:59.225ZApplied to files:
🧬 Code graph analysis (1)components/optimoroute/actions/start-planning/start-planning.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). (3)
🔇 Additional comments (2)
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 (10)
components/optimoroute/actions/create-order/create-order.mjs(1 hunks)components/optimoroute/actions/get-mobile-events/get-mobile-events.mjs(1 hunks)components/optimoroute/actions/get-routes/get-routes.mjs(1 hunks)components/optimoroute/actions/search-orders/search-orders.mjs(1 hunks)components/optimoroute/actions/start-planning/start-planning.mjs(1 hunks)components/optimoroute/actions/update-order-status/update-order-status.mjs(1 hunks)components/optimoroute/optimoroute.app.mjs(1 hunks)components/optimoroute/package.json(2 hunks)components/optimoroute/sources/new-mobile-event/new-mobile-event.mjs(1 hunks)components/optimoroute/sources/new-mobile-event/test-event.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 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/optimoroute/package.json
📚 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/optimoroute/sources/new-mobile-event/new-mobile-event.mjs
📚 Learning: 2025-09-15T22:01:11.472Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 18362
File: components/leonardo_ai/actions/generate-image/generate-image.mjs:103-105
Timestamp: 2025-09-15T22:01:11.472Z
Learning: In Pipedream components, pipedream/platform's axios implementation automatically excludes undefined values from HTTP requests, so there's no need to manually check for truthiness before including properties in request payloads.
Applied to files:
components/optimoroute/optimoroute.app.mjs
🧬 Code graph analysis (7)
components/optimoroute/actions/update-order-status/update-order-status.mjs (2)
components/optimoroute/actions/create-order/create-order.mjs (1)
response(93-108)components/optimoroute/optimoroute.app.mjs (1)
response(23-30)
components/optimoroute/actions/get-mobile-events/get-mobile-events.mjs (2)
components/optimoroute/actions/search-orders/search-orders.mjs (1)
response(46-57)components/optimoroute/optimoroute.app.mjs (1)
response(23-30)
components/optimoroute/actions/search-orders/search-orders.mjs (3)
components/optimoroute/actions/get-mobile-events/get-mobile-events.mjs (1)
response(24-29)components/optimoroute/actions/get-routes/get-routes.mjs (1)
response(53-63)components/optimoroute/optimoroute.app.mjs (1)
response(23-30)
components/optimoroute/actions/get-routes/get-routes.mjs (2)
components/optimoroute/actions/get-mobile-events/get-mobile-events.mjs (1)
response(24-29)components/optimoroute/optimoroute.app.mjs (1)
response(23-30)
components/optimoroute/actions/create-order/create-order.mjs (1)
components/optimoroute/optimoroute.app.mjs (1)
response(23-30)
components/optimoroute/actions/start-planning/start-planning.mjs (1)
components/optimoroute/optimoroute.app.mjs (1)
response(23-30)
components/optimoroute/optimoroute.app.mjs (6)
components/optimoroute/actions/create-order/create-order.mjs (1)
response(93-108)components/optimoroute/actions/get-mobile-events/get-mobile-events.mjs (1)
response(24-29)components/optimoroute/actions/get-routes/get-routes.mjs (1)
response(53-63)components/optimoroute/actions/search-orders/search-orders.mjs (1)
response(46-57)components/optimoroute/actions/start-planning/start-planning.mjs (1)
response(113-133)components/optimoroute/actions/update-order-status/update-order-status.mjs (1)
response(62-74)
⏰ 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/optimoroute/package.json (1)
3-17: Version bump and platform dependency look correctThe version bump and addition of
@pipedream/platformas the only dependency are appropriate for the new axios-based app methods, and avoid adding any Node core modules to dependencies. Based on learnings.components/optimoroute/sources/new-mobile-event/test-event.mjs (1)
1-10: Sample event payload is straightforward and usableStatic export shape is clear and matches an expected Optimoroute mobile event (status, timestamps, order and driver identifiers). No issues from a component perspective.
components/optimoroute/actions/update-order-status/update-order-status.mjs (1)
1-78: Update Order Status action wiring looks correctProps, status enum, payload shape (
updatesarray withorderNoand nestedstatus) and the exported summary are all consistent and align with the described endpoint.components/optimoroute/actions/get-mobile-events/get-mobile-events.mjs (1)
1-33: Get Mobile Events action is consistent and robust
afterTagreuse via propDefinition, mapping toafter_tagin params, and the summary usingresponse?.events?.lengthare all consistent with the app client and other actions.components/optimoroute/actions/get-routes/get-routes.mjs (1)
3-67: Make routes summary resilient to missingroutesarrayThe action wiring into
this.optimoroute.getRoutesand params mapping looks good. The summary, however, assumesroutesis always present:$.export("$summary", `Routes found: ${response.routes.length}`);To avoid a runtime error if
routesis absent or null, you can mirror the defensive pattern:- $.export("$summary", `Routes found: ${response.routes.length}`); + const count = response?.routes?.length ?? 0; + $.export("$summary", `Routes found: ${count}`);This keeps the step from failing solely due to an unexpected response shape.
⛔ Skipped due to learnings
Learnt from: GTFalcao Repo: PipedreamHQ/pipedream PR: 12731 File: components/hackerone/actions/get-members/get-members.mjs:3-28 Timestamp: 2024-07-04T18:11:59.822Z 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`.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`.components/optimoroute/sources/new-mobile-event/new-mobile-event.mjs (2)
36-55: VerifygetMobileEventscall shape and ensure dedupe id is truly uniqueHere
getMobileEventsis called with only aparamsobject:const { events = [], tag, remainingEvents, } = await this.optimoroute.getMobileEvents({ params: { after_tag: afterTag, }, });In other places (e.g., the
startPlanningaction), Optimoroute app methods appear to expect a payload that includes$(e.g.{ $, data }). IfgetMobileEventsfollows the same pattern, you’ll likely need to pass the source context as well, for example:- } = await this.optimoroute.getMobileEvents({ - params: { - after_tag: afterTag, - }, - }); + } = await this.optimoroute.getMobileEvents({ + $: this, + params: { + after_tag: afterTag, + }, + });Also,
generateMetausesevent.unixTimestampas theidfor adedupe: "unique"source (Lines 29–35). Please confirm thatunixTimestampis guaranteed unique per event; if not, consider a composite id like${event.orderNo}-${event.unixTimestamp}.
56-79: Pagination +afterTagpersistence pattern looks good for avoiding retroactive floods
processEventsconsumes the entirepaginateEventsiterator, then optionally limits emissions (e.g., last 10 on deploy), whilepaginateEventsonly updatesafterTagonce there are no remaining events. This means:
- On first deploy you advance the cursor across all historical events but only emit a small tail batch.
- On subsequent runs you only fetch and emit newly arrived events.
This matches the “advance state even for non-emitted items to avoid retroactive events” pattern used in other sources. Based on learnings
GTFalcao
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.
LGTM!
For Integration QA: |
|
Hello everyone, I have tested this PR and there're some test cases failed or needed improvement. Please check test reports below for more information:
|
|
@vunguyenhung FYI, For "Update Order Status", I had to "dispatch" the order to drivers before I could update the status of an order.
|
|
Hello everyone, I have tested this PR and there're some test cases failed or needed improvement. Please check test reports below for more information:
|
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: 3
♻️ Duplicate comments (1)
components/optimoroute/actions/start-planning/start-planning.mjs (1)
91-109: AlignlockTypedescription withstartsWithprop nameThe description at line 94 still references "startWith" but the actual prop name is
startsWith(lines 75-89). Update to reference the correct prop name for consistency.Apply this diff:
- description: "Lock type. Applicable if startWith is set to CURRENT", + description: "Lock type. Applicable if startsWith is set to CURRENT",
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
components/optimoroute/actions/start-planning/start-planning.mjs(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-10-08T16:42:59.225Z
Learnt from: GTFalcao
Repo: PipedreamHQ/pipedream PR: 14229
File: components/americommerce/actions/update-customer/update-customer.mjs:89-94
Timestamp: 2024-10-08T16:42:59.225Z
Learning: When defining boolean properties in AmeriCommerce components (e.g., in `update-customer.mjs`), ensure that the label and description are consistent and clearly indicate the intent, especially when using negations like "No Account", to avoid confusion.
Applied to files:
components/optimoroute/actions/start-planning/start-planning.mjs
🧬 Code graph analysis (1)
components/optimoroute/actions/start-planning/start-planning.mjs (2)
components/optimoroute/actions/update-order-status/update-order-status.mjs (1)
response(62-74)components/optimoroute/optimoroute.app.mjs (1)
response(23-30)
⏰ 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: Verify TypeScript components
- GitHub Check: Publish TypeScript components
- GitHub Check: Lint Code Base
🔇 Additional comments (1)
components/optimoroute/actions/start-planning/start-planning.mjs (1)
1-13: LGTM: Component metadata and setupThe import, metadata, and annotations are correctly structured for a new Optimoroute action component.
|
Hi everyone, all test cases are passed! Ready for release! Test reports
|
|
/approve |

Resolves #10963
Summary by CodeRabbit
New Features
Chores