npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gravito/satellite-commerce

v0.1.5

Published

這是 Gravito Galaxy 的核心交易與訂單引擎。它專為高性能電商場景設計,具備金融級的原子性保證與「渦輪增壓」擴展能力。

Readme

@gravito/satellite-commerce 🛰️

這是 Gravito Galaxy 的核心交易與訂單引擎。它專為高性能電商場景設計,具備金融級的原子性保證與「渦輪增壓」擴展能力。

🌟 核心特性

  • 原子化下單: 訂單、明細、庫存預扣在單一資料庫事務中完成。
  • 樂觀鎖 (Optimistic Locking): 內建 version 校驗,無需 Redis 即可應對中併發搶購,徹底杜絕超賣。
  • 價格快照 (Snapshotting): 訂單明細紀錄結帳當下的單價,防止商品調價引起的財務糾紛。
  • 調整項系統 (Adjustments): 靈活處理運費、折扣、稅金,支援行銷插件動態注入。
  • Galaxy Hook 聯動: 預留多個掛載點,輕鬆串接紅利、點數、郵件與物流系統。

🚀 快速上手

1. 安裝

# 在您的 Gravito 專案中
bun add @gravito/satellite-commerce

2. 註冊插件

import { CommerceServiceProvider } from '@gravito/satellite-commerce'

await core.use(new CommerceServiceProvider())

3. API 接口

  • POST /api/commerce/checkout: 下單結帳
    • Header X-Idempotency-Key: 確保請求冪等。
    • Body: { items: [{ variantId: 'uuid', quantity: 1 }] }

🔗 Hook 清單 (Galaxy 擴充)

| Hook 名稱 | 類型 | 描述 | Payload / Return | | :--- | :--- | :--- | :--- | | commerce:order:adjustments | Filter | 行銷插件注入折扣或加價 | (adjustments[], { order }) | | commerce:order-placed | Action | 訂單建立後觸發 (紅利/發信) | { orderId: string } | | rewards:assigned | Action | 紅利分配完成後的後續動作 | { memberId, points } |

🏎️ 渦輪增壓模式 (Turbo Mode)

本模組支援「秒開渦輪」。當環境變數 COMMERCE_MODE=turbo 時,可切換為 Redis 預扣與非同步隊列模式(需安裝 turbo-engine 擴展包)。