Skip to content

New Components - limoexpress #16933

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

New Components - limoexpress #16933

wants to merge 8 commits into from

Conversation

luancazarine
Copy link
Collaborator

@luancazarine luancazarine commented Jun 2, 2025

Resolves #16907.

Summary by CodeRabbit

  • New Features
    • Introduced integration with LimoExpress, enabling users to create limo bookings, create clients, and mark invoices as paid directly from the platform.
    • Added the ability to receive real-time notifications when new limo bookings are created.
  • Enhancements
    • Provided dynamic options for booking types, statuses, vehicle classes, vehicles, currencies, payment methods, clients, and invoices within the user interface.
    • Improved API interaction with pagination support for handling large datasets.
  • Other
    • Updated package version and dependencies to support the new features.

@luancazarine luancazarine added the ai-assisted Content generated by AI, with human refinement and modification label Jun 2, 2025
Copy link

vercel bot commented Jun 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Jun 6, 2025 4:12pm
pipedream-docs ⬜️ Ignored (Inspect) Jun 6, 2025 4:12pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jun 6, 2025 4:12pm

Copy link
Contributor

coderabbitai bot commented Jun 2, 2025

Walkthrough

This update introduces a new LimoExpress integration, including actions for creating bookings, creating clients, and marking invoices as paid. It adds a polling source for new bookings, utility and constants modules, and implements the core app logic with API methods, dynamic prop options, and pagination. The package metadata is updated.

Changes

File(s) Change Summary
components/limoexpress/actions/create-booking/create-booking.mjs New action: Create Limo Booking with comprehensive props and API call.
components/limoexpress/actions/create-client/create-client.mjs New action: Create Client with client details and API call.
components/limoexpress/actions/mark-invoice-paid/mark-invoice-paid.mjs New action: Mark Invoice Paid using invoice ID.
components/limoexpress/common/constants.mjs New constants: price type and client type options.
components/limoexpress/common/utils.mjs New utilities: throwError and checkNumbers functions.
components/limoexpress/limoexpress.app.mjs Core app logic: API methods, prop definitions, pagination, and dynamic options.
components/limoexpress/package.json Version bump to 0.1.0; add @pipedream/platform dependency.
components/limoexpress/sources/new-booking/new-booking.mjs New polling source: emits events for new bookings, tracks last booking, deduplication logic.
components/limoexpress/sources/new-booking/test-event.mjs New: Sample booking event object for testing.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Action
    participant App
    participant LimoExpressAPI

    User->>Action: Provide booking/client/invoice data
    Action->>App: Call API method with data
    App->>LimoExpressAPI: Send HTTP request (createBooking/createClient/markInvoiceAsPaid)
    LimoExpressAPI-->>App: Return API response
    App-->>Action: Return response or throw error
    Action-->>User: Emit summary and response
Loading
sequenceDiagram
    participant Source
    participant App
    participant LimoExpressAPI
    participant DB

    Source->>DB: Get last processed booking number
    loop Polling interval
        Source->>App: listBookings (descending by ID)
        App->>LimoExpressAPI: GET /bookings
        LimoExpressAPI-->>App: Return bookings
        App-->>Source: Return bookings
        Source->>DB: Update last booking number
        Source-->>User: Emit new booking events
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Implement polling source for new bookings (new-booking-instant) (#16907)
Implement action: create-booking with required/optional props and async options (#16907)
Implement action: create-client with required/optional props (#16907)
Implement action: mark-invoice-paid using invoice ID (#16907)
Implement app logic: API methods, dynamic prop options, pagination, utility/constants modules (#16907)

Poem

In the land of LimoExpress, code hops anew,
Bookings and clients, now easy to do!
Invoices marked paid, with a whisk of a tail,
New rides detected, on a polling trail.
With every API call, this bunny’s impressed—
Hopping with joy for LimoExpress!
🐰🚖✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

components/limoexpress/actions/create-booking/create-booking.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:170:49)

components/limoexpress/limoexpress.app.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs
at Object.getPackageJSONURL (node:internal/modules/package_json_reader:255:9)
at packageResolve (node:internal/modules/esm/resolve:767:81)
at moduleResolve (node:internal/modules/esm/resolve:853:18)
at defaultResolve (node:internal/modules/esm/resolve:983:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:799:12)
at #cachedDefaultResolve (node:internal/modules/esm/loader:723:25)
at ModuleLoader.resolve (node:internal/modules/esm/loader:706:38)
at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:307:38)
at #link (node:internal/modules/esm/module_job:170:49)

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sources
 - New Booking

Actions
 - Create Booking
 - Create Client
 - Mark Invoice As Paid
@luancazarine luancazarine marked this pull request as ready for review June 3, 2025 21:21
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: 8

🧹 Nitpick comments (2)
components/limoexpress/actions/create-booking/create-booking.mjs (1)

104-135: Consider using number type for numeric string properties.

Several properties like price, commissionAmount, and vatPercentage are defined as strings but require parseFloat conversion. Consider using number type directly for better type safety.

 price: {
-  type: "string",
+  type: "number",
   label: "Price",
   description: "The price of the booking.",
   optional: true,
 },
 commissionAmount: {
-  type: "string",
+  type: "number",
   label: "Commission Amount",
   description: "The commission amount for the booking.",
   optional: true,
 },
 vatPercentage: {
-  type: "string",
+  type: "number",
   label: "VAT Percentage",
   description: "The VAT percentage for the booking.",
   optional: true,
 },

This would eliminate the need for parseFloat conversions in the run method.

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

142-147: Consider using a more specific Accept header.

The Accept header "/" is too generic. Consider specifying the expected content type for clearer API communication.

Apply this diff to use a more specific Accept header:

-        "Accept": "*/*",
+        "Accept": "application/json",
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 38dac8f and 46804d5.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • components/limoexpress/actions/create-booking/create-booking.mjs (1 hunks)
  • components/limoexpress/actions/create-client/create-client.mjs (1 hunks)
  • components/limoexpress/actions/mark-invoice-paid/mark-invoice-paid.mjs (1 hunks)
  • components/limoexpress/common/constants.mjs (1 hunks)
  • components/limoexpress/common/utils.mjs (1 hunks)
  • components/limoexpress/limoexpress.app.mjs (1 hunks)
  • components/limoexpress/package.json (2 hunks)
  • components/limoexpress/sources/new-booking/new-booking.mjs (1 hunks)
  • components/limoexpress/sources/new-booking/test-event.mjs (1 hunks)
🔇 Additional comments (9)
components/limoexpress/package.json (2)

3-3: LGTM! Appropriate version bump for new features.

The version increment from 0.0.1 to 0.1.0 correctly follows semantic versioning conventions for adding new functionality.


15-17: LGTM! Required dependency addition.

The @pipedream/platform dependency is correctly added and needed for the new LimoExpress integration components.

components/limoexpress/common/constants.mjs (1)

1-15: LGTM! Well-structured constants for centralized configuration.

The constants are well-organized and follow good practices:

  • Clear, descriptive names
  • Consistent structure for TYPE_OPTIONS with label/value pairs
  • Centralized configuration that can be reused across components
components/limoexpress/actions/mark-invoice-paid/mark-invoice-paid.mjs (1)

3-29: LGTM! Well-implemented Pipedream action following best practices.

The action implementation is excellent:

  • Follows standard Pipedream action structure
  • Uses propDefinition for reusable invoice ID selection
  • Proper error handling delegation to the app method
  • Clear summary export with meaningful message
  • Correct API documentation reference
components/limoexpress/common/utils.mjs (2)

3-6: LGTM! Proper error handling with ConfigurationError.

The error handling function correctly extracts error messages and uses optional chaining for safe property access.


8-12:

❌ Incorrect review comment

Review the logic in checkNumbers function - it may be inverted.

According to the AI summary, this function should "determine if a booking number is newer than the last processed one to avoid duplicate event emissions." However, the current logic appears to return true for older or equal numbers, not newer ones.

The function returns true when:

  1. numbers[1] < lastNumber[1] (clearly older), OR
  2. numbers[1] >= lastNumber[1] AND numbers[0] <= lastNumber[0] (equal or older in the first part)

This seems inverted for detecting "newer" bookings.

Consider renaming the function to reflect its actual behavior or inverting the logic if it should detect newer bookings:

-export const checkNumbers = (numbers, lastNumber) => {
-  return (parseInt(numbers[1]) < parseInt(lastNumber[1])) ||
-    ((parseInt(numbers[1]) >= parseInt(lastNumber[1])) &&
-    (parseInt(numbers[0]) <= parseInt(lastNumber[0])));
-};
+export const isBookingNewer = (numbers, lastNumber) => {
+  return (parseInt(numbers[1]) > parseInt(lastNumber[1])) ||
+    ((parseInt(numbers[1]) === parseInt(lastNumber[1])) &&
+    (parseInt(numbers[0]) > parseInt(lastNumber[0])));
+};

Please verify the intended behavior by checking how this function is used in the polling source.


🏁 Script executed:

#!/bin/bash
# Description: Find usage of checkNumbers function to understand the intended logic
# Expected: Usage in polling source that shows whether it should detect newer or older bookings

rg -A 10 -B 5 "checkNumbers"

Length of output: 3475


The checkNumbers function correctly flags older or equal bookings for breaking the loop

The usage in new-booking.mjs makes it clear that checkNumbers is meant to return true when the current booking number is older than or the same as the last processed one, so that the loop stops as soon as it reaches already‐seen items:

for await (const item of response) {
  const numbers = item.number.split("/");
  // break out once we hit bookings ≤ lastNumber
  if (checkNumbers(numbers, lastNumber)) break;
  responseArray.push(item);
}

No inversion of the logic is needed. If you’d like clearer naming, you could rename it to something like:

  • isBookingOlderOrEqual(numbers, lastNumber)
  • shouldStopIteration(numbers, lastNumber)

Likely an incorrect or invalid review comment.

components/limoexpress/actions/create-client/create-client.mjs (1)

1-68: Well-structured action implementation.

The action follows Pipedream's standard patterns and best practices:

  • Proper imports and error handling
  • Clear prop definitions with appropriate types and descriptions
  • Good use of the throwError utility for consistent error handling
  • Summary export for user feedback
components/limoexpress/sources/new-booking/test-event.mjs (1)

1-74: Comprehensive test event data.

The test event provides a realistic and comprehensive sample of booking data that includes all necessary fields for testing the integration. The data structure appears consistent with the API documentation.

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

211-224:

❓ Verification inconclusive

Verify the use of PUT method for creating resources.

Both createBooking and createClient use PUT method instead of the conventional POST for creating new resources. While this might be intentional based on the API design, it's worth confirming this is correct.

Run the following script to check if there are any API documentation references or similar patterns in the codebase:


🏁 Script executed:

#!/bin/bash
# Description: Search for LimoExpress API documentation or similar PUT usage patterns

# Search for any API documentation references
rg -i "limoexpress.*api" --type md -A 5

# Check if other create methods in the codebase use PUT
ast-grep --pattern 'create$_($$$) {
  return this._makeRequest({
    method: "PUT",
    $$$
  });
}'

Length of output: 144


Confirm HTTP method for createBooking and createClient
I wasn’t able to find any LimoExpress API docs or other create… methods using PUT in the repository. Please verify with the official API specification whether these endpoints should indeed use PUT (or if POST is the correct verb).

• File: components/limoexpress/limoexpress.app.mjs
Lines 211–224

  createBooking(opts = {}) {
    return this._makeRequest({
      method: "PUT",
      path: "/bookings",
      ...opts,
    });
  },
  createClient(opts = {}) {
    return this._makeRequest({
      method: "PUT",
      path: "/clients",
      ...opts,
    });
  },

• Action: Confirm with API docs/spec that PUT is intentional for these “create” operations, and update to POST if needed.

lcaresia
lcaresia previously approved these changes Jun 4, 2025
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: 0

♻️ Duplicate comments (1)
components/limoexpress/limoexpress.app.mjs (1)

266-266: Fix the loose equality operator.

The loose equality operator can cause unexpected type coercion issues. This was flagged in a previous review but hasn't been addressed yet.

Apply this diff:

-        hasMore = !(current_page == last_page);
+        hasMore = !(current_page === last_page);
🧹 Nitpick comments (2)
components/limoexpress/limoexpress.app.mjs (2)

217-222: Consider documenting the unusual HTTP method choice.

Using PUT for creating bookings is unconventional - typically POST is used for creation and PUT for updates. While this may be required by the LimoExpress API, consider adding a comment to clarify this design choice.

Add a comment to clarify:

    createBooking(opts = {}) {
+     // Note: LimoExpress API uses PUT for booking creation
      return this._makeRequest({
        method: "PUT",
        path: "/bookings",
        ...opts,
      });
    },

223-229: Consider documenting the unusual HTTP method choice.

Similar to createBooking, using PUT for client creation is unconventional. Adding documentation would help future maintainers understand this API design.

Add a comment to clarify:

    createClient(opts = {}) {
+     // Note: LimoExpress API uses PUT for client creation  
      return this._makeRequest({
        method: "PUT",
        path: "/clients",
        ...opts,
      });
    },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dfcdaf5 and e0feef7.

📒 Files selected for processing (2)
  • components/limoexpress/actions/create-booking/create-booking.mjs (1 hunks)
  • components/limoexpress/limoexpress.app.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/limoexpress/actions/create-booking/create-booking.mjs
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
🔇 Additional comments (3)
components/limoexpress/limoexpress.app.mjs (3)

98-98: LGTM: Good filtering of hidden payment methods.

The filtering logic to exclude hidden payment methods (filter(({ hidden }) => !hidden)) is well-implemented and ensures only available options are presented to users.


247-248: Good pagination configuration.

The pagination setup with per_page: 100 and incrementing page numbers follows best practices for efficient data retrieval.


57-65:

❓ Verification inconclusive

Verify the search parameter for vehicle filtering.

The vehicleId options function uses search_string: vehicleClassId to filter vehicles by class. Ensure this parameter name is correct according to the LimoExpress API documentation, as using an ID value for a search string parameter seems unusual.


🏁 Script executed:

#!/bin/bash
# Description: Check if there are any action files that use vehicleId to verify the parameter usage
# Expected: Find usage patterns that might indicate the correct parameter name

rg -A 5 -B 5 "vehicleId|search_string" --type js

Length of output: 50


🏁 Script executed:

#!/bin/bash
# Search for any occurrence of `search_string` in .js and .mjs files
rg -n "search_string" -g "*.{js,mjs}"

# Locate the definition (or import) of `listVehicles` to inspect its expected parameters
rg -n "listVehicles" -g "*.{js,mjs}"

Length of output: 708


🏁 Script executed:

#!/bin/bash
# Display the listVehicles method implementation in LimoExpress to verify supported parameters
sed -n '170,240p' components/limoexpress/limoexpress.app.mjs

Length of output: 1605


Verify vehicle class filter query parameter

The options method in components/limoexpress/limoexpress.app.mjs (lines 57–65) currently calls:

await this.listVehicles({
  params: {
    page,
    search_string: vehicleClassId,
  },
});

Please confirm in the LimoExpress API documentation whether the Vehicles endpoint supports filtering by class via a generic search_string parameter, or if it requires a dedicated parameter (e.g., vehicle_class_id) instead.

@luancazarine
Copy link
Collaborator Author

/approve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai-assisted Content generated by AI, with human refinement and modification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Components] limoexpress
2 participants