Skip to content

New Components - picqer #17044

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 15 commits into
base: master
Choose a base branch
from
Open

New Components - picqer #17044

wants to merge 15 commits into from

Conversation

luancazarine
Copy link
Collaborator

@luancazarine luancazarine commented Jun 9, 2025

Resolves #16959.

Summary by CodeRabbit

  • New Features
    • Introduced comprehensive Picqer integration with actions to create, update, search, and retrieve orders, customers, picklists, and returns.
    • Added capabilities to add comments to orders and returns, and to fetch status per order line.
    • Enabled instant event detection via webhooks for a wide range of Picqer events.
  • Improvements
    • Added standardized language, status, and event options for easier selection and filtering.
    • Enhanced dynamic property loading and validation for order creation and updates.
  • Other
    • Minor formatting updates to several app files (added newlines; no functional changes).
    • Updated package versions and dependencies for Picqer and Pipedrive components.

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

vercel bot commented Jun 9, 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 19, 2025 5:54pm
pipedream-docs ⬜️ Ignored (Inspect) Jun 19, 2025 5:54pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jun 19, 2025 5:54pm

Copy link
Contributor

coderabbitai bot commented Jun 9, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update introduces a comprehensive Picqer integration, adding a fully implemented app module, a suite of actions for orders, returns, customers, and picklists, and a webhook event source with signature verification. It also includes supporting constants, utilities, and test data. Minor changes add newlines to unrelated app files.

Changes

File(s) Change Summary
components/picqer/picqer.app.mjs Full implementation of Picqer app: adds propDefinitions and all API methods for orders, customers, comments, etc.
components/picqer/actions/add-order-comment/add-order-comment.mjs New action: Add comment to an order.
components/picqer/actions/add-return-comment/add-return-comment.mjs New action: Add comment to a return.
components/picqer/actions/create-order/create-order.mjs New action: Create a new order with dynamic fields and validation.
components/picqer/actions/update-order/update-order.mjs New action: Update an order with dynamic fields and validation.
components/picqer/actions/get-customer/get-customer.mjs New action: Get customer by ID.
components/picqer/actions/get-order/get-order.mjs New action: Get order by ID.
components/picqer/actions/get-picklist/get-picklist.mjs New action: Get picklist by ID.
components/picqer/actions/get-status-per-order-line/get-status-per-order-line.mjs New action: Get status per order line.
components/picqer/actions/search-orders/search-orders.mjs New action: Search for orders with multiple filters.
components/picqer/common/constants.mjs Adds constants: LIMIT, LANGUAGE_OPTIONS, STATUS_OPTIONS, EVENT_OPTIONS.
components/picqer/common/utils.mjs Adds utility: parseObject for safe JSON parsing.
components/picqer/sources/common/base.mjs Adds generic Picqer webhook handler with signature verification and event emission.
components/picqer/sources/new-event-instant/new-event-instant.mjs Adds "New Event Instant" webhook source, extends base, provides event summary and sample emit.
components/picqer/sources/new-event-instant/test-event.mjs Adds sample event data for testing the webhook source.
components/picqer/package.json Bumps version, adds dependencies (@pipedream/platform, crypto-js).
components/arpoone/arpoone.app.mjs
components/pembee/pembee.app.mjs
components/add_to_calendar_pro/add_to_calendar_pro.app.mjs
components/commonninja/commonninja.app.mjs
components/openai_passthrough/openai_passthrough.app.mjs
components/phonely/phonely.app.mjs
components/test_apps_for_switching_appslug_025/test_apps_for_switching_appslug_025.app.mjs
Adds newline at end of file (no functional change).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Action
    participant PicqerApp
    participant PicqerAPI

    User->>Action: Provide input (e.g., create order)
    Action->>PicqerApp: Call method (e.g., createOrder)
    PicqerApp->>PicqerAPI: Make HTTP request
    PicqerAPI-->>PicqerApp: Return API response
    PicqerApp-->>Action: Return data
    Action-->>User: Return result/summary
Loading
sequenceDiagram
    participant PicqerAPI
    participant WebhookSource
    participant HTTP
    participant User

    PicqerAPI->>WebhookSource: Send webhook event
    WebhookSource->>HTTP: Verify signature
    alt Signature valid
        WebhookSource->>User: Emit event with summary
        HTTP->>PicqerAPI: Respond 200 OK
    else Signature invalid
        HTTP->>PicqerAPI: Respond 401 Unauthorized
    end
Loading

Assessment against linked issues

Objective Addressed Explanation
Implement Picqer app with all required API methods and propDefinitions (#16959)
Add actions: create-order, update-order, get-customer, get-order, get-picklist, search-orders (#16959)
Add actions: add-order-comment, add-return-comment, get-status-per-order-line (#16959)
Add webhook source for event emission with signature verification and filtering (#16959)
Actions for shipment status, shipment data, return receipt, and return receipt data (#16959) No actions for shipment status/data or return receipt/data are present in this PR.

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Add newline at end of unrelated app files (e.g., components/arpoone/arpoone.app.mjs) These changes are unrelated to Picqer integration and not required by the linked objectives.

Suggested reviewers

  • lcaresia

Poem

In the warren of code, new features appear,
Picqer now hops with actions so clear!
Orders and comments, webhooks that sing,
Constants and utils—all ready to spring.
With a twitch of my nose and a thump of my feet,
This integration is looking quite neat!
🐇✨


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 Event (Instant)

Actions
 - Add Order Comment
 - Add Return Comment
 - Create Order
 - Get Customer
 - Get Order
 - Get Picklist
 - Get Status Per Order Line
 - Search Orders
 - Update Order
@luancazarine luancazarine marked this pull request as ready for review June 10, 2025 21:49
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: 12

🧹 Nitpick comments (10)
components/picqer/package.json (1)

15-17: Ensure dependency list is deterministic

Consider alphabetising the keys in "dependencies" (e.g. crypto-js before @pipedream/platform) or adding a lint rule that enforces order. A consistent order avoids unnecessary diff-noise on future bumps.

components/picqer/common/utils.mjs (1)

4-23: Optional: deep-parse plain objects

At the moment only top-level strings / arrays are parsed. If callers pass an object whose property values are JSON strings (common with dynamic fields), they stay unparsed. A recursive walk would make parseObject more generally reusable:

   if (typeof obj === "string") {
     try {
       return JSON.parse(obj);
     } catch (e) {
       return obj;
     }
   }
-  return obj;
+  if (typeof obj === "object") {
+    return Object.fromEntries(
+      Object.entries(obj).map(([k, v]) => [k, parseObject(v)]),
+    );
+  }
+  return obj;
components/picqer/actions/get-picklist/get-picklist.mjs (1)

7-8: Component version mismatch

Action version is 0.0.1 while the package was bumped to 0.1.0. Keeping them aligned helps consumers understand compatibility at a glance.

-  version: "0.0.1",
+  version: "0.1.0",
components/picqer/actions/add-order-comment/add-order-comment.mjs (1)

7-8: Align action version with package

Same as for Get Picklist – bump to 0.1.0 for consistency.

components/picqer/actions/search-orders/search-orders.mjs (1)

30-41: Consider stronger typing or helper UI for date inputs

sinceDate and untilDate are free-form strings. Wrongly-formatted timestamps will silently propagate to the API and are hard to debug.
Pipedream supports the "datetime" prop-type which renders a date-time picker in the UI.

- sinceDate: {
-   type: "string",
+ sinceDate: {
+   type: "datetime",

Same for untilDate.
This gives users immediate feedback and prevents malformed requests.

components/picqer/actions/get-customer/get-customer.mjs (1)

18-26: Handle 404 / empty responses gracefully

getCustomer might return null or throw when the ID is unknown. Emit a meaningful summary instead of “Successfully retrieved customer X”.

try {
  const response = await this.picqer.getCustomer({ $, customerId: this.customerId });
- $.export("$summary", `Successfully retrieved customer ${this.customerId}`);
- return response;
+ if (!response) $.export("$summary", `No customer found with ID ${this.customerId}`);
+ else $.export("$summary", `Customer ${this.customerId} retrieved`);
+ return response;
} catch (err) {
  this.picqer.logError(err, $);
  throw err;
}

Prevents misleading success messages.

components/picqer/actions/update-order/update-order.mjs (1)

234-272: Consider extracting address field visibility logic.

The repetitive pattern of hiding/showing address fields could be extracted to reduce duplication and improve maintainability.

Consider refactoring to:

const addressFields = [
  'deliveryName', 'deliveryContactName', 'deliveryAddress', 'deliveryAddress2',
  'deliveryZipcode', 'deliveryCity', 'deliveryRegion', 'deliveryCountry',
  'invoiceName', 'invoiceContactName', 'invoiceAddress', 'invoiceAddress2',
  'invoiceZipcode', 'invoiceCity', 'invoiceRegion', 'invoiceCountry'
];

addressFields.forEach(field => {
  fixedProps[field].hidden = hasCustomerId;
});
components/picqer/actions/create-order/create-order.mjs (1)

310-315: Consider more descriptive error messages.

The error messages could be enhanced to guide users better.

Apply this diff for clearer error messages:

-      throw new ConfigurationError("Delivery Name is required if **Customer Id** is not provided");
+      throw new ConfigurationError("Either Customer ID or Delivery Name must be provided. Please select a customer or enter delivery details.");
     }
     if (!customerId && !deliveryCountry) {
-      throw new ConfigurationError("Delivery Country is required if **Customer Id** is not provided");
+      throw new ConfigurationError("Delivery Country is required when creating an order without a Customer ID. Please provide a valid ISO 3166 2-character country code.");
components/picqer/picqer.app.mjs (2)

194-238: Consider adding country code validation.

The delivery and invoice country fields require ISO 3166 2-char codes, but there's no validation or helper to ensure correct format.

Consider adding validation or providing a dropdown with country codes:

     deliveryCountry: {
       type: "string",
       label: "Delivery Country",
       description: "Country of delivery address (needs to be ISO 3166 2-char code). Required if **Customer Id** is not provided.",
+      options: async () => {
+        // Return common country codes or fetch from an API
+        return [
+          { label: "United States", value: "US" },
+          { label: "Canada", value: "CA" },
+          { label: "United Kingdom", value: "GB" },
+          // ... more countries
+        ];
+      },
     },

Alternatively, add validation in the action components that use these fields.


301-452: Consider adding JSDoc comments for better developer experience.

The methods section would benefit from JSDoc comments to document parameters, return values, and potential errors. This would improve the developer experience when using this app component.

Example for one method:

/**
 * Create a new order in Picqer
 * @param {Object} opts - Request options
 * @param {Object} opts.$ - Pipedream context object
 * @param {Object} opts.data - Order data
 * @returns {Promise<Object>} Created order object
 * @throws {Error} If the API request fails
 */
createOrder(opts = {}) {
  return this._makeRequest({
    method: "POST",
    path: "/orders",
    ...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 084e31f and c90e38f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (16)
  • components/picqer/actions/add-order-comment/add-order-comment.mjs (1 hunks)
  • components/picqer/actions/add-return-comment/add-return-comment.mjs (1 hunks)
  • components/picqer/actions/create-order/create-order.mjs (1 hunks)
  • components/picqer/actions/get-customer/get-customer.mjs (1 hunks)
  • components/picqer/actions/get-order/get-order.mjs (1 hunks)
  • components/picqer/actions/get-picklist/get-picklist.mjs (1 hunks)
  • components/picqer/actions/get-status-per-order-line/get-status-per-order-line.mjs (1 hunks)
  • components/picqer/actions/search-orders/search-orders.mjs (1 hunks)
  • components/picqer/actions/update-order/update-order.mjs (1 hunks)
  • components/picqer/common/constants.mjs (1 hunks)
  • components/picqer/common/utils.mjs (1 hunks)
  • components/picqer/package.json (2 hunks)
  • components/picqer/picqer.app.mjs (1 hunks)
  • components/picqer/sources/common/base.mjs (1 hunks)
  • components/picqer/sources/new-event-instant/new-event-instant.mjs (1 hunks)
  • components/picqer/sources/new-event-instant/test-event.mjs (1 hunks)
🔇 Additional comments (8)
components/picqer/package.json (1)

15-17: Re-evaluate version ranges

Using caret ranges (^3.1.0, ^4.2.0) automatically picks up new minor / patch versions at deploy time. If Picqer components are sensitive to upstream changes (especially crypto-js for signature verification), consider pinning exact versions or adding an automated lockfile-refresh step to surface breaking changes early.

components/picqer/sources/new-event-instant/test-event.mjs (1)

1-43: Looks good – representative sample event

The static payload is well-structured and mirrors the Picqer docs. No issues found.

components/picqer/actions/get-picklist/get-picklist.mjs (1)

18-24: Verify underlying method exists

Assuming picqer.app.mjs exposes getPicklist, but this isn’t guaranteed at compile-time. Please confirm the method name and signature match; a typo will only surface at runtime.

components/picqer/actions/get-status-per-order-line/get-status-per-order-line.mjs (1)

19-26: Pagination / large-response advisory

getStatusPerOrderLine can return many lines for big orders. Ensure the underlying picqer helper streams or paginates; otherwise responses might exceed Pipedream’s 6 MB limit.

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

1-27: LGTM!

Clean and straightforward implementation of the get order action. Good use of propDefinition for consistency.

components/picqer/actions/update-order/update-order.mjs (1)

309-355: Well-implemented data transformation logic.

Good handling of:

  • Float parsing for discount
  • Array joining for multi-value custom fields
  • Proper field name mapping to API format
components/picqer/common/constants.mjs (1)

1-230: Well-organized constants.

Good structure with clear option objects and comprehensive event types coverage.

components/picqer/actions/create-order/create-order.mjs (1)

253-272: Good handling of required custom fields.

Nice improvement over the update action by including the required property for custom order fields.

Copy link
Collaborator

@GTFalcao GTFalcao left a comment

Choose a reason for hiding this comment

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

LGTM!

There's just this one operator that should be swapped, unless there's a very unlikely reason not to.

I'm applying the suggestion then approving the PR; let me know if this is not correct.

@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] picqer
2 participants