Hyperse
  • Pricing
  • FAQs
Newsletter

Subscribe to our newsletter

Receive weekly updates with latest collections and exclusive offers, straight to your inbox.

Hyperse

Headless commerce solutions for brands, developers, and modern ecommerce teams.

Explore

  • Home
  • About Us
  • Partners
  • FAQs

Legal & resources

  • Proposal
  • Privacy Policy
  • Terms & Conditions

© 2026 Hyperse. All rights reserved.


  1. Home
  2. Vendure Plugins
  3. hps-plugin-shipping-carrier
hps-plugin-shipping-carrier

hps-plugin-shipping-carrier

By Hyperse

hps-plugin-shipping-carrier is a Shipping Carrier plugin in the Hub Ship group.hps-plugin-shipping-carrier provides Shipping Carrier plugin capabilities for Hub Ship. Shipping, fulfillment, carrier integration, and tracking workflows. It is especially useful for shipping workflows.

CoreVendure Plugins

Specifications

Technical details and package information for this product.

Package

@hyperse-hub/hps-plugin-shipping-carrier

Support by

Hyperse

Support languages

TypeScript, JavaScript, Prolog, Shell, CSS

Integration type

Core

Category

Vendure Plugins

Compatible with

^3.0.0

Latest version

1.0.11

Downloads

0

Repository

ssh://git@github.com/hyperse-hub/hub-ship

Last published

July 02, 2026

Description
Changelog
loading...

@hyperse-hub/hps-plugin-shipping-carrier

Shipping Carrier Plugin (src/)

This folder contains the runtime implementation of the @hyperse-hub/plugin-shipping-carrier Vendure plugin: the plugin class, Shop API extensions (GraphQL schema + resolvers), services, i18n resources, and the strategy interfaces used to fetch a fulfillment’s tracking timeline.

Exports

The public exports are re-exported from src/index.ts:

  • HpsPluginShippingCarrier: the Vendure plugin class (see hps-shipping-carrier.plugin.ts)
  • HpsPluginShippingCarrierOptions / strategy types: plugin init options and tracking strategy interfaces (see types.ts)
  • buildTestEligibleShippingMethodsInput: helper to build inputs for shipping method eligibility testing (see helpers/build-test-eligible-shipping-methods-input.ts)
  • Constants: injection token + logger context (see constants.ts)

Plugin entry (hps-shipping-carrier.plugin.ts)

HpsPluginShippingCarrier registers:

  • Providers
    • EligibleShippingMethodsService
    • OrderShippingTrackingService
    • HPS_PLUGIN_SHIPPING_CARRIER_INIT_OPTIONS (injection token for init options)
  • Shop API extensions
    • GraphQL schema from api/shop-api.ts
    • Resolvers in resolvers/*

During onApplicationBootstrap, the plugin:

  • Registers i18n resources from i18n/index.ts
  • Calls strategy.init(injector) (if provided) for each configured tracking timeline strategy

Shop GraphQL API (api/shop-api.ts)

The plugin extends the Shop API with:

  • eligibleShippingMethodsForCountry(countryCode: String!): [ShippingMethodQuote!]!

    • Returns priced shipping method quotes (same return type as core eligibleShippingMethods)
    • Implemented by EligibleShippingMethodsShopResolver
  • orderShippingTracking(orderCode: String!): OrderShippingTracking

    • Returns a normalized view of fulfillments and their tracking timelines
    • Implemented by OrderShippingTrackingShopResolver

It also defines types:

  • OrderShippingTracking
  • FulfillmentTracking
  • TrackingTimelineEntry

Resolvers (resolvers/*)

  • EligibleShippingMethodsShopResolver

    • Delegates to EligibleShippingMethodsService.getEligibleShippingMethodsForCountry()
    • Currently passes an empty lines: [] payload and a destination countryCode
  • OrderShippingTrackingShopResolver

    • Delegates to OrderShippingTrackingService.getOrderShippingTracking()

Services (services/*)

EligibleShippingMethodsService

Uses Vendure’s OrderTestingService.testEligibleShippingMethods() to compute shipping method quotes given a destination country (and optional mock lines).

Helper used:

  • helpers/build-test-eligible-shipping-methods-input.ts builds a TestEligibleShippingMethodsInput, filling required address fields when only countryCode is known.

OrderShippingTrackingService

Implements the tracking aggregation flow:

  • Loads order by code via OrderService.findOneByCode()
    • If not found: throws UserInputError('error.order_not_found', { orderCode })
  • Loads fulfillments via OrderService.getOrderFulfillments()
  • For each fulfillment:
    • If there is no trackingCode: returns an empty timeline: []
    • Otherwise finds the first matching strategy (see “Tracking timeline strategies”)
      • If none matched:
        • If throwOnMissingStrategy is true: throws UserInputError('error.tracking_timeline_strategy_not_found', ...)
        • Else: returns an empty timeline: []
      • If a strategy matched:
        • Calls strategy.getTimeline(ctx, input)
        • Normalizes occurredAt to a

Tracking timeline strategies (types.ts)

Tracking timelines are fetched via a strategy list configured at plugin init.

HpsPluginShippingCarrierOptions

  • trackingTimelineStrategies?: TrackingTimelineStrategy[]
    • Checked in order; the first supports() match wins.
  • throwOnMissingStrategy?: boolean
    • If true, missing strategy becomes a user-facing error.
    • Default behavior is false (returns empty timeline).

TrackingTimelineStrategy

Implement this interface to integrate a carrier/provider:

  • name?: string: for logging/debugging
  • init?(injector): optional lifecycle hook called once at bootstrap, allowing you to resolve Vendure providers via Injector
  • supports(input): returns whether this strategy can handle the (method, trackingCode) pair
  • getTimeline(ctx, input): returns a normalized TrackingTimelineEntryInput[]

TrackingTimelineEntryInput is like the GraphQL TrackingTimelineEntry, but accepts occurredAt as Date | string and omits __typename.

Minimal example

i18n (i18n/*)

User-facing errors use translation keys under:

  • i18n/en.ts
  • i18n/zh.ts

Registered at bootstrap via i18n/index.ts and I18nTranslationService.useTranslationResource().

Constants (constants.ts)

  • loggerCtx: HpsPluginShippingCarrier (used for Vendure logger context)
  • HPS_PLUGIN_SHIPPING_CARRIER_INIT_OPTIONS: injection token for init options

On this page

  • @hyperse-hub/hps-plugin-shipping-carrier
  • Shipping Carrier Plugin (src/)
    • Exports
    • Plugin entry (hps-shipping-carrier.plugin.ts)
    • Shop GraphQL API (api/shop-api.ts)
    • Resolvers (resolvers/*)
    • Services (services/*)
      • EligibleShippingMethodsService
      • OrderShippingTrackingService
    • Tracking timeline strategies (types.ts)
      • HpsPluginShippingCarrierOptions
      • TrackingTimelineStrategy
      • Minimal example
    • i18n (i18n/*)
    • Constants (constants.ts)

Date
  • On failure: logs and throws UserInputError('error.tracking_timeline_fetch_failed', ...)
  • import type {
    TrackingTimelineStrategy,
    TrackingTimelineStrategyInput,
    } from './types.js';
    export const ExampleStrategy: TrackingTimelineStrategy = {
    name: 'example',
    supports(input: TrackingTimelineStrategyInput) {
    return input.method === 'ExampleCarrier' && !!input.trackingCode;
    },
    async getTimeline(ctx, input) {
    // Fetch from your carrier API, then normalize:
    return [
    {
    occurredAt: new Date().toISOString(),
    status: 'IN_TRANSIT',
    description: 'Package left origin facility',
    location: 'Shenzhen',
    },
    ];
    },
    };