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

multivendor-order

v0.0.2

Published

Order domain (lifecycle, status machine, ports) for multi-vendor marketplaces

Readme

multivendor-order

Order domain (lifecycle, status machine, EM-threaded transactional ports, shared-config engine mode, shadow-read cutover gates) for multi-vendor marketplaces, extracted from Myownbazaar_server.

Phase 0 scaffold. Models, repositories, status machine, and HTTP controllers move in later phases (see the move-order plan). This package currently ships the plugin shape, ports, engine-mode pin helpers, deadlock-retry backoff, and shadow-reconciliation helpers so the host can start wiring against a stable contract.

Install

pnpm add multivendor-order

Host apps pin an exact version while the extract stabilizes (e.g. "multivendor-order": "0.0.1").

TypeORM version pin

Cross-package entity metadata on a shared DataSource is fragile under version drift. peerDependencies.typeorm and devDependencies.typeorm are pinned to the exact 0.2.45 (no ^/>= range) to match the host resolved version. Bumping TypeORM is a coordinated host + all-plugins change, out of scope for this package alone.

Host wiring

import {
  registerOrderPlugin,
  ORDER_PLUGIN_TOKEN,
  getOrderOrmMetadata,
} from 'multivendor-order';

const plugin = registerOrderPlugin({
  dataSource: connection,
  cart, catalog, pricing, customer, vendor, payment, shipping,
  affiliate, dropship, settings, wallet, // ports, see src/ports.ts
  flags: { defaultEngineMode: 'host', engineModeCacheTtlMs: 5000 },
});

Use getOrderOrmMetadata() when order.engine resolves to package. Keep host entity classes registered while order.engine=host so ORM metadata is not swapped before package code serves traffic (currently a no-op — see MIGRATION_CONTINUITY.md).

Engine mode (host / package / shadow)

Driven by the shared SettingService key order.engine, read through one helper across web/cron/BullMQ workers, TTL-cached ≤ 5s. See ROLLBACK.md for the full consistency/rollback model and named Cutover Owner.

Long-running writes must pin the mode once and re-assert it at TX entry — see TRANSACTION.md and src/engine/orderEngineMode.ts.

Transactional ports

Every port method that mutates same-DB state accepts an EntityManager first argument so it joins the caller's outer transaction — see src/ports.ts and TRANSACTION.md (lock order, compensation table, deadlock retry).

Deadlock retry

retryWithDeadlockBackoff (src/engine/deadlockRetry.ts) retries ER_LOCK_DEADLOCK failures with exponential backoff + full jitter (base 50ms, cap 1000ms, max 3 attempts total). See TRANSACTION.md.

Shadow-read reconciliation

computeReconciliationMs / reconcileShadowCompare (src/shadow/reconcile.ts) implement the retry-compare classification (match / transient / mismatch) described in the move-order plan's shadow-read exit gate. The reconciliation window must come from a measured commit-to-visible p99 — the helper throws if given a non-positive value rather than silently accepting a guessed constant.

Docs

  • TRANSACTION.md — EM ports, compensation table, lock order, deadlock retry, engine pin + TX-entry re-assert.
  • ROLLBACK.md — Cutover Owner, rollback table per phase, observability.
  • MIGRATION_CONTINUITY.md — historical migrations stay host-owned; class-name continuity rule for any future package migration.

Publish tags

order-v* (e.g. order-v0.0.1).