Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Dec 8, 2025

Resolves #7152

Summary by CodeRabbit

  • New Features

    • Added a source to poll new/updated quotes and a new listQuotes method to fetch quotes.
  • Refactor

    • Introduced a shared polling base used by polling sources; emitted events now include timestamps.
  • Chores

    • Bumped Xero integration package and component versions; standardized prop label capitalization.
  • Changes

    • Contact inputs updated to use tenant-scoped lookups; invoice/contact filters accept array-style contact IDs.
  • Bug Fixes

    • Adjusted success message for purchase bill creation.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 8, 2025

Walkthrough

Adds a shared base polling mixin, refactors two polling sources to use it, introduces a new "New or Updated Quote" polling source, adds listQuotes to the app client, bumps package version, and increments versions and some prop definitions across many action modules.

Changes

Cohort / File(s) Summary
Action version & label updates (many modules)
components/xero_accounting_api/actions/*/*.mjs
Numerous action modules had their exported version incremented; several also standardized/capitalized labels and replaced some string props with propDefinition (tenant-scoped contactId). Mostly metadata and prop-definition adjustments.
Package version
components/xero_accounting_api/package.json
Package version bumped from 0.4.0 to 0.5.0.
Base polling module (new)
components/xero_accounting_api/sources/common/base-polling.mjs
New shared polling mixin exporting common props: xeroAccountingApi, db, timer (default interval), and tenantId (propDefinition).
New quote polling source
components/xero_accounting_api/sources/new-or-updated-quote/new-or-updated-quote.mjs
New source extending base polling: polls /Quotes with modifiedSince, reads/updates lastDateChecked in DB, emits per-quote events with id, summary, ts, and payload, and uses Accept: application/json.
Refactored polling sources
components/xero_accounting_api/sources/new-updated-contact/new-updated-contact.mjs, components/xero_accounting_api/sources/new-updated-invoice/new-updated-invoice.mjs
Replaced explicit props with ...common mixin, initialize/persist lastDateChecked when missing, use sliced date (first 10 chars) and Accept: application/json header, add ts to emitted events, and bumped versions.
App client additions & propDefinition changes
components/xero_accounting_api/xero_accounting_api.app.mjs
Added listQuotes(opts = {}) method; added contactId propDefinition with async options; standardized some propDefinition label capitalization (e.g., Line Items, Tracking Category ID).
Webhook source version bump
components/xero_accounting_api/sources/webhook-event-received/webhook-event-received.mjs
Version bumped; no logic changes.

Sequence Diagram(s)

sequenceDiagram
    participant Timer
    participant Source as Polling Source
    participant DB
    participant XeroAPI as Xero API
    participant Emit as Event Emitter

    Timer->>Source: Interval trigger
    Source->>DB: read lastDateChecked
    alt lastDateChecked missing
        Source->>DB: write lastDateChecked = now()
    end
    Source->>XeroAPI: GET /Quotes?modifiedSince={lastDateChecked.slice(0,10)} (Accept: application/json)
    XeroAPI-->>Source: Quotes JSON
    loop each quote (reverse order)
        Source->>Source: format DateString -> ts, id, summary
        Source->>DB: update lastDateChecked (per item)
        Source->>Emit: emit({ id, summary, ts, payload, meta })
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Areas needing extra attention:
    • components/xero_accounting_api/sources/common/base-polling.mjs — ensure props and defaults match callers and typing/propDefinition usage is correct.
    • new-or-updated-quote — validate API path, modifiedSince handling, Accept header, id/ts formatting and dedupe semantics.
    • new-updated-contact and new-updated-invoice — confirm DB initialization, date slicing, ordering, and dedupe behavior remain correct after refactor.
    • PropDefinition substitutions across actions (contactId/contactIdentifier/contactIds) — verify option resolvers and tenantId wiring behave consistently with prior implementations.
    • components/xero_accounting_api/xero_accounting_api.app.mjs — review new listQuotes implementation for consistent auth/request-building and pagination handling.

Suggested labels

User submitted

Suggested reviewers

  • jcortes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete. Only 'Resolves #7152' is provided, but the required template includes a 'WHY' section that must be filled out. Complete the description by explaining why this feature is needed, what problems it solves, and the implementation details.
Out of Scope Changes check ⚠️ Warning The PR includes numerous out-of-scope changes beyond the quoted trigger requirement: version bumps across 35+ action files, label standardizations, prop signature changes, and refactoring of polling sources. Separate the quote trigger implementation into a focused PR; move unrelated version bumps, label standardizations, and polling refactoring to separate PRs.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Xero Accounting - New or Updated Quote' directly and clearly reflects the main change: adding a new trigger for quote updates.
Linked Issues check ✅ Passed The PR successfully implements the core requirement from issue #7152: adding a new trigger that fires when a Xero quote is created or updated.
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-7152

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.

@vercel
Copy link

vercel bot commented Dec 8, 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 Dec 12, 2025 4:14pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Dec 12, 2025 4:14pm

@michelle0927 michelle0927 marked this pull request as ready for review December 8, 2025 18:54
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: 4

Caution

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

⚠️ Outside diff range comments (7)
components/xero_accounting_api/actions/create-payment/create-payment.mjs (1)

133-137: Bug: Property name mismatch causes accountCode to be ignored.

The prop is defined as accountCode (line 29), but it's referenced here as this.account_code. This will always pass undefined as the account code, breaking the flow when users provide an account code instead of an account ID.

   } else {
     data["Account"] = {
-      Code: this.account_code,
+      Code: this.accountCode,
     };
   }
components/xero_accounting_api/actions/xero-accounting-update-contact/xero-accounting-update-contact.mjs (1)

154-159: Fix typo property names in contact-related modules.

The properties puchasesDefaultAccountCode (line 154) and puechasesTrackingCategories (line 166) contain typos in their names. These should be purchasesDefaultAccountCode and purchasesTrackingCategories to match the API field names and improve code clarity. The same typos exist in xero-accounting-create-or-update-contact.mjs, affecting at least 4 occurrences total across both modules.

components/xero_accounting_api/actions/list-credit-notes/list-credit-notes.mjs (1)

7-65: Version bump is fine; consider not swallowing all errors as “No credit notes found”.

Current catch converts any failure (including auth / config / network errors) into an empty {} with a generic summary, which makes debugging harder. Consider only treating specific “no results” responses this way (e.g., by checking HTTP status or error code) and surfacing other errors.

   async run({ $ }) {
     try {
       const response = await this.xeroAccountingApi.listCreditNotes({
         $,
         tenantId: this.tenantId,
         modifiedSince: this.modifiedAfter,
         params: {
           Where: this.where,
           order: this.order,
           page: this.page,
         },
       });
 
       $.export("$summary", `Successfully fetched ${response.CreditNotes.length} credit notes`);
       return response;
-    } catch (e) {
-      $.export("$summary", "No credit notes found");
-      return {};
-    }
+    } catch (err) {
+      // Adjust this condition to match your HTTP/client error shape
+      if (err?.response?.status === 404) {
+        $.export("$summary", "No credit notes found");
+        return {};
+      }
+      throw err;
+    }
   },
components/xero_accounting_api/actions/list-invoices/list-invoices.mjs (1)

7-101: Version bump is fine; consider narrowing the generic “No invoices found” catch.

As with credit notes, the catch path currently hides all failures as “No invoices found”, which can obscure auth or API errors. It’s safer to only treat known “no data” conditions this way and rethrow or surface other errors.

   async run({ $ }) {
     try {
       const response = await this.xeroAccountingApi.listInvoices({
         $,
         tenantId: this.tenantId,
         modifiedSince: this.modifiedAfter,
         params: {
           IDs: this.ids,
           InvoiceNumbers: this.invoiceNumbers,
           ContactIDs: this.contactIds,
           Statuses: this.statuses,
           Where: this.where,
           createdByMyApp: this.createdByMyApp,
           order: this.order,
           page: this.page,
         },
       });
 
       $.export("$summary", `Successfully fetched ${response.Invoices.length} invoices`);
       return response;
-    } catch (e) {
-      $.export("$summary", "No invoices found");
-      return {};
-    }
+    } catch (err) {
+      // Adjust this condition to match your HTTP/client error shape
+      if (err?.response?.status === 404) {
+        $.export("$summary", "No invoices found");
+        return {};
+      }
+      throw err;
+    }
   },
components/xero_accounting_api/actions/create-tracking-category/create-tracking-category.mjs (1)

9-67: Improve error handling and remove console.log from the catch block.

The catch block has two issues: it logs the raw error object via console.log (lines 63), and it unsafely accesses err.response.data.Elements[0].ValidationErrors[0].Message without guarding against missing properties. Either issue will break error handling. Use optional chaining and provide a fallback message instead.

   async run({ $ }) {
     try {
       const response = await this.xeroAccountingApi.createTrackingCategory({
         $,
         tenantId: this.tenantId,
         data: {
           Name: this.name,
         },
       });

       if (this.options) {
         const parsedOptions = parseObject(this.options);

         for (const option of parsedOptions) {
           const optionResponse = await this.xeroAccountingApi.createTrackingOption({
             $,
             tenantId: this.tenantId,
             trackingCategoryId: response.TrackingCategories[0].TrackingCategoryID,
             data: {
               Name: option,
             },
           });
           response.TrackingCategories[0].Options.push(optionResponse.Options[0]);
         }
       }

       $.export("$summary", `Successfully created tracking category with ID: ${response.TrackingCategories[0].TrackingCategoryID}`);
       return response;
     } catch (err) {
-      console.log(err);
-      throw new ConfigurationError(err.response.data.Elements[0].ValidationErrors[0].Message);
+      const message =
+        err?.response?.data?.Elements?.[0]?.ValidationErrors?.[0]?.Message
+        || err?.message
+        || "Failed to create tracking category";
+      throw new ConfigurationError(message);
     }
   },
components/xero_accounting_api/actions/update-tracking-category/update-tracking-category.mjs (1)

8-67: Harden error handling to avoid destructuring failures in catch.

The catch ({ response: { data } }) destructuring will throw a TypeError if the error lacks a response or data property (e.g., network errors, SDK errors), masking the original failure. Catch the full error object and use optional chaining to safely access nested properties before constructing the ConfigurationError message.

-    } catch ({ response: { data } }) {
-      throw new ConfigurationError(data.Elements[0].ValidationErrors[0].Message);
+    } catch (err) {
+      const message =
+        err?.response?.data?.Elements?.[0]?.ValidationErrors?.[0]?.Message
+        || err?.message
+        || "Failed to update tracking category";
+      throw new ConfigurationError(message);
     }
components/xero_accounting_api/actions/xero-create-purchase-bill/xero-create-purchase-bill.mjs (1)

9-145: Fix undefined PurchaseBillID in summary export.

The response from createInvoice follows Xero's standard structure with Invoices: [...], so response.PurchaseBillID will be undefined. Access the ID from response.Invoices[0].InvoiceID instead:

-    $.export("$summary", `Successfully created purchase bill with ID: ${response.PurchaseBillID}`);
-    return response;
+    const invoiceId = response?.Invoices?.[0]?.InvoiceID;
+    $.export(
+      "$summary",
+      invoiceId
+        ? `Successfully created purchase bill with ID: ${invoiceId}`
+        : "Successfully created purchase bill",
+    );
+    return response;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e061bd2 and 89a2b2b.

📒 Files selected for processing (45)
  • components/xero_accounting_api/actions/add-line-item-to-invoice/add-line-item-to-invoice.mjs (1 hunks)
  • components/xero_accounting_api/actions/create-bank-transaction/create-bank-transaction.mjs (1 hunks)
  • components/xero_accounting_api/actions/create-bill/create-bill.mjs (1 hunks)
  • components/xero_accounting_api/actions/create-credit-note/create-credit-note.mjs (1 hunks)
  • components/xero_accounting_api/actions/create-history-note/create-history-note.mjs (1 hunks)
  • components/xero_accounting_api/actions/create-item/create-item.mjs (1 hunks)
  • components/xero_accounting_api/actions/create-payment/create-payment.mjs (1 hunks)
  • components/xero_accounting_api/actions/create-tracking-category/create-tracking-category.mjs (1 hunks)
  • components/xero_accounting_api/actions/create-update-contact/create-update-contact.mjs (1 hunks)
  • components/xero_accounting_api/actions/delete-tracking-category-option/delete-tracking-category-option.mjs (1 hunks)
  • components/xero_accounting_api/actions/delete-tracking-category/delete-tracking-category.mjs (1 hunks)
  • components/xero_accounting_api/actions/download-invoice/download-invoice.mjs (1 hunks)
  • components/xero_accounting_api/actions/email-an-invoice/email-an-invoice.mjs (1 hunks)
  • components/xero_accounting_api/actions/find-invoice/find-invoice.mjs (1 hunks)
  • components/xero_accounting_api/actions/find-or-create-contact/find-or-create-contact.mjs (1 hunks)
  • components/xero_accounting_api/actions/get-bank-statements-report/get-bank-statements-report.mjs (1 hunks)
  • components/xero_accounting_api/actions/get-bank-summary/get-bank-summary.mjs (1 hunks)
  • components/xero_accounting_api/actions/get-contact/get-contact.mjs (1 hunks)
  • components/xero_accounting_api/actions/get-history-of-changes/get-history-of-changes.mjs (1 hunks)
  • components/xero_accounting_api/actions/get-invoice-online-url/get-invoice-online-url.mjs (1 hunks)
  • components/xero_accounting_api/actions/get-invoice/get-invoice.mjs (1 hunks)
  • components/xero_accounting_api/actions/get-item/get-item.mjs (1 hunks)
  • components/xero_accounting_api/actions/get-tenant-connections/get-tenant-connections.mjs (1 hunks)
  • components/xero_accounting_api/actions/get-tracking-category/get-tracking-category.mjs (1 hunks)
  • components/xero_accounting_api/actions/list-contacts/list-contacts.mjs (1 hunks)
  • components/xero_accounting_api/actions/list-credit-notes/list-credit-notes.mjs (1 hunks)
  • components/xero_accounting_api/actions/list-invoices/list-invoices.mjs (1 hunks)
  • components/xero_accounting_api/actions/list-manual-journals/list-manual-journals.mjs (1 hunks)
  • components/xero_accounting_api/actions/list-tracking-categories/list-tracking-categories.mjs (1 hunks)
  • components/xero_accounting_api/actions/make-an-api-call/make-an-api-call.mjs (1 hunks)
  • components/xero_accounting_api/actions/update-tracking-category-option/update-tracking-category-option.mjs (1 hunks)
  • components/xero_accounting_api/actions/update-tracking-category/update-tracking-category.mjs (1 hunks)
  • components/xero_accounting_api/actions/upload-file/upload-file.mjs (1 hunks)
  • components/xero_accounting_api/actions/xero-accounting-create-employee/xero-accounting-create-employee.mjs (1 hunks)
  • components/xero_accounting_api/actions/xero-accounting-create-or-update-contact/xero-accounting-create-or-update-contact.mjs (1 hunks)
  • components/xero_accounting_api/actions/xero-accounting-update-contact/xero-accounting-update-contact.mjs (1 hunks)
  • components/xero_accounting_api/actions/xero-create-purchase-bill/xero-create-purchase-bill.mjs (1 hunks)
  • components/xero_accounting_api/actions/xero-create-sales-invoice/xero-create-sales-invoice.mjs (1 hunks)
  • components/xero_accounting_api/package.json (1 hunks)
  • components/xero_accounting_api/sources/common/base-polling.mjs (1 hunks)
  • components/xero_accounting_api/sources/new-or-updated-quote/new-or-updated-quote.mjs (1 hunks)
  • components/xero_accounting_api/sources/new-updated-contact/new-updated-contact.mjs (3 hunks)
  • components/xero_accounting_api/sources/new-updated-invoice/new-updated-invoice.mjs (3 hunks)
  • components/xero_accounting_api/sources/webhook-event-received/webhook-event-received.mjs (1 hunks)
  • components/xero_accounting_api/xero_accounting_api.app.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-20T01:01:02.970Z
Learnt from: js07
Repo: PipedreamHQ/pipedream PR: 18744
File: components/slack_v2/actions/send-large-message/send-large-message.mjs:49-64
Timestamp: 2025-10-20T01:01:02.970Z
Learning: In components/slack_v2/actions/send-large-message/send-large-message.mjs, the metadata_event_payload prop is typed as string, so the code only needs to handle string-to-JSON parsing and does not need to handle object inputs.

Applied to files:

  • components/xero_accounting_api/sources/webhook-event-received/webhook-event-received.mjs
🧬 Code graph analysis (2)
components/xero_accounting_api/sources/new-updated-contact/new-updated-contact.mjs (2)
components/xero_accounting_api/sources/new-or-updated-quote/new-or-updated-quote.mjs (1)
  • lastDateChecked (13-13)
components/xero_accounting_api/sources/new-updated-invoice/new-updated-invoice.mjs (1)
  • lastDateChecked (13-13)
components/xero_accounting_api/sources/new-updated-invoice/new-updated-invoice.mjs (2)
components/xero_accounting_api/sources/new-or-updated-quote/new-or-updated-quote.mjs (1)
  • lastDateChecked (13-13)
components/xero_accounting_api/sources/new-updated-contact/new-updated-contact.mjs (1)
  • lastDateChecked (13-13)
⏰ 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)
  • GitHub Check: Lint Code Base
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (42)
components/xero_accounting_api/actions/find-invoice/find-invoice.mjs (1)

11-11: Verify the rationale for systematic version bumps across 35 actions.

This is a patch version bump (0.0.4 → 0.0.5) applied to this action module. According to the PR summary, the primary objective is to add a new "New or Updated Quote" polling source. Verify that this version bump across 35 action modules is intentional and whether it should be coordinated with the core feature changes rather than applied as a blanket metadata update.

components/xero_accounting_api/actions/get-item/get-item.mjs (1)

7-7: Verify the necessity of the version bump.

The version has been incremented from 0.2.3 to 0.2.4, but the code logic, error handling, and runtime behavior remain unchanged. According to the enriched summary, this is part of a broader pattern across 35 action modules, none of which have logic changes.

Typically, version bumps accompany functional or feature changes. Please clarify whether this coordinated version bump across unrelated modules is intentional—for example, whether it's tied to an overall package version release or required by Pipedream's versioning policy.

components/xero_accounting_api/actions/get-tenant-connections/get-tenant-connections.mjs (1)

7-7: LGTM!

The patch version bump is appropriate for a metadata-only change with no behavioral modifications.

components/xero_accounting_api/actions/list-contacts/list-contacts.mjs (1)

7-7: Verify the rationale for this version bump.

The version has been incremented from 0.2.1 to 0.2.2, but the action's code logic remains unchanged. While the AI summary notes this is part of a batch version bump across 35 actions, this particular action is unrelated to the core PR objectives (quote trigger and polling refactors).

Please confirm whether this version bump is intentional as part of a coordinated release strategy or if it should be reverted.

components/xero_accounting_api/actions/create-payment/create-payment.mjs (1)

8-8: LGTM!

Version bump is consistent with the PR pattern.

components/xero_accounting_api/actions/xero-accounting-update-contact/xero-accounting-update-contact.mjs (1)

9-9: Version bump approved as routine maintenance.

The version bump to 0.1.4 is consistent with the PR objective of updating versions across action modules. No functional changes are introduced.

components/xero_accounting_api/actions/xero-accounting-create-or-update-contact/xero-accounting-create-or-update-contact.mjs (1)

8-8: Version bump is appropriate as part of coordinated release.

The version increment aligns with the broader pattern of updates across the Xero actions in this PR, which includes additions to the shared app client. This change is approved.

components/xero_accounting_api/actions/get-history-of-changes/get-history-of-changes.mjs (1)

8-8: Version bump is appropriate and isolated.

The metadata version update is consistent with other action version increments in this PR.

components/xero_accounting_api/actions/make-an-api-call/make-an-api-call.mjs (1)

9-9: Version bump is appropriate and isolated.

The metadata version update is consistent with other action version increments in this PR.

components/xero_accounting_api/actions/get-bank-summary/get-bank-summary.mjs (1)

8-8: Version bump is appropriate and isolated.

The metadata version update is consistent with other action version increments in this PR.

components/xero_accounting_api/actions/create-credit-note/create-credit-note.mjs (1)

9-9: Version bump is appropriate and isolated.

The metadata version update is consistent with other action version increments in this PR.

components/xero_accounting_api/actions/email-an-invoice/email-an-invoice.mjs (1)

8-8: Version bump is appropriate and isolated.

The metadata version update is consistent with other action version increments in this PR.

components/xero_accounting_api/actions/update-tracking-category-option/update-tracking-category-option.mjs (1)

8-8: Version bump is appropriate and isolated.

The metadata version update is consistent with other action version increments in this PR. Note that this action uses the 0.0.x series while most others use 0.1.x.

components/xero_accounting_api/actions/delete-tracking-category/delete-tracking-category.mjs (2)

8-8: Version bump is appropriate and isolated.

The metadata version update is consistent with other action version increments in this PR.


43-45: Defensive error handling is well-structured.

The optional chaining on line 44 appropriately guards against missing nested error properties, ensuring robust error handling.

components/xero_accounting_api/actions/create-history-note/create-history-note.mjs (2)

8-8: Version bump is appropriate and isolated.

The metadata version update is consistent with other action version increments in this PR.


27-41: Quote support was already available in endpoint options.

The action already includes "Quotes" among the supported document types (line 40), indicating the app had partial quote infrastructure in place prior to this PR.

components/xero_accounting_api/actions/create-bill/create-bill.mjs (1)

13-13: LGTM!

Version bump aligns with the package version update to 0.5.0.

components/xero_accounting_api/actions/create-update-contact/create-update-contact.mjs (1)

9-9: LGTM!

Version bump aligns with the package version update to 0.5.0.

components/xero_accounting_api/actions/xero-accounting-create-employee/xero-accounting-create-employee.mjs (1)

9-9: LGTM!

Version bump aligns with the package version update to 0.5.0.

components/xero_accounting_api/actions/download-invoice/download-invoice.mjs (1)

9-9: LGTM!

Version bump aligns with the package version update to 0.5.0.

components/xero_accounting_api/package.json (1)

3-3: LGTM!

Minor version bump from 0.4.0 to 0.5.0 is appropriate for the addition of new functionality (new "New or Updated Quote" source, base-polling module, and listQuotes method) without breaking changes.

components/xero_accounting_api/actions/create-item/create-item.mjs (1)

8-8: Version bump only – action behavior unchanged.

The version increment is consistent with the rest of the Xero Accounting actions; runtime logic remains the same.

components/xero_accounting_api/actions/upload-file/upload-file.mjs (1)

8-8: Metadata version increment looks consistent.

No behavioral changes; upload and streaming logic remain as before.

components/xero_accounting_api/actions/get-bank-statements-report/get-bank-statements-report.mjs (1)

8-8: Bank statements report action version bump is safe.

Validation, params, and summary message are unchanged; only the version string is updated.

components/xero_accounting_api/actions/create-bank-transaction/create-bank-transaction.mjs (1)

8-8: LGTM! Version bump aligns with package release.

The version increment is appropriate as part of the broader package version update from 0.4.0 to 0.5.0.

components/xero_accounting_api/actions/list-tracking-categories/list-tracking-categories.mjs (1)

7-7: LGTM! Version bump aligns with package release.

The version increment is appropriate as part of the broader package version update from 0.4.0 to 0.5.0.

components/xero_accounting_api/actions/get-contact/get-contact.mjs (1)

7-7: LGTM! Version bump aligns with package release.

The version increment is appropriate as part of the broader package version update from 0.4.0 to 0.5.0.

components/xero_accounting_api/actions/delete-tracking-category-option/delete-tracking-category-option.mjs (1)

8-8: LGTM! Version bump aligns with package release.

The version increment is appropriate as part of the broader package version update from 0.4.0 to 0.5.0.

components/xero_accounting_api/sources/webhook-event-received/webhook-event-received.mjs (1)

8-8: LGTM! Version bump aligns with package release.

The version increment is appropriate as part of the broader package version update from 0.4.0 to 0.5.0.

components/xero_accounting_api/actions/find-or-create-contact/find-or-create-contact.mjs (1)

12-12: LGTM! Version bump aligns with package release.

The version increment is appropriate as part of the broader package version update from 0.4.0 to 0.5.0.

components/xero_accounting_api/actions/add-line-item-to-invoice/add-line-item-to-invoice.mjs (1)

11-11: LGTM! Version bump aligns with package release.

The version increment is appropriate as part of the broader package version update from 0.4.0 to 0.5.0.

components/xero_accounting_api/actions/list-manual-journals/list-manual-journals.mjs (1)

7-7: LGTM! Version bump aligns with package release.

The version increment is appropriate as part of the broader package version update from 0.4.0 to 0.5.0.

components/xero_accounting_api/actions/get-invoice-online-url/get-invoice-online-url.mjs (1)

7-7: LGTM!

Version bump is consistent with the broader package update in this PR.

components/xero_accounting_api/actions/get-tracking-category/get-tracking-category.mjs (1)

7-7: LGTM!

Version bump is consistent with the broader package update in this PR.

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

391-396: LGTM!

The new listQuotes method follows the established pattern of other list methods in this app client (e.g., listContacts, listInvoices). Clean and consistent implementation.

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

7-7: LGTM!

Version bump is consistent with the broader package update in this PR.

components/xero_accounting_api/actions/xero-create-sales-invoice/xero-create-sales-invoice.mjs (1)

9-9: LGTM!

Version bump is consistent with the broader package update in this PR.

components/xero_accounting_api/sources/common/base-polling.mjs (1)

1-21: LGTM!

Good DRY refactoring. Extracting common polling props into a shared base module reduces duplication across sources and ensures consistent configuration (timer interval, tenant selection).

components/xero_accounting_api/sources/new-updated-invoice/new-updated-invoice.mjs (1)

2-5: LGTM!

Good refactoring to use the shared base polling module, reducing code duplication and ensuring consistent polling configuration across sources.

components/xero_accounting_api/sources/new-or-updated-quote/new-or-updated-quote.mjs (1)

12-38: Implementation follows the established pattern.

The polling logic correctly:

  • Initializes lastDateChecked on first run
  • Uses date-only slice for modifiedSince parameter
  • Processes quotes in reverse chronological order
  • Emits with unique ID combining QuoteID and timestamp
components/xero_accounting_api/sources/new-updated-contact/new-updated-contact.mjs (1)

1-9: Refactor to shared base-polling module looks good.

The changes correctly:

  • Import and spread the common base-polling module
  • Standardize the modifiedSince parameter handling
  • Add explicit Accept: application/json header
  • Bump version appropriately

lcaresia
lcaresia previously approved these changes Dec 9, 2025
Copy link
Collaborator

@lcaresia lcaresia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@vunguyenhung
Copy link
Collaborator

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:

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

Caution

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

⚠️ Outside diff range comments (1)
components/xero_accounting_api/actions/xero-create-purchase-bill/xero-create-purchase-bill.mjs (1)

95-117: Align Sent to Contact prop type and validation message with actual inputs

Two small inconsistencies worth fixing:

  1. sentToContact is described as a Boolean but declared as type: "string", which is confusing and may send a string to Xero where a boolean is expected.
  2. The configuration error message mentions a **Type** parameter that users don’t actually configure (it’s hard‑coded as "ACCPAY").

Consider this adjustment:

     sentToContact: {
       label: "Sent to Contact",
-      type: "string",
-      description: "Boolean to set whether the invoice in the Xero app should be marked as \"sent\". This can be set only on invoices that have been approved",
+      type: "boolean",
+      description: "Boolean to set whether the invoice in the Xero app should be marked as \"sent\". This can be set only on invoices that have been approved",
       optional: true,
     },
@@
   async run({ $ }) {
     if ((!this.contactId && !this.contactName) || !this.tenantId || !this.lineItems) {
-      throw new ConfigurationError("Must provide one of **Contact ID** or **Contact Name**, **Tenant ID**, **Type**, and **Line Items** parameters.");
+      throw new ConfigurationError("Must provide one of **Contact ID** or **Contact Name**, **Tenant ID**, and **Line Items** parameters.");
     }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 89a2b2b and f35dfde.

📒 Files selected for processing (1)
  • components/xero_accounting_api/actions/xero-create-purchase-bill/xero-create-purchase-bill.mjs (2 hunks)
⏰ 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/xero_accounting_api/actions/xero-create-purchase-bill/xero-create-purchase-bill.mjs (1)

9-9: Version bump is appropriate for this behavioral tweak

The version increment to 0.1.4 correctly reflects a small, backward‑compatible behavior change (success summary only). No issues here.

@vunguyenhung
Copy link
Collaborator

@vunguyenhung
Copy link
Collaborator

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:

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

Caution

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

⚠️ Outside diff range comments (1)
components/xero_accounting_api/actions/xero-accounting-create-or-update-contact/xero-accounting-create-or-update-contact.mjs (1)

259-260: Fix summary to avoid “ID: undefined” on create path.

When contactId isn’t provided (create flow), the summary will log undefined. Prefer extracting the created/updated ID from the API response (if present) and falling back to a generic summary.

-    $.export("$summary", `Successfully created or updated contact with ID: ${this.contactId}`);
+    const contactId = response?.Contacts?.[0]?.ContactID ?? this.contactId;
+    $.export(
+      "$summary",
+      contactId
+        ? `Successfully created or updated contact with ID: ${contactId}`
+        : "Successfully created or updated contact",
+    );
     return response;
♻️ Duplicate comments (1)
components/xero_accounting_api/actions/xero-create-purchase-bill/xero-create-purchase-bill.mjs (1)

149-150: Guard response.Invoices[0] to avoid runtime errors.

This matches the earlier review note: response?.Invoices?.[0]?.InvoiceID should be safely accessed before building the summary.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f35dfde and 0d4ae91.

📒 Files selected for processing (10)
  • components/xero_accounting_api/actions/create-bank-transaction/create-bank-transaction.mjs (5 hunks)
  • components/xero_accounting_api/actions/create-bill/create-bill.mjs (5 hunks)
  • components/xero_accounting_api/actions/create-credit-note/create-credit-note.mjs (5 hunks)
  • components/xero_accounting_api/actions/get-contact/get-contact.mjs (2 hunks)
  • components/xero_accounting_api/actions/list-invoices/list-invoices.mjs (3 hunks)
  • components/xero_accounting_api/actions/xero-accounting-create-or-update-contact/xero-accounting-create-or-update-contact.mjs (6 hunks)
  • components/xero_accounting_api/actions/xero-accounting-update-contact/xero-accounting-update-contact.mjs (6 hunks)
  • components/xero_accounting_api/actions/xero-create-purchase-bill/xero-create-purchase-bill.mjs (3 hunks)
  • components/xero_accounting_api/actions/xero-create-sales-invoice/xero-create-sales-invoice.mjs (2 hunks)
  • components/xero_accounting_api/xero_accounting_api.app.mjs (4 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 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/xero_accounting_api/xero_accounting_api.app.mjs
📚 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/xero_accounting_api/actions/create-credit-note/create-credit-note.mjs
  • components/xero_accounting_api/actions/create-bank-transaction/create-bank-transaction.mjs
🧬 Code graph analysis (1)
components/xero_accounting_api/xero_accounting_api.app.mjs (1)
components/xero_accounting_api/sources/new-updated-contact/new-updated-contact.mjs (1)
  • contacts (19-27)
⏰ 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 (20)
components/xero_accounting_api/actions/xero-create-sales-invoice/xero-create-sales-invoice.mjs (2)

9-9: LGTM! Version bump appropriate for refactoring.

The version increment from 0.3.4 to 0.3.5 is appropriate for the contactId prop definition refactor.


24-33: The contactId propDefinition refactoring is correctly implemented.

The contactId propDefinition exists in the xero app file and properly accepts the tenantId parameter to scope contact options. The async options function receives tenantId and passes it to this.getContact(), ensuring contacts are filtered by the selected tenant. The refactoring preserves the original behavior while improving maintainability through the propDefinition pattern.

components/xero_accounting_api/actions/create-bank-transaction/create-bank-transaction.mjs (3)

8-8: LGTM! Cosmetic improvements enhance consistency.

The version bump and label capitalization changes improve UI consistency across the Xero action suite. All labels now follow Title Case convention.

Also applies to: 25-25, 31-31, 48-48, 67-67, 72-72, 90-90, 96-96, 118-118


128-163: LGTM! Runtime logic remains sound.

The validation logic correctly enforces that at least one identifier is provided for both the bank account and the contact. The API call structure is compatible with the contactId propDefinition change, as propDefinitions resolve to their selected values at runtime.


35-44: Verify the contactId propDefinition exists in the app file.

The refactor from a simple string prop to a propDefinition-based input improves UX by providing a dynamic, tenant-scoped contact selector. The xeroAccountingApi app file correctly defines the contactId propDefinition with an async options function that accepts tenantId and returns contact options. This implementation matches the usage pattern in the action file and ensures the correct contact list is loaded per organization.

components/xero_accounting_api/actions/xero-accounting-update-contact/xero-accounting-update-contact.mjs (2)

9-9: LGTM: Version bump is appropriate.

The patch version increment to 0.1.4 is consistent with the minor changes in this action (propDefinition standardization and description cleanup).


24-33: The propDefinition refactoring for contactId is a good improvement.

Using propDefinition with tenantId propagation enables dynamic contact lookup scoped to the selected tenant, improving the user experience. The validation at Line 221 is technically redundant since the framework enforces contactId as a required prop at the form level (the propDefinition has no optional field), preventing submission without a value. However, this defensive check is acceptable and adds an extra safety layer.

components/xero_accounting_api/actions/get-contact/get-contact.mjs (1)

7-7: Version bump looks fine.

components/xero_accounting_api/actions/xero-accounting-create-or-update-contact/xero-accounting-create-or-update-contact.mjs (2)

8-8: Version bump looks fine.


29-38: Tenant-scoped contactId propDefinition wiring looks correct.

components/xero_accounting_api/actions/xero-create-purchase-bill/xero-create-purchase-bill.mjs (2)

9-9: Version bump looks fine.


24-33: Tenant-scoped contactId propDefinition wiring looks correct.

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

27-64: Label-only changes look good.

Also applies to: 96-101

components/xero_accounting_api/actions/list-invoices/list-invoices.mjs (2)

7-7: Version bump looks fine.


40-52: contactIds array → ContactIDs join logic looks correct.

Also applies to: 93-95

components/xero_accounting_api/actions/create-credit-note/create-credit-note.mjs (3)

9-9: Version bump looks fine.


24-34: Tenant-scoped contactId propDefinition wiring looks correct.


76-128: Label normalization is consistent with the rest of the PR.

components/xero_accounting_api/actions/create-bill/create-bill.mjs (2)

12-12: Version bump looks fine.


39-47: Contact selection now strictly by ContactID; confirm this is intended.

Since the payload always includes Contact.ContactID, this effectively requires selecting an existing contact ID (unless users manually type an ID). If the prior behavior supported passing richer Contact details (e.g., by name/number), confirm that removing it won’t break expected usage.

Also applies to: 79-83

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.

Xero New or Updated Quote

4 participants