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

vintrace-sdk

v0.2.1

Published

TypeScript SDK for Vintrace API. Note: This SDK is not affiliated with or endorsed by Vintrace in any way. It is an independent project created by a third-party developer to provide a convenient interface for interacting with the Vintrace API. Use at your

Readme

vintrace-sdk

A TypeScript SDK for the Vintrace API.

Disclaimer: This SDK is not affiliated with or endorsed by Vintrace. It is an independent, third-party project. Use at your own risk. Always refer to the official Vintrace API documentation. Provided as-is without warranties. Test thoroughly before using in production.

GitHub: https://github.com/TheAPIguys/vintrace-sdk


Requirements

  • Node.js >= 18.0.0
  • pnpm (recommended)

Installation

npm install vintrace-sdk
# or
pnpm add vintrace-sdk

Quick Start

import { VintraceClient } from 'vintrace-sdk';

const client = new VintraceClient({
  baseUrl: process.env.VINTRACE_BASE_URL!, // e.g. https://oz50.vintrace.net
  organization: process.env.VINTRACE_ORG!, // your customer/organization code
  token: process.env.VINTRACE_TOKEN!,
});

// List work orders
const [orders, error] = await client.v6.workOrders.getAll({ max: '5', workOrderState: 'ANY' });
if (error) {
  console.error('Error:', error.message, '| status:', error.status);
  console.error('Body:', JSON.stringify(error.body, null, 2));
  console.error('Correlation ID:', error.correlationId);
} else {
  console.log(JSON.stringify(orders, null, 2));
}

// List sales orders filtered by invoice date
const [sales, salesError] = await client.v6.salesOrders.getAll({
  max: '100',
  invStartDate: '2026-01-01',
});
if (salesError) {
  console.error('Error:', salesError.message, '| status:', salesError.status);
} else {
  console.log(JSON.stringify(sales, null, 2));
}

// Vessel details report
const [vessels, vesselsError] = await client.v7.vesselDetailsReport.get({
  limit: 100,
  offset: 0,
  asAtDate: Date.now(),
  vesselType: 'TANK',
});
if (vesselsError) {
  console.error('Error:', vesselsError.message, '| status:', vesselsError.status);
} else {
  console.log(JSON.stringify(vessels.results, null, 2));
}

Configuration

const client = new VintraceClient({
  baseUrl: 'https://oz50.vintrace.net',
  organization: 'wrw',
  token: 'your-bearer-token',
  options: {
    timeout: 30000, // request timeout in ms (default: 30000)
    maxRetries: 3, // exponential backoff retries (default: 3)
    parallelLimit: 5, // max concurrent requests for batch operations (default: 5)
    validateRequests: true, // Zod validate request payloads (default: true)
    validateResponses: true, // Zod validate API responses (default: true)
  },
});

URL format: {baseUrl}/{organization}/api/{version}/{endpoint}


Error Handling

Every API method returns a Go-style [data, error] result tuple — no try/catch required.

import {
  VintraceAuthenticationError,
  VintraceRateLimitError,
  VintraceNotFoundError,
  VintraceAggregateError,
} from 'vintrace-sdk';

const [order, error] = await client.v6.salesOrders.get('123');
if (error) {
  if (error instanceof VintraceAuthenticationError) {
    console.log('Invalid token');
  } else if (error instanceof VintraceRateLimitError) {
    console.log('Rate limited, retry after:', error.retryAfter);
  } else if (error instanceof VintraceNotFoundError) {
    console.log('Entity not found');
  } else if (error instanceof VintraceAggregateError) {
    console.log('Multiple errors:', error.errors.length);
    for (const e of error.errors) console.log(' -', e.message);
  } else {
    console.log('API error:', error.status, error.correlationId);
  }
  return;
}

Error Class Hierarchy

VintraceError (base)
├── VintraceAuthenticationError  (401)
├── VintraceRateLimitError        (429) — has .retryAfter
├── VintraceNotFoundError         (404)
├── VintraceValidationError       (400, 422, other 4xx)
├── VintraceServerError           (500+)
└── VintraceAggregateError        (batch operation failures)

All errors expose: message, status, correlationId, name.


API Patterns

Get by ID

const [order, error] = await client.v6.salesOrders.get('123');

Auto-paginated list

Automatically fetches all pages — yields one item at a time:

for await (const order of client.v6.salesOrders.getAll({ status: 'ACTIVE' })) {
  console.log(order.id, order.name);
}

Batch fetch (parallel)

Fetches multiple IDs concurrently (default: 5 at a time):

const [results, error] = await client.v6.salesOrders.getMany(['id1', 'id2', 'id3']);
if (error) {
  /* handle VintraceAggregateError */
}

Create

const [newOrder, error] = await client.v6.salesOrders.post({
  /* payload */
});

Update

const [updated, error] = await client.v6.salesOrders.update('123', {
  /* payload */
});

Result Type

type VintraceResult<T> =
  | [data: T, error: null] // success
  | [data: null, error: VintraceError] // error
  | [data: null, error: null]; // 204 No Content

Retry Logic

  • Attempts: 3 (configurable via maxRetries)
  • Backoff: 1s → 2s → 4s (exponential)
  • Retryable codes: 408, 429, 500, 502, 503, 504
  • Correlation ID: Sent as X-Correlation-ID header, returned on errors as error.correlationId

API Coverage

v6 Endpoints

| Module | Methods | | ---------------- | ---------------------------------------------------------------------------------------------------------------------- | | WorkOrders | getAll, get, getMany, post, update | | SalesOrders | getAll, get, getMany, post, update | | Refunds | getAll, get, getMany, post | | Parties | getAll, get, getMany, post | | Products | getAll, get, getMany, post | | ProductUpdate | post | | Transactions | search | | IntakeOperations | search | | SampleOperations | search | | BlockAssessments | post | | MRPStock | get, updateFields, getDistributions, getHistoryItems, getRawComponents, getNotes, postNote, updateNote | | Inventory | getAll | | Search | list, lookup |

v7 Endpoints

| Module | Status | Methods | | ------------------- | ------- | ---------------------------------------- | | Costs | Ready | businessUnitTransactions | | Blocks | Ready | getAll, get, post, patch, createAssessment | | Assessments | Ready | getAll | | Vineyards | Ready | post | | MaturitySamples | Ready | post | | Parties (v7) | Ready | getAll, post | | Shipments | Ready | getAll | | BarrelTreatments | Ready | getAll | | Bookings | Ready | post, deactivate | | FruitIntakes | Ready | post, updatePricing, updateMetrics | | BulkIntakes | Ready | getAll, post, patch | | TrialBlends | Ready | getAll | | WorkOrders (v7) | Ready | getAll | | Tirage | Ready | get, patch | | BarrelsMovements | Ready | post | | VesselDetailsReport | Ready | get | | WineBatches | Ready | getAll, post | | Documents | Ready | attach | | Stock | Ready | receive, getDispatches | | Vessels | Ready | getBarrel, getBarrelGroup, getTank, getTankGroup, getTanker, getBin, createTank | | PurchaseOrders | Ready | get, post |


Development

pnpm build          # Build ESM + CJS bundles
pnpm dev            # Watch mode
pnpm typecheck      # TypeScript type checking
pnpm lint           # ESLint
pnpm lint:fix       # Auto-fix ESLint issues
pnpm format         # Prettier
pnpm test run       # Run tests once
pnpm generate-types # Regenerate types from OpenAPI YAML

Output

| Format | File | | ------ | ----------------- | | ESM | dist/index.js | | CJS | dist/index.cjs | | Types | dist/index.d.ts |


License

MIT