Skip to content

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Aug 22, 2025

Resolves #18049

Summary by CodeRabbit

  • New Features
    • Added Trunkrs actions: Create Shipment, Cancel Shipment, Get Shipment, Get Shipment State, List Shipments, and List Time Slots.
    • Introduced instant webhook sources: New Shipment Created, Shipment Cancelled, Shipment Reviewed, and Shipment State Updated.
    • Enhanced Trunkrs app with selectable shipment number, time slot, and country options, plus improved pagination for listings.
  • Chores
    • Bumped Trunkrs component version to 0.1.0 and added a new platform dependency.

Copy link

vercel bot commented Aug 22, 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 Aug 22, 2025 7:54pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Aug 22, 2025 7:54pm

Copy link
Contributor

coderabbitai bot commented Aug 22, 2025

Walkthrough

Adds Trunkrs app methods, propDefinitions, and pagination; introduces actions for creating, listing, fetching, getting state, and canceling shipments; adds list time slots action; implements webhook base and sources for creation, cancellation, review, and state updates; updates constants; bumps package version and adds dependency.

Changes

Cohort / File(s) Summary
App Core
components/trunkrs/trunkrs.app.mjs
Adds propDefinitions (trunkrsNr, timeSlotId, country), HTTP request helpers, shipment/time slot CRUD-like methods, webhook methods, and a paginator; removes authKeys().
Common Constants
components/trunkrs/common/constants.mjs
Introduces COUNTRIES, WEBHOOK_EVENTS, SHIPMENT_SORT_FIELDS and default aggregate export.
Shipment Actions
components/trunkrs/actions/create-shipment/create-shipment.mjs, components/trunkrs/actions/list-shipments/list-shipments.mjs, components/trunkrs/actions/get-shipment/get-shipment.mjs, components/trunkrs/actions/get-shipment-state/get-shipment-state.mjs, components/trunkrs/actions/cancel-shipment/cancel-shipment.mjs
Adds actions to create, list, get, get state, and cancel shipments. Each calls corresponding app method and sets a summary.
Time Slots Action
components/trunkrs/actions/list-time-slots/list-time-slots.mjs
Adds action to list time slots filtered by country and optional postal code.
Webhook Base
components/trunkrs/sources/common/base-webhook.mjs
Adds reusable webhook source with activate/deactivate hooks, storage of webhook ID, event emission, and abstract getEvent().
Webhook Sources: Shipment Events
components/trunkrs/sources/new-shipment-created/*, components/trunkrs/sources/shipment-cancelled/*, components/trunkrs/sources/shipment-reviewed/*, components/trunkrs/sources/shipment-state-updated/*
Adds instant sources for onCreation, onCancellation, onReview, onStateUpdate with sample events.
Package
components/trunkrs/package.json
Bumps version to 0.1.0; adds dependency @pipedream/platform@^3.1.0.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Action as Create Shipment Action
  participant App as Trunkrs App
  participant API as Trunkrs API

  User->>Action: Provide sender/recipient, parcels, timeSlotId, service
  Action->>App: createShipment(payload, $)
  App->>API: POST /v2/shipments (payload)
  API-->>App: 201 Created + data
  App-->>Action: data
  Action-->>User: Return data (+ export "$summary")
Loading
sequenceDiagram
  autonumber
  participant Src as Webhook Source (Base)
  participant App as Trunkrs App
  participant API as Trunkrs API
  participant DB as Source DB
  participant PD as Pipedream Runtime

  rect rgba(200,230,255,0.3)
  note over Src,API: Activation
  Src->>App: createWebhook({ endpoint, event })
  App->>API: POST /v2/webhooks
  API-->>App: webhookId
  App-->>Src: webhookId
  Src->>DB: store hookId
  end

  rect rgba(220,255,220,0.3)
  note over API,Src: Event Delivery
  API-->>Src: HTTP POST (event body)
  Src->>Src: generateMeta(event)
  Src->>PD: $emit(event, meta)
  end

  rect rgba(255,230,230,0.3)
  note over Src,API: Deactivation
  Src->>DB: read hookId
  Src->>App: deleteWebhook({ webhookId })
  App->>API: DELETE /v2/webhooks/{id}
  API-->>App: 204 No Content
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Assessment against linked issues

Objective Addressed Explanation
List or retrieve shipment details (GET /v2/shipments) [#18049]
Create a new shipment (POST /v2/shipments) [#18049]
Cancel an in-process shipment (POST /v2/shipments/{id}/cancel) [#18049]
Retrieve shipment state/status (GET /v2/shipments/{id}/state, /status) [#18049] State implemented; no status action/method found.
Update/Delete/Label/Track (PUT/DELETE/label/track) [#18049] No actions or app methods for update, delete, label, or track endpoints.

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Add List Time Slots action (components/trunkrs/actions/list-time-slots/list-time-slots.mjs, entire file) Time slots are not mentioned in issue #18049 objectives.
Add webhook base and lifecycle (components/trunkrs/sources/common/base-webhook.mjs, entire file) Webhooks are not requested in the linked issue.
Add webhook sources for creation/cancellation/review/state-updated (components/trunkrs/sources//-*/*.mjs, entire directories) Event sources are outside the specified endpoints in #18049.
Introduce WEBHOOK_EVENTS and COUNTRIES constants (components/trunkrs/common/constants.mjs, lines defining arrays) These support webhooks/time slots not listed in #18049 requirements.

Poem

A rabbit taps deploy with gentle feet,
New shipments hop, cancelations fleet.
Webhooks twitch their ears on cue,
States get fetched—right on through.
Parcels bound, time slots align—
I thump the ground: “Release is fine!” 🐇📦

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-18049

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

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

🧹 Nitpick comments (32)
components/trunkrs/sources/new-shipment-created/test-event.mjs (1)

4-4: Nit: prefer production host in sample link.
Using staging in sample data can confuse users clicking through from the UI.

Apply this minimal change:

-  link: 'https://staging-api.trunkrs.nl/api/v2/shipments/3256906',
+  link: 'https://api.trunkrs.nl/api/v2/shipments/3256906',

If Trunkrs expects a different public host, swap accordingly.

components/trunkrs/sources/shipment-reviewed/test-event.mjs (2)

4-4: Nit: replace staging host with production in link.
Align with other public-facing samples.

-  link: 'https://staging-api.trunkrs.nl/api/v2/shipments/3618093',
+  link: 'https://api.trunkrs.nl/api/v2/shipments/3618093',

6-6: Use a state code that reflects a “reviewed” event.
DATA_PROCESSED may be valid, but for a “Shipment Reviewed” sample, a more representative code (e.g., REVIEWED) helps avoid confusion.

-    code: 'DATA_PROCESSED',
+    code: 'REVIEWED', // Adjust to the exact enum used by Trunkrs if different

If Trunkrs uses a different enum, update accordingly to mirror the API docs.

components/trunkrs/sources/shipment-state-updated/test-event.mjs (1)

4-4: Nit: switch to production API host in link.
Reduces ambiguity for users.

-  link: 'https://staging-api.trunkrs.nl/api/v2/shipments/3859236',
+  link: 'https://api.trunkrs.nl/api/v2/shipments/3859236',
components/trunkrs/sources/shipment-cancelled/test-event.mjs (3)

1-10: LGTM for basic structure; two tweaks recommended below.
Payload mirrors the others; see notes on host and code.


4-4: Nit: use production host in link.
Consistent with other public samples.

-  link: 'https://staging-api.trunkrs.nl/api/v2/shipments/3299275',
+  link: 'https://api.trunkrs.nl/api/v2/shipments/3299275',

6-6: Align state code with a cancellation scenario.
For a “Shipment Cancelled” event, a cancellation-specific code provides a clearer example for users.

-    code: 'DATA_PROCESSED',
+    code: 'CANCELLED', // Replace with the exact enum from Trunkrs if different

If Trunkrs uses a distinct cancellation code (e.g., CANCELLED_BY_MERCHANT), substitute accordingly per the API.

components/trunkrs/sources/shipment-cancelled/shipment-cancelled.mjs (2)

13-15: Prefer using shared constants for event names to avoid typos.

Hardcoding "onCancellation" increases drift risk. If WEBHOOK_EVENTS exists (as suggested in the PR summary), import and reference it.

 import common from "../common/base-webhook.mjs";
 import sampleEmit from "./test-event.mjs";
+import { WEBHOOK_EVENTS } from "../../common/constants.mjs";

 export default {
   ...common,
   key: "trunkrs-shipment-cancelled",
   name: "Shipment Cancelled (Instant)",
   description: "Emit new event when a shipment is cancelled. [See the documentation](https://docs.trunkrs.nl/docs/v2-api-documentation/05ac4fa1b9ade-create-webhook-subscription)",
   version: "0.0.1",
   type: "source",
   methods: {
     ...common.methods,
     getEvent() {
-      return "onCancellation";
+      return WEBHOOK_EVENTS.onCancellation;
     },
   },
   sampleEmit,
 };

6-8: Consistency nit: “Cancelled” vs “Canceled”.

Elsewhere in repos we often use American English (“Canceled”). If other Trunkrs sources in this PR use one style, align this key/name to match.

components/trunkrs/actions/get-shipment-state/get-shipment-state.mjs (1)

18-25: Return handling is fine; consider a more informative summary.

If the response includes a state/status field, surface it in the $summary for quick debugging. Safe fallback keeps it robust.

   async run({ $ }) {
     const { data } = await this.trunkrs.getShipmentState({
       $,
       trunkrsNr: this.trunkrsNr,
     });
-    $.export("$summary", `Successfully fetched shipment state for ${this.trunkrsNr}.`);
+    $.export(
+      "$summary",
+      `Shipment ${this.trunkrsNr}: ${data?.state?.code ?? data?.status ?? "state fetched"}.`,
+    );
     return data;
   },
components/trunkrs/sources/shipment-state-updated/shipment-state-updated.mjs (1)

13-15: Use constants instead of string literal for the event.

To reduce drift and centralize event names, import and use WEBHOOK_EVENTS.onStateUpdate.

 import common from "../common/base-webhook.mjs";
 import sampleEmit from "./test-event.mjs";
+import { WEBHOOK_EVENTS } from "../../common/constants.mjs";

 ...
     ...common.methods,
     getEvent() {
-      return "onStateUpdate";
+      return WEBHOOK_EVENTS.onStateUpdate;
     },
components/trunkrs/sources/shipment-reviewed/shipment-reviewed.mjs (1)

13-15: Centralize event name via constants.

Same rationale as other sources: import WEBHOOK_EVENTS and reference onReview.

 import common from "../common/base-webhook.mjs";
 import sampleEmit from "./test-event.mjs";
+import { WEBHOOK_EVENTS } from "../../common/constants.mjs";

 ...
     ...common.methods,
     getEvent() {
-      return "onReview";
+      return WEBHOOK_EVENTS.onReview;
     },
components/trunkrs/sources/new-shipment-created/new-shipment-created.mjs (2)

13-15: Reference the event via shared constants.

Swap the string literal for WEBHOOK_EVENTS.onCreation to keep events DRY.

 import common from "../common/base-webhook.mjs";
 import sampleEmit from "./test-event.mjs";
+import { WEBHOOK_EVENTS } from "../../common/constants.mjs";

 ...
     ...common.methods,
     getEvent() {
-      return "onCreation";
+      return WEBHOOK_EVENTS.onCreation;
     },

4-18: Optional: factor repeated boilerplate via a tiny factory.

A small helper (e.g., buildWebhookSource({ key, name, description, event, sampleEmit })) could reduce repetition across 4 nearly-identical sources.

Example helper (new file suggestion):

// components/trunkrs/sources/common/build-webhook-source.mjs
import common from "./base-webhook.mjs";

export default ({ key, name, description, event, sampleEmit }) => ({
  ...common,
  key,
  name,
  description,
  version: "0.0.1",
  type: "source",
  methods: {
    ...common.methods,
    getEvent() {
      return event;
    },
  },
  sampleEmit,
});

Then this source becomes:

-import common from "../common/base-webhook.mjs";
-import sampleEmit from "./test-event.mjs";
-export default {
-  ...common,
-  key: "trunkrs-new-shipment-created",
-  name: "New Shipment Created (Instant)",
-  description: "Emit new event when a new shipment is created. [See the documentation](https://docs.trunkrs.nl/docs/v2-api-documentation/05ac4fa1b9ade-create-webhook-subscription)",
-  version: "0.0.1",
-  type: "source",
-  methods: {
-    ...common.methods,
-    getEvent() {
-      return "onCreation";
-    },
-  },
-  sampleEmit,
-};
+import buildWebhookSource from "../common/build-webhook-source.mjs";
+import sampleEmit from "./test-event.mjs";
+import { WEBHOOK_EVENTS } from "../../common/constants.mjs";
+
+export default buildWebhookSource({
+  key: "trunkrs-new-shipment-created",
+  name: "New Shipment Created (Instant)",
+  description: "Emit new event when a new shipment is created. [See the documentation](https://docs.trunkrs.nl/docs/v2-api-documentation/05ac4fa1b9ade-create-webhook-subscription)",
+  event: WEBHOOK_EVENTS.onCreation,
+  sampleEmit,
+});
components/trunkrs/actions/cancel-shipment/cancel-shipment.mjs (2)

18-25: Guard against 204/empty response and standardize success payload

Some cancel endpoints return 204 No Content. Returning data directly could yield undefined. Consider a small guard and also standardize the summary to US English (“canceled”) for consistency.

Apply this diff:

   async run({ $ }) {
-    const { data } = await this.trunkrs.cancelShipment({
+    const { data } = await this.trunkrs.cancelShipment({
       $,
       trunkrsNr: this.trunkrsNr,
     });
-    $.export("$summary", `Successfully cancelled shipment ${this.trunkrsNr}.`);
-    return data;
+    $.export("$summary", `Successfully canceled shipment ${this.trunkrsNr}.`);
+    return data ?? { canceled: true, trunkrsNr: this.trunkrsNr };
   },

18-22: Optional: add brief context to errors

If Trunkrs returns a domain error (e.g., already canceled, not cancelable), a tiny try/catch adding context to the thrown message can improve UX in the PD UI without swallowing the stack trace.

I can draft a minimal error wrapper that preserves original error data while adding actionable context. Want me to push a patch?

components/trunkrs/actions/list-shipments/list-shipments.mjs (3)

12-17: Make sort optional to avoid forcing a choice

Currently sort is required (no optional: true). Unless Trunkrs requires a sort param, let users omit it.

Apply this diff:

     sort: {
       type: "string",
       label: "Sort",
       description: "The field to sort by. Fields prepended with a dash (-) are sorted in descending order.",
       options: constants.SHIPMENT_SORT_FIELDS,
+      optional: true,
     },

25-30: Description says default offset 0, but no default set

Add default: 0 so behavior matches the description.

Apply this diff:

     offset: {
       type: "integer",
       label: "Offset",
       description: "The offset to start from. Default: 0",
-      optional: true,
+      default: 0,
+      optional: true,
     },

18-24: Nit: consider simple input constraints

Adding min: 1 for maxResults and min: 0 for offset prevents accidental negative values.

Apply this diff:

     maxResults: {
       type: "integer",
       label: "Max Results",
       description: "The maximum number of shipments to return. Default: 100",
       default: 100,
       optional: true,
+      min: 1,
     },
@@
     offset: {
       type: "integer",
       label: "Offset",
       description: "The offset to start from. Default: 0",
       default: 0,
       optional: true,
+      min: 0,
     },
components/trunkrs/actions/get-shipment/get-shipment.mjs (1)

18-25: Straightforward fetch with clear summary

Implementation is clean. Consider aligning verb with other actions (“retrieved” vs “fetched”) for consistency, but this is optional.

Apply this diff if you prefer consistency with other actions’ phrasing:

-    $.export("$summary", `Successfully fetched shipment ${this.trunkrsNr}.`);
+    $.export("$summary", `Successfully retrieved shipment ${this.trunkrsNr}.`);
components/trunkrs/actions/list-time-slots/list-time-slots.mjs (2)

24-33: Normalize postal codes before request

Normalizing improves match rates (esp. NL: remove spaces and uppercase). Safe when optional.

Apply this diff:

   async run({ $ }) {
     const { data } = await this.trunkrs.listTimeSlots({
       $,
       params: {
         country: this.country,
-        postalCode: this.postalCode,
+        postalCode: this.postalCode
+          ? this.postalCode.replace(/\s+/g, "").toUpperCase()
+          : undefined,
       },
     });
     $.export("$summary", `Successfully fetched ${data.length} time slots.`);
     return data;
   },

17-22: Confirm API requirement for postalCode

If Trunkrs requires postalCode for certain countries (likely NL/BE), consider making it required or clarifying in the description.

I can update the prop to be conditionally required or enhance the description once we confirm the API rule. Want me to follow up?

components/trunkrs/common/constants.mjs (2)

1-10: Optional: freeze arrays to prevent accidental mutation

These are constant option lists; freezing avoids accidental runtime changes.

Apply this diff:

-const COUNTRIES = [
+const COUNTRIES = Object.freeze([
   {
     value: "NL",
     label: "Netherlands",
   },
   {
     value: "BE",
     label: "Belgium",
   },
-];
+]);

Repeat similarly for WEBHOOK_EVENTS and SHIPMENT_SORT_FIELDS:

-const WEBHOOK_EVENTS = [
+const WEBHOOK_EVENTS = Object.freeze([
   "onStateUpdate",
   "onCreation",
   "onCancellation",
   "onReview",
-];
+]);
@@
-const SHIPMENT_SORT_FIELDS = [
+const SHIPMENT_SORT_FIELDS = Object.freeze([
   "trunkrsNr",
   "-trunkrsNr",
   "recipient.name",
   "-recipient.name",
   "orderReference",
   "-orderReference",
   "sender.companyName",
   "-sender.companyName",
   "sender.name",
   "-sender.name",
   "timeSlot.id",
   "-timeSlot.id",
   "timeSlot.cutOffTime",
   "-timeSlot.cutOffTime",
   "state.code",
   "-state.code",
   "state.reasonCode",
   "-state.reasonCode",
   "state.timeStamp",
   "-state.timeStamp",
   "service",
   "-service",
-];
+]);

44-48: Add named exports for ergonomics and tree-shaking

Keeping the default export is fine; adding named exports improves DX.

Apply this diff:

+export { COUNTRIES, WEBHOOK_EVENTS, SHIPMENT_SORT_FIELDS };
 export default {
   COUNTRIES,
   WEBHOOK_EVENTS,
   SHIPMENT_SORT_FIELDS,
 };
components/trunkrs/sources/common/base-webhook.mjs (3)

12-20: Confirm webhook payload shape and fix “header” vs “headers”.

Trunkrs webhook creation commonly expects a headers object key named “headers”. Using “header” may be ignored. Also consider passing minimal headers only when needed.

Apply this diff if docs confirm “headers”:

-      const { data } = await this.trunkrs.createWebhook({
+      const { data } = await this.trunkrs.createWebhook({
         data: {
           url: this.http.endpoint,
-          header: {},
+          headers: {},
           event: this.getEvent(),
         },
       });

21-28: Clear stored webhook ID after successful deletion.

Avoid leaving stale hookId in the DB after deactivation.

     async deactivate() {
       const hookId = this._getHookId();
       if (hookId) {
         await this.trunkrs.deleteWebhook({
           webhookId: hookId,
         });
+        this._setHookId(null);
       }
     },

48-55: Optionally acknowledge HTTP requests and surface signature verification.

If Trunkrs expects a 2xx quickly, explicitly respond to the webhook to decouple emit latency from the HTTP response. If signatures are supported, verify them before emitting.

   async run(event) {
     const { body } = event;
     if (!body) {
-      return;
+      // 204 No Content when body is absent
+      this.http.respond({ status: 204 });
+      return;
     }
+    // Optional: verify signatures here if Trunkrs delivers any
     const meta = this.generateMeta(body);
     this.$emit(body, meta);
+    this.http.respond({ status: 200 });
   },
components/trunkrs/actions/create-shipment/create-shipment.mjs (2)

79-87: Weight unit options OK; consider documenting default/expectations.

The options look right. Consider clarifying expected precision or max weight per parcel if Trunkrs enforces limits.


103-112: Verify service enum values with API.

Ensure "SAME_DAY" and "SAME_DAY_FROZEN_FOOD" exactly match Trunkrs’ accepted values (including case). If there are more, consider dynamic options.

components/trunkrs/trunkrs.app.mjs (3)

31-47: Guard timeslot options on missing inputs and handle empty responses safely.

Avoid unnecessary API calls when country or postalCode are not set, and handle undefined data.

       async options({
         country, postalCode,
       }) {
-        const { data } = await this.listTimeSlots({
+        if (!country || !postalCode) return [];
+        const { data } = await this.listTimeSlots({
           params: {
             country,
             postalCode,
           },
         });
-        return data.map(({
+        return (data || []).map(({
           id, merchant, deliveryWindow,
         }) => ({
           label: `${merchant.name} - ${deliveryWindow.start} - ${deliveryWindow.end}`,
           value: id,
         }) );
       },

56-58: Normalize base URL to avoid double slashes.

If environment ends with /, concatenation yields //api/v2. Normalize for robustness.

     _baseUrl() {
-      return `${this.$auth.environment}/api/v2`;
+      const base = String(this.$auth.environment || "").replace(/\/+$/, "");
+      return `${base}/api/v2`;
     },

108-113: Verify timeslots path.

Double-check whether the endpoint is /timeslots or /time-slots (or a different path). Adjust if needed.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3463db1 and fa84a77.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • components/trunkrs/actions/cancel-shipment/cancel-shipment.mjs (1 hunks)
  • components/trunkrs/actions/create-shipment/create-shipment.mjs (1 hunks)
  • components/trunkrs/actions/get-shipment-state/get-shipment-state.mjs (1 hunks)
  • components/trunkrs/actions/get-shipment/get-shipment.mjs (1 hunks)
  • components/trunkrs/actions/list-shipments/list-shipments.mjs (1 hunks)
  • components/trunkrs/actions/list-time-slots/list-time-slots.mjs (1 hunks)
  • components/trunkrs/common/constants.mjs (1 hunks)
  • components/trunkrs/package.json (2 hunks)
  • components/trunkrs/sources/common/base-webhook.mjs (1 hunks)
  • components/trunkrs/sources/new-shipment-created/new-shipment-created.mjs (1 hunks)
  • components/trunkrs/sources/new-shipment-created/test-event.mjs (1 hunks)
  • components/trunkrs/sources/shipment-cancelled/shipment-cancelled.mjs (1 hunks)
  • components/trunkrs/sources/shipment-cancelled/test-event.mjs (1 hunks)
  • components/trunkrs/sources/shipment-reviewed/shipment-reviewed.mjs (1 hunks)
  • components/trunkrs/sources/shipment-reviewed/test-event.mjs (1 hunks)
  • components/trunkrs/sources/shipment-state-updated/shipment-state-updated.mjs (1 hunks)
  • components/trunkrs/sources/shipment-state-updated/test-event.mjs (1 hunks)
  • components/trunkrs/trunkrs.app.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-07-24T02:06:47.016Z
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.

Applied to files:

  • components/trunkrs/sources/new-shipment-created/new-shipment-created.mjs
  • components/trunkrs/sources/shipment-reviewed/shipment-reviewed.mjs
  • components/trunkrs/sources/shipment-state-updated/shipment-state-updated.mjs
  • components/trunkrs/sources/shipment-cancelled/shipment-cancelled.mjs
  • components/trunkrs/sources/common/base-webhook.mjs
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
PR: PipedreamHQ/pipedream#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/trunkrs/package.json
⏰ 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 (21)
components/trunkrs/package.json (3)

3-3: Semver bump to 0.1.0 looks appropriate for new public components.
Minor version bump matches the introduction of new actions/sources without breaking existing users.


5-5: The main entry resolves correctly

The file components/trunkrs/trunkrs.app.mjs is present and matches the main field in package.json, so module resolution will succeed. No further changes are needed.


15-17: Dependency & Version Check Complete

  • We confirmed that components/trunkrs/package.json specifies
    "@pipedream/platform": "^3.1.0"
    and that this dependency is actually imported in your code:

    • In components/trunkrs/trunkrs.app.mjs (line 1)
      import { axios } from "@pipedream/platform";
    • In components/trunkrs/sources/common/base-webhook.mjs (line 2)
      import { ConfigurationError } from "@pipedream/platform";
  • Version ^3.1.0 aligns with several other recently updated components in the monorepo (for example, channable, changes_page, buy_me_a_coffee, etc.) and there’s no requirement to bump or downgrade it here.

Everything checks out—no further action required.

components/trunkrs/sources/new-shipment-created/test-event.mjs (1)

1-10: Sample payload shape LGTM.
Static example is concise and representative for sampleEmit.

components/trunkrs/sources/shipment-reviewed/test-event.mjs (1)

1-10: Sample payload shape LGTM.
Matches pattern used across other sources.

components/trunkrs/sources/shipment-state-updated/test-event.mjs (1)

1-10: LGTM overall; consistent with other test events.
Structure aligns with the others; good for sampleEmit.

components/trunkrs/sources/shipment-cancelled/shipment-cancelled.mjs (2)

4-18: Solid extension of the webhook base; getEvent implemented per design.

Extends the common webhook correctly and implements getEvent(), matching the “abstract base” pattern from common. Looks consistent with other sources.


11-16: All event names are correctly aligned and consumed
Verified that components/trunkrs/common/constants.mjs exports “onCancellation” in WEBHOOK_EVENTS, each source’s getEvent() returns the exact matching string (including shipment-cancelled’s “onCancellation”), and base-webhook.mjs uses this.getEvent() to set the webhook’s event field and summary. No further changes needed.

components/trunkrs/actions/get-shipment-state/get-shipment-state.mjs (2)

3-17: Props definition looks correct and follows app propDefinition pattern.

Using the app’s trunkrsNr propDefinition is consistent with the platform’s conventions.


18-25: No action needed: getShipmentState return shape and trunkrsNr propDefinition are correct

Both the API method and the action’s prop definition have been verified:

  • In components/trunkrs/trunkrs.app.mjs, the getShipmentState method is implemented as:
      getShipmentState({ trunkrsNr, ...opts }) {
        return this._makeRequest({
          path: `/shipments/${trunkrsNr}/status`,
          ...opts,
        });
      }
    where _makeRequest delegates to the platform’s axios($, …) call, supplying the full response object (which includes a data field).
  • In components/trunkrs/actions/get-shipment-state/get-shipment-state.mjs, the action’s props include:
      trunkrsNr: {
        propDefinition: [trunkrs, "trunkrsNr"],
      },
    and trunkrs.app.mjs exports a corresponding propDefinitions.trunkrsNr.

Since the action destructures const { data } = await this.trunkrs.getShipmentState(…) and returns data, and the trunkrsNr prop is properly defined, no changes are required here.

components/trunkrs/sources/shipment-state-updated/shipment-state-updated.mjs (1)

4-18: Good parity with other webhook sources; aligns with the base’s extension model.

Straightforward and consistent with the pattern used across the Trunkrs sources.

components/trunkrs/sources/shipment-reviewed/shipment-reviewed.mjs (1)

4-18: Pattern is consistent and readable; getEvent override is in the right place.

Matches the shared webhook scaffolding and keeps the surface minimal.

components/trunkrs/sources/new-shipment-created/new-shipment-created.mjs (1)

4-18: Looks good; mirrors the other Trunkrs webhook sources cleanly.

Clear metadata, minimal method override, and proper sampleEmit wiring.

components/trunkrs/actions/cancel-shipment/cancel-shipment.mjs (1)

9-17: Props wiring looks correct and consistent with app propDefinitions

Using the trunkrsNr propDefinition from the app is aligned with other actions and keeps inputs consistent.

components/trunkrs/actions/list-shipments/list-shipments.mjs (2)

45-51: LGTM on iteration and return shape

Streaming via for await over the paginator is clear, and the summary reflects the bounded result size by maxResults.


32-43: No action needed: paginate already handles default limit and offsets

The paginate implementation in components/trunkrs/trunkrs.app.mjs injects limit: DEFAULT_LIMIT (where DEFAULT_LIMIT = 100) into every request and inside its loop advances the offset by that same limit (args.params.offset += args.params.limit). Therefore, explicitly passing limit: this.trunkrs.DEFAULT_LIMIT in the list-shipments action is redundant, and offset handling is already correct.

components/trunkrs/actions/get-shipment/get-shipment.mjs (1)

9-17: Props wiring is consistent and reusable

Using the shared trunkrsNr propDefinition keeps UX consistent across actions.

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

19-42: Verify Trunkrs API sort fields

The values in SHIPMENT_SORT_FIELDS are forwarded unchanged as the sort query parameter to the List Shipments endpoint. Please confirm against the official Trunkrs API documentation which keys are accepted and remove any unsupported fields (especially nested paths) to avoid 400 errors.

• components/trunkrs/common/constants.mjs (lines 19–42)
• components/trunkrs/actions/list-shipments/list-shipments.mjs – sort prop (lines 12–17) and API call (line 38)

components/trunkrs/sources/common/base-webhook.mjs (1)

44-46: Good: enforce subclass implementation contract.

Throwing ConfigurationError is appropriate to require concrete sources to implement getEvent().

components/trunkrs/actions/create-shipment/create-shipment.mjs (1)

114-147: I’ve initiated a search for all occurrences of createShipment to locate its definition and verify the expected payload shape. I’ll await the results and then continue validation.

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

70-76: Webhook helpers look good.

The create/delete webhook helpers align with the base webhook usage.

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!

@michelle0927 michelle0927 merged commit bfaac7e into master Aug 25, 2025
10 checks passed
@michelle0927 michelle0927 deleted the issue-18049 branch August 25, 2025 15:32
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.

Trunkrs
2 participants