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

@winnermarket/api-client

v1.0.0

Published

Typed HTTP client for the Transiqo REST API — isomorphic core plus optional React Query bindings (subpath `/react`).

Downloads

150

Readme

@winnermarket/api-client

Typed HTTP client for the Transiqo REST API. Isomorphic core plus optional React Query bindings.

Proprietary software. See LICENSE. Use requires an active commercial agreement with Techassistia.


Install

pnpm add @winnermarket/api-client
# React bindings also need:
pnpm add react @tanstack/react-query

Node >= 18 required.


Two entrypoints

| Entry | Peer deps | Purpose | |-------|-----------|---------| | @winnermarket/api-client | none | ApiClient + ApiError + envelope types | | @winnermarket/api-client/react | react, @tanstack/react-query | ApiClientProvider, useApiClient, 22 domain hooks |


Core client

import { ApiClient, ApiError } from "@winnermarket/api-client";

const api = new ApiClient("https://api.example.com/v1", {
  unwrapEnvelope: true,           // `{ success, data }` → return `data` (default: true)
  credentials: "include",          // fetch credentials mode (default: "include")
  onAuthError: (err) => {          // called on HTTP 401 before throwing
    console.warn("Token expired, redirecting…");
    location.href = "/login";
  },
  defaultHeaders: { "X-Tenant": "acme" },
});

api.setToken(accessToken);

// Typed responses
const me = await api.get<User>("/auth/me");
const widget = await api.post<Widget>("/widgets", { name: "X" });

try {
  await api.delete("/widgets/99");
} catch (err) {
  if (err instanceof ApiError && err.isNotFound) {
    // handle
  }
}

Options

| Option | Default | Description | |--------|---------|-------------| | unwrapEnvelope | true | Unwrap { success, data } envelope from NestJS-style APIs | | credentials | "include" | fetch credentials mode | | onAuthError | – | Callback invoked on HTTP 401 responses | | defaultHeaders | {} | Extra headers sent on every request | | fetch | globalThis.fetch | Custom fetch impl (SSR polyfill, tests…) |

ApiError

Thrown on any non-2xx response. Exposes statusCode, code, message, optional details, plus helpers: isUnauthorized, isForbidden, isNotFound, isValidationError.


React bindings

import {
  ApiClientProvider,
  useApiClient,
  useMe,
  useLogin,
} from "@winnermarket/api-client/react";

function Root() {
  return (
    <ApiClientProvider
      baseUrl={process.env.NEXT_PUBLIC_API_URL}
      clientOptions={{
        onAuthError: () => window.location.assign("/login"),
      }}
    >
      <App />
    </ApiClientProvider>
  );
}

function Profile() {
  const { data, isLoading } = useMe();
  const login = useLogin();
  // …
}

Passing an existing ApiClient

const api = new ApiClient("/api/v1", { onAuthError });

<ApiClientProvider apiClient={api}>
  <App />
</ApiClientProvider>;

Domain hooks included

auth, fleet, rental, vtc, transit, finance, crm, maintenance, settings, documents, reporting, shift, ai, tracking, planning, ticketing, intermodal, payroll, training, ml, pricing.

See the d.ts in your editor for the exact signatures.


On-prem / third-party backends

The client is not hardcoded to Transiqo URLs. Point it at any NestJS-compatible API by setting baseUrl; flip unwrapEnvelope: false if your backend returns raw JSON instead of the NestJS interceptor envelope.


© Techassistia. All rights reserved.