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

@classytic/transfer

v0.4.0

Published

Inter-branch stock transfer and stock request domain kernel — FSM lifecycle, FlowBridge port for WMS integration, approval chain support. Framework-agnostic; hosts wire Flow, catalog, and sequence bridges.

Readme

@classytic/transfer

Inter-branch stock transfer and stock request domain kernel for Classytic commerce, built on @classytic/mongokit + @classytic/repo-core + @classytic/primitives. Framework-agnostic — hosts wire Arc, Flow (WMS), and a sequence generator via bridges.

Architecture

  • Repositories are the API surface. StockTransferRepository and StockRequestRepository extend mongokit.Repository and carry the domain verbs (createTransfer, approve, dispatch, markInTransit, receive, cancel, forceCancel; createRequest, approve, reject, fulfill, cancel). Arc plugs in via createAdapter().
  • FSM via CAS. Every state transition uses repo.claim() — a lost race returns a typed 409 (TransferTransitionError), never a silent overwrite.
  • Two-sided quantity integrity. receive() clamps over-receipt to the remaining quantity, CASes the items array with a per-line exact-match guard so concurrent partial receives can't clobber each other, and compensates the inbound bridge atomically on failure.
  • Money is paisa integers. No floats; computeTransferTotals / addPaisa guard against drift.

Multi-tenancy

organizationId is the company/tenant scope — distinct from senderBranch / receiverBranch, which are physical locations a transfer moves stock between. multiTenantPlugin scopes every read and write at POLICY priority. The field type drives both the schema and the plugin from one resolved config.

const transfer = createTransferEngine({
  connection: mongoose.connection,
  // multiTenant: false,                  // single-tenant deployments
  // tenantFieldType: 'string',           // UUID/slug auth systems
  bridges: { sequence, flow },
});
await transfer.syncIndexes();             // deploy-time (autoIndex: false in prod)
const t = await transfer.repositories.stockTransfer.createTransfer(input, ctx);

ctx must carry organizationId (defaults are fail-closed: required: true).

Bridges (all optional)

  • sequencenextDocumentNumber() for TRF-/REQ- numbers. Falls back to a non-unique dev placeholder when absent.
  • flow — WMS hand-off. checkAvailability (approve), createOutboundMoveGroup (dispatch), createInboundMoveGroup (receive). CAS happens BEFORE the bridge call so only the single winner fires a move group; failures compensate back. Implement per PACKAGE_RULES rule 7 (String + bridge) — never import Flow directly.

Events

12 events under the transfer: prefix. Pass any Arc EventTransport (eventTransport) and/or a durable OutboxStore (outbox) at construction — every verb emits through the P8 dispatch (outbox save propagates, transport publish swallows). The Zod catalog ships as transferEventDefinitions from the root and /events for Arc's EventRegistry.

Boot requirements

The engine asserts the transactions capability at construction — MongoDB must run as a replica set (receive/dispatch compensation is transactional).

Subpaths

/engine · /domain · /events · /schemas · /testing

Testing

Real MongoDB via mongodb-memory-server (replica set). Unit tier covers paisa math + the event-catalog no-drift invariant; integration tier covers the FSM, CAS races, receive integrity, tenant isolation (+ tenant probe), and P8 dispatch. Arc smoke tests live in the host app, not here.