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

@cafeasp/netsuite-core

v0.1.0

Published

NetSuite REST API and SuiteQL client library

Readme

@cafeasp/netsuite-core

NetSuite REST API and SuiteQL client library for Node.js. Zero runtime dependencies — uses only Node.js built-in modules.

Installation

npm install @cafeasp/netsuite-core

Quick Start

import {
  loadConfig,
  createAuthProvider,
  NetSuiteClient,
  SuiteQLClient,
} from "@cafeasp/netsuite-core";

// Load config from ~/.netsuite/config.json or environment variables
const config = loadConfig();
const auth = createAuthProvider(config);
const client = new NetSuiteClient(auth, config.accountId);
const suiteql = new SuiteQLClient(client);

// Run a SuiteQL query
const customers = await suiteql.query(
  "SELECT id, companyname, email FROM customer",
  { limit: 10 }
);
console.log(customers.items);

// Auto-paginate through all results
const allCustomers = await suiteql.queryAll(
  "SELECT id, companyname FROM customer"
);

// CRUD operations
const record = await client.getRecord("customer", "123");
const list = await client.listRecords("item", { limit: 50 });
await client.createRecord("customer", { companyname: "Acme Corp" });
await client.updateRecord("customer", "123", { email: "[email protected]" });
await client.deleteRecord("customer", "456");

Authentication

Uses Token-Based Authentication (TBA) with HMAC-SHA256 signing.

Setup in NetSuite

  1. Enable REST Web Services and Token-Based Authentication in Setup > Company > Enable Features
  2. Create an Integration Record — save the Consumer Key and Consumer Secret
  3. Create an Access Token — save the Token ID and Token Secret

Configuration

Option A: Config file (~/.netsuite/config.json)

{
  "profiles": {
    "default": {
      "authMethod": "tba",
      "accountId": "YOUR_ACCOUNT_ID",
      "consumerKey": "...",
      "consumerSecret": "...",
      "tokenId": "...",
      "tokenSecret": "..."
    }
  }
}

Option B: Environment variables

export NETSUITE_ACCOUNT_ID=YOUR_ACCOUNT_ID
export NETSUITE_CONSUMER_KEY=...
export NETSUITE_CONSUMER_SECRET=...
export NETSUITE_TOKEN_ID=...
export NETSUITE_TOKEN_SECRET=...

Environment variables override file config.

API

loadConfig(options?)

Load config from file and/or environment. Options: { profile?: string, configPath?: string }

createAuthProvider(config)

Create an auth provider from config. Returns an AuthProvider instance.

NetSuiteClient

  • getRecord(type, id, options?) — GET a record
  • listRecords(type, options?) — List records with filtering
  • createRecord(type, body) — Create a record
  • updateRecord(type, id, body) — Update a record
  • deleteRecord(type, id) — Delete a record
  • request(method, path, body?, headers?) — Raw HTTP request

SuiteQLClient

  • query(sql, options?) — Execute SuiteQL (max 1000 rows per call)
  • queryAll(sql) — Auto-paginate through all results

NetSuiteError

Extends Error with statusCode, errorCode, and body properties. Use NetSuiteError.fromResponse(status, body) to parse NetSuite error responses.

Related Packages

License

MIT