Skip to content

New Components - easyship #16818

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

New Components - easyship #16818

wants to merge 3 commits into from

Conversation

michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented May 23, 2025

Resolves #13239

Summary by CodeRabbit

  • New Features

    • Added Easyship integration with actions to create and find shipments.
    • Introduced instant event sources for tracking shipping label creation, tracking status updates, and warehouse state changes.
    • Enabled dynamic handling and testing of webhook events for shipment updates.
    • Implemented comprehensive shipment creation inputs including dynamic parcel details and category selection.
    • Added paginated shipment listing and webhook management capabilities to Easyship integration.
  • Chores

    • Updated package version and dependencies for Easyship integration.
    • Adjusted package configuration for improved compatibility and maintenance.

Copy link

vercel bot commented May 23, 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 May 23, 2025 7:04pm
pipedream-docs ⬜️ Ignored (Inspect) May 23, 2025 7:04pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) May 23, 2025 7:04pm

Copy link
Contributor

coderabbitai bot commented May 23, 2025

Walkthrough

This update introduces a new Easyship integration, including a redesigned app definition with API methods, two actions (create and find shipment), and three instant event sources for webhooks (shipping label created, tracking status updated, warehouse state updated). It also adds a common webhook base module, test event data modules, and updates package metadata and dependencies. Legacy files were removed.

Changes

Files/Paths Change Summary
components/easyship/.gitignore, components/easyship/app/easyship.app.ts Deleted legacy .gitignore and TypeScript app definition.
components/easyship/easyship.app.mjs, components/easyship/package.json Added new Easyship app integration with API methods, pagination helpers, shipment and webhook management, and updated package metadata and dependencies.
components/easyship/actions/create-shipment/create-shipment.mjs, components/easyship/actions/find-shipment/find-shipment.mjs Added actions for creating and finding shipments, supporting dynamic properties and API interaction with Easyship.
components/easyship/sources/common/base.mjs Added common base module for webhook lifecycle management, event handling, metadata generation, and HTTP response.
components/easyship/sources/new-shipping-label-created/new-shipping-label-created.mjs, components/easyship/sources/tracking-status-updated/tracking-status-updated.mjs, components/easyship/sources/warehouse-state-updated/warehouse-state-updated.mjs Added three instant event sources for shipping label creation, tracking status updates, and warehouse state updates, each extending the common base and specifying event types.
components/easyship/sources/new-shipping-label-created/test-event.mjs, components/easyship/sources/tracking-status-updated/test-event.mjs, components/easyship/sources/warehouse-state-updated/test-event.mjs Added static test event data modules for each webhook event source to simulate or validate event handling.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant EasyshipAction
    participant EasyshipApp
    participant EasyshipAPI

    User->>EasyshipAction: Trigger "Create Shipment"
    EasyshipAction->>EasyshipApp: createShipment(payload)
    EasyshipApp->>EasyshipAPI: POST /shipments
    EasyshipAPI-->>EasyshipApp: Shipment created response
    EasyshipApp-->>EasyshipAction: Return shipment data
    EasyshipAction-->>User: Summary with shipment ID

    User->>EasyshipAction: Trigger "Find Shipment"
    EasyshipAction->>EasyshipApp: getShipment(shipmentId)
    EasyshipApp->>EasyshipAPI: GET /shipments/{id}
    EasyshipAPI-->>EasyshipApp: Shipment details
    EasyshipApp-->>EasyshipAction: Return shipment details
    EasyshipAction-->>User: Summary with shipment info

    EasyshipAPI-->>EasyshipApp: Webhook event (e.g., shipment_label_created)
    EasyshipApp->>WebhookSource: Forward event
    WebhookSource->>WebhookSource: Process event and emit with metadata
Loading

Assessment against linked issues

Objective Addressed Explanation
Create shipment action with required props for shipment details (origin, destination, weight, etc.) (#13239)
Find shipment action by Easyship Shipment ID (#13239)
Emit new event when a shipping label is paid and generated, with recipient/item/tracking info (#13239)
Emit new event when a shipment is delivered (shipment-delivered) (#13239) No source for "shipment-delivered" event is included in this update.
Emit new event when a shipment is handed to courier (shipment-in-transit) (#13239) No source for "shipment-in-transit" event is included in this update.

Suggested labels

ai-assisted

Suggested reviewers

  • jcortes

Poem

A hop, a skip, a shipment flies,
With Easyship, the parcels rise!
Actions, sources, webhooks too—
Tracking every box for you.
With every label, status, state,
This rabbit codes to celebrate!
📦🐇✨

Warning

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

🔧 ESLint

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

components/easyship/actions/create-shipment/create-shipment.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

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

components/easyship/sources/common/base.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

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

components/easyship/easyship.app.mjs

Oops! Something went wrong! :(

ESLint: 8.57.1

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

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d0cfb77 and e41605d.

📒 Files selected for processing (3)
  • components/easyship/actions/create-shipment/create-shipment.mjs (1 hunks)
  • components/easyship/easyship.app.mjs (1 hunks)
  • components/easyship/sources/common/base.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • components/easyship/sources/common/base.mjs
  • components/easyship/actions/create-shipment/create-shipment.mjs
  • components/easyship/easyship.app.mjs
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

Support

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

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

CodeRabbit Commands (Invoked using PR comments)

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

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

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

Documentation and Community

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

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

🧹 Nitpick comments (3)
components/easyship/easyship.app.mjs (1)

24-24: Consider making API version configurable.

The API version is hardcoded to "2023-01" which may become outdated over time. Consider making this configurable or adding a comment about version management strategy.

 _baseUrl() {
-  return "https://public-api.easyship.com/2023-01";
+  return `https://public-api.easyship.com/${this.$auth.api_version || "2023-01"}`;
 },
components/easyship/sources/warehouse-state-updated/test-event.mjs (1)

1-10: LGTM! Well-structured test event.

The test event structure is comprehensive and follows standard webhook event patterns. The use of consistent test identifiers (ESTEST00000, #100001) across the integration is good practice.

Consider documenting the possible values for warehouse_state field to ensure test coverage.

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

29-29: Fix typo in description

Missing space in "originaddress".

Apply this diff:

-      description: "The company or organization at the originaddress",
+      description: "The company or organization at the origin address",
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 630af8d and d0cfb77.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (13)
  • components/easyship/.gitignore (0 hunks)
  • components/easyship/actions/create-shipment/create-shipment.mjs (1 hunks)
  • components/easyship/actions/find-shipment/find-shipment.mjs (1 hunks)
  • components/easyship/app/easyship.app.ts (0 hunks)
  • components/easyship/easyship.app.mjs (1 hunks)
  • components/easyship/package.json (1 hunks)
  • components/easyship/sources/common/base.mjs (1 hunks)
  • components/easyship/sources/new-shipping-label-created/new-shipping-label-created.mjs (1 hunks)
  • components/easyship/sources/new-shipping-label-created/test-event.mjs (1 hunks)
  • components/easyship/sources/tracking-status-updated/test-event.mjs (1 hunks)
  • components/easyship/sources/tracking-status-updated/tracking-status-updated.mjs (1 hunks)
  • components/easyship/sources/warehouse-state-updated/test-event.mjs (1 hunks)
  • components/easyship/sources/warehouse-state-updated/warehouse-state-updated.mjs (1 hunks)
💤 Files with no reviewable changes (2)
  • components/easyship/.gitignore
  • components/easyship/app/easyship.app.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Lint Code Base
🔇 Additional comments (10)
components/easyship/easyship.app.mjs (1)

11-19:

✅ Verification successful

Verify shipmentId property mapping.

Ensure that shipment.easyship_shipment_id is the correct field name returned by the Easyship API for shipment IDs.


🏁 Script executed:

#!/bin/bash
# Description: Verify the shipmentId field mapping in other Easyship integration files
# Expected: Find usage of easyship_shipment_id to confirm the field name

rg -A 3 -B 3 "easyship_shipment_id" --type js --type ts

Length of output: 55


🏁 Script executed:

#!/bin/bash
# Broad search for `easyship_shipment_id` across all file types
rg -n "easyship_shipment_id" .

# Locate the implementation of `listShipments` to inspect the API response mapping
rg -n "listShipments" -n .

Length of output: 1256


Shipment ID mapping confirmed

Verified that easyship_shipment_id is the correct field name returned by the Easyship API (used in test fixtures, the create-shipment action summary, and directly exposed by listShipments). No changes required.

components/easyship/package.json (1)

3-17: LGTM! Package configuration properly updated.

The package configuration changes are well-structured:

  • Appropriate version bump to 0.1.0 for new features
  • Correct main entry point update
  • Proper dependency declaration for @pipedream/platform
  • Clean removal of dist-related configuration
components/easyship/sources/tracking-status-updated/test-event.mjs (1)

1-15: LGTM! Comprehensive test event structure.

The test event provides excellent coverage of tracking status fields including origin/destination, status, tracking number, and tracking URL. The consistent use of test identifiers across all test events in this integration is well-planned.

components/easyship/sources/new-shipping-label-created/new-shipping-label-created.mjs (1)

1-19: LGTM! Clean and consistent implementation.

The source component follows the established pattern correctly:

  • Proper imports and base extension
  • Consistent naming convention for the key
  • Appropriate metadata (version, type, dedupe strategy)
  • Clean method override for event type specification

The implementation is minimal and focused, which is appropriate for a webhook source component.

components/easyship/sources/tracking-status-updated/tracking-status-updated.mjs (1)

1-19: LGTM! Excellent consistency with other source components.

This component maintains the same clean structure as the shipping label source:

  • Consistent import pattern and base extension
  • Logical key naming following the established convention
  • Appropriate event type specification for tracking status changes
  • Proper use of sampleEmit for testing purposes

The consistency across source components will make the codebase easier to maintain.

components/easyship/sources/new-shipping-label-created/test-event.mjs (1)

1-13:

✅ Verification successful

Verify event type format consistency.

The test event structure is comprehensive and realistic. However, there's a potential discrepancy in event type formats:

  • Test event uses: "shipment.label.created" (with dots)
  • Source component returns: "shipment_label_created" (with underscores)

Please verify this is intentional and represents the correct mapping between Easyship's webhook payload format and Pipedream's internal event type handling.


🏁 Script executed:

#!/bin/bash
# Description: Check if other source components have similar event type format differences
# Expected: Find pattern of dot vs underscore usage in event types

echo "Checking event types in source components:"
rg -A 2 -B 2 "getEventType|event_type" --type js

echo -e "\nChecking for similar patterns in other integrations:"
fd -e mjs -e js | xargs rg -l "event_type.*\." | head -5

Length of output: 553


🏁 Script executed:

#!/bin/bash
# Search for getEventType implementation in the Easyship integration
rg -n "getEventType" | grep -i components/easyship

Length of output: 448


🏁 Script executed:

#!/bin/bash
echo "Inspecting getEventType in new-shipping-label-created source:"
rg -C3 "getEventType" components/easyship/sources/new-shipping-label-created/new-shipping-label-created.mjs

echo -e "\nInspecting base.mjs around this.getEventType usage:"
rg -C3 "this.getEventType" components/easyship/sources/common/base.mjs

Length of output: 726


🏁 Script executed:

#!/bin/bash
echo "Checking event_type in easyship test-event files:"
fd -e mjs components/easyship/sources -g "test-event.mjs" | while read f; do
  echo "$f:"
  rg -n '"event_type"' "$f"
done

Length of output: 277


🏁 Script executed:

#!/bin/bash
echo "Finding all test-event.mjs files and their event_type fields:"
fd -g 'test-event.mjs' -e mjs | while read f; do
  echo "File: $f"
  rg -n '"event_type"' "$f"
done

Length of output: 91872


Event type formats are correct: external vs internal

The test event’s event_type: "shipment.label.created" reflects the actual Easyship webhook payload format (dot-delimited), whereas getEventType() returns "shipment_label_created" (underscore-delimited) for Pipedream’s internal subscription. This separation between external payload format and internal event naming is intentional and consistent with other integrations—no changes required.

components/easyship/sources/warehouse-state-updated/warehouse-state-updated.mjs (1)

1-19: LGTM! Perfect consistency maintained across all source components.

This component completes the set of Easyship source components with the same excellent pattern:

  • Consistent structure and imports
  • Logical key and event type naming
  • Proper extension of common base functionality
  • Clean and minimal implementation

The consistency across all three source components (shipping label, tracking status, warehouse state) demonstrates good architectural planning and will facilitate easy maintenance and future extensions.

components/easyship/sources/common/base.mjs (1)

58-64: Good webhook response pattern

Excellent implementation of the webhook pattern - responding immediately with 200 status before processing the event data. This prevents webhook timeouts and ensures reliable delivery.

components/easyship/actions/find-shipment/find-shipment.mjs (1)

1-26: Well-implemented action

Clean and straightforward implementation following Pipedream best practices. Good use of propDefinition and proper summary export.

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

110-158: Excellent dynamic property implementation

Well-designed dynamic property generation based on the number of parcels. The async loading of category options is properly implemented.

Copy link
Collaborator

@luancazarine luancazarine left a comment

Choose a reason for hiding this comment

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

Hi @michelle0927, LGTM! Ready for QA!

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.

[Components] easyship
2 participants